| 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 <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 61 |
| 62 // Fires an event to send updated info back to the page. | 62 // Fires an event to send updated info back to the page. |
| 63 void HandleRequestUpdatedAboutInfo(const base::ListValue* args); | 63 void HandleRequestUpdatedAboutInfo(const base::ListValue* args); |
| 64 | 64 |
| 65 // Fires and event to send the list of types back to the page. | 65 // Fires and event to send the list of types back to the page. |
| 66 void HandleRequestListOfTypes(const base::ListValue* args); | 66 void HandleRequestListOfTypes(const base::ListValue* args); |
| 67 | 67 |
| 68 // Handler for getAllNodes message. Needs a |request_id| argument. | 68 // Handler for getAllNodes message. Needs a |request_id| argument. |
| 69 void HandleGetAllNodes(const base::ListValue* args); | 69 void HandleGetAllNodes(const base::ListValue* args); |
| 70 | 70 |
| 71 // Handler for requests to get UserEvents tab visibility. |
| 72 void HandleRequestUserEventsVisibility(const base::ListValue* args); |
| 73 |
| 74 // Handler for writeUserEvent message. |
| 75 void HandleWriteUserEvent(const base::ListValue* args); |
| 76 |
| 71 // syncer::JsEventHandler implementation. | 77 // syncer::JsEventHandler implementation. |
| 72 void HandleJsEvent(const std::string& name, | 78 void HandleJsEvent(const std::string& name, |
| 73 const syncer::JsEventDetails& details) override; | 79 const syncer::JsEventDetails& details) override; |
| 74 | 80 |
| 75 // Callback used in GetAllNodes. | 81 // Callback used in GetAllNodes. |
| 76 void OnReceivedAllNodes(int request_id, | 82 void OnReceivedAllNodes(int request_id, |
| 77 std::unique_ptr<base::ListValue> nodes); | 83 std::unique_ptr<base::ListValue> nodes); |
| 78 | 84 |
| 79 // syncer::SyncServiceObserver implementation. | 85 // syncer::SyncServiceObserver implementation. |
| 80 void OnStateChanged(syncer::SyncService* sync) override; | 86 void OnStateChanged(syncer::SyncService* sync) override; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 104 SyncInternalsMessageHandler( | 110 SyncInternalsMessageHandler( |
| 105 std::unique_ptr<AboutSyncDataExtractor> about_sync_data_extractor); | 111 std::unique_ptr<AboutSyncDataExtractor> about_sync_data_extractor); |
| 106 | 112 |
| 107 private: | 113 private: |
| 108 // Fetches updated aboutInfo and sends it to the page in the form of an | 114 // Fetches updated aboutInfo and sends it to the page in the form of an |
| 109 // onAboutInfoUpdated event. | 115 // onAboutInfoUpdated event. |
| 110 void SendAboutInfo(); | 116 void SendAboutInfo(); |
| 111 | 117 |
| 112 browser_sync::ProfileSyncService* GetProfileSyncService(); | 118 browser_sync::ProfileSyncService* GetProfileSyncService(); |
| 113 | 119 |
| 120 // Tries to send dispatch event if the ui has initialized, otherwise the |
| 121 // event is dropped. |
| 122 void TryCallDispatch(const base::Value& name_value, |
| 123 const base::Value& details_value); |
| 124 |
| 114 base::WeakPtr<syncer::JsController> js_controller_; | 125 base::WeakPtr<syncer::JsController> js_controller_; |
| 115 | 126 |
| 116 // A flag used to prevent double-registration with ProfileSyncService. | 127 // A flag used to prevent double-registration with ProfileSyncService. |
| 117 bool is_registered_ = false; | 128 bool is_registered_ = false; |
| 118 | 129 |
| 119 // A flag used to prevent double-registration as TypeDebugInfoObserver with | 130 // A flag used to prevent double-registration as TypeDebugInfoObserver with |
| 120 // ProfileSyncService. | 131 // ProfileSyncService. |
| 121 bool is_registered_for_counters_ = false; | 132 bool is_registered_for_counters_ = false; |
| 122 | 133 |
| 123 // An abstraction of who creates the about sync info value map. | 134 // An abstraction of who creates the about sync info value map. |
| 124 std::unique_ptr<AboutSyncDataExtractor> about_sync_data_extractor_; | 135 std::unique_ptr<AboutSyncDataExtractor> about_sync_data_extractor_; |
| 125 | 136 |
| 126 base::WeakPtrFactory<SyncInternalsMessageHandler> weak_ptr_factory_; | 137 base::WeakPtrFactory<SyncInternalsMessageHandler> weak_ptr_factory_; |
| 127 | 138 |
| 128 DISALLOW_COPY_AND_ASSIGN(SyncInternalsMessageHandler); | 139 DISALLOW_COPY_AND_ASSIGN(SyncInternalsMessageHandler); |
| 129 }; | 140 }; |
| 130 | 141 |
| 131 #endif // CHROME_BROWSER_UI_WEBUI_SYNC_INTERNALS_MESSAGE_HANDLER_H_ | 142 #endif // CHROME_BROWSER_UI_WEBUI_SYNC_INTERNALS_MESSAGE_HANDLER_H_ |
| OLD | NEW |