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