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 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/scoped_observer.h" | 14 #include "base/scoped_observer.h" |
15 #include "base/values.h" | 15 #include "base/values.h" |
16 #include "components/sync/driver/protocol_event_observer.h" | 16 #include "components/sync/driver/protocol_event_observer.h" |
17 #include "components/sync/driver/sync_service_observer.h" | 17 #include "components/sync/driver/sync_service_observer.h" |
18 #include "components/sync/engine/cycle/type_debug_info_observer.h" | 18 #include "components/sync/engine/cycle/type_debug_info_observer.h" |
19 #include "components/sync/js/js_controller.h" | 19 #include "components/sync/js/js_controller.h" |
20 #include "components/sync/js/js_event_handler.h" | 20 #include "components/sync/js/js_event_handler.h" |
21 #include "content/public/browser/web_ui_message_handler.h" | 21 #include "content/public/browser/web_ui_message_handler.h" |
22 | 22 |
| 23 class SigninManagerBase; |
| 24 |
| 25 namespace browser_sync { |
23 class ProfileSyncService; | 26 class ProfileSyncService; |
24 class SigninManagerBase; | 27 } // namespace browser_sync |
25 | 28 |
26 namespace sync_driver { | 29 namespace sync_driver { |
27 class SyncService; | 30 class SyncService; |
28 } // namespace sync_driver | 31 } // namespace sync_driver |
29 | 32 |
30 // Interface to abstract away the creation of the about-sync value dictionary. | 33 // Interface to abstract away the creation of the about-sync value dictionary. |
31 class AboutSyncDataExtractor { | 34 class AboutSyncDataExtractor { |
32 public: | 35 public: |
33 // Given state about sync, extracts various interesting fields and populates | 36 // Given state about sync, extracts various interesting fields and populates |
34 // a tree of base::Value objects. | 37 // a tree of base::Value objects. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 protected: | 102 protected: |
100 // Constructor used for unit testing to override the about sync info. | 103 // Constructor used for unit testing to override the about sync info. |
101 SyncInternalsMessageHandler( | 104 SyncInternalsMessageHandler( |
102 std::unique_ptr<AboutSyncDataExtractor> about_sync_data_extractor); | 105 std::unique_ptr<AboutSyncDataExtractor> about_sync_data_extractor); |
103 | 106 |
104 private: | 107 private: |
105 // Fetches updated aboutInfo and sends it to the page in the form of an | 108 // Fetches updated aboutInfo and sends it to the page in the form of an |
106 // onAboutInfoUpdated event. | 109 // onAboutInfoUpdated event. |
107 void SendAboutInfo(); | 110 void SendAboutInfo(); |
108 | 111 |
109 ProfileSyncService* GetProfileSyncService(); | 112 browser_sync::ProfileSyncService* GetProfileSyncService(); |
110 | 113 |
111 base::WeakPtr<syncer::JsController> js_controller_; | 114 base::WeakPtr<syncer::JsController> js_controller_; |
112 | 115 |
113 // A flag used to prevent double-registration with ProfileSyncService. | 116 // A flag used to prevent double-registration with ProfileSyncService. |
114 bool is_registered_ = false; | 117 bool is_registered_ = false; |
115 | 118 |
116 // A flag used to prevent double-registration as TypeDebugInfoObserver with | 119 // A flag used to prevent double-registration as TypeDebugInfoObserver with |
117 // ProfileSyncService. | 120 // ProfileSyncService. |
118 bool is_registered_for_counters_ = false; | 121 bool is_registered_for_counters_ = false; |
119 | 122 |
120 // An abstraction of who creates the about sync info value map. | 123 // An abstraction of who creates the about sync info value map. |
121 std::unique_ptr<AboutSyncDataExtractor> about_sync_data_extractor_; | 124 std::unique_ptr<AboutSyncDataExtractor> about_sync_data_extractor_; |
122 | 125 |
123 base::WeakPtrFactory<SyncInternalsMessageHandler> weak_ptr_factory_; | 126 base::WeakPtrFactory<SyncInternalsMessageHandler> weak_ptr_factory_; |
124 | 127 |
125 DISALLOW_COPY_AND_ASSIGN(SyncInternalsMessageHandler); | 128 DISALLOW_COPY_AND_ASSIGN(SyncInternalsMessageHandler); |
126 }; | 129 }; |
127 | 130 |
128 #endif // CHROME_BROWSER_UI_WEBUI_SYNC_INTERNALS_MESSAGE_HANDLER_H_ | 131 #endif // CHROME_BROWSER_UI_WEBUI_SYNC_INTERNALS_MESSAGE_HANDLER_H_ |
OLD | NEW |