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