blob: 5b652d5627ade67284270dda9fa7a8503d0bb108 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_WEBUI_SYNC_INTERNALS_MESSAGE_HANDLER_H_
#define CHROME_BROWSER_UI_WEBUI_SYNC_INTERNALS_MESSAGE_HANDLER_H_
#include <string>
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/memory/weak_ptr.h"
#include "base/values.h"
#include "content/public/browser/web_ui_message_handler.h"
#include "sync/js/js_controller.h"
#include "sync/js/js_event_handler.h"
#include "sync/js/js_reply_handler.h"
class ProfileSyncService;
// The implementation for the chrome://sync-internals page.
class SyncInternalsMessageHandler
: public content::WebUIMessageHandler,
public syncer::JsEventHandler,
public syncer::JsReplyHandler {
public:
SyncInternalsMessageHandler();
virtual ~SyncInternalsMessageHandler();
virtual void RegisterMessages() OVERRIDE;
void ForwardToJsController(const std::string& name, const base::ListValue*);
void OnGetAboutInfo(const base::ListValue*);
void OnGetListOfTypes(const base::ListValue*);
// syncer::JsEventHandler implementation.
virtual void HandleJsEvent(
const std::string& name,
const syncer::JsEventDetails& details) OVERRIDE;
// syncer::JsReplyHandler implementation.
virtual void HandleJsReply(
const std::string& name,
const syncer::JsArgList& args) OVERRIDE;
private:
void RegisterJsControllerCallback(const std::string& name);
ProfileSyncService* GetProfileSyncService();
base::WeakPtr<syncer::JsController> js_controller_;
base::WeakPtrFactory<SyncInternalsMessageHandler> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(SyncInternalsMessageHandler);
};
#endif // CHROME_BROWSER_UI_WEBUI_SYNC_INTERNALS_MESSAGE_HANDLER_H_
|