Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Side by Side Diff: ios/chrome/browser/ui/webui/sync_internals/sync_internals_message_handler.h

Issue 2388673002: Revert of [Sync] Move //components/sync to the syncer namespace. (patchset #5 id:40001 of https://co (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 IOS_CHROME_BROWSER_UI_WEBUI_SYNC_INTERNALS_SYNC_INTERNALS_MESSAGE_HANDLE R_H_ 5 #ifndef IOS_CHROME_BROWSER_UI_WEBUI_SYNC_INTERNALS_SYNC_INTERNALS_MESSAGE_HANDLE R_H_
6 #define IOS_CHROME_BROWSER_UI_WEBUI_SYNC_INTERNALS_SYNC_INTERNALS_MESSAGE_HANDLE R_H_ 6 #define IOS_CHROME_BROWSER_UI_WEBUI_SYNC_INTERNALS_SYNC_INTERNALS_MESSAGE_HANDLE R_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "components/sync/driver/protocol_event_observer.h" 13 #include "components/sync/driver/protocol_event_observer.h"
14 #include "components/sync/driver/sync_service_observer.h" 14 #include "components/sync/driver/sync_service_observer.h"
15 #include "components/sync/engine/cycle/type_debug_info_observer.h" 15 #include "components/sync/engine/cycle/type_debug_info_observer.h"
16 #include "components/sync/js/js_controller.h" 16 #include "components/sync/js/js_controller.h"
17 #include "components/sync/js/js_event_handler.h" 17 #include "components/sync/js/js_event_handler.h"
18 #include "ios/web/public/webui/web_ui_ios_message_handler.h" 18 #include "ios/web/public/webui/web_ui_ios_message_handler.h"
19 19
20 namespace syncer { 20 namespace sync_driver {
21 class SyncService; 21 class SyncService;
22 } // namespace syncer 22 }
23 23
24 // The implementation for the chrome://sync-internals page. 24 // The implementation for the chrome://sync-internals page.
25 class SyncInternalsMessageHandler : public web::WebUIIOSMessageHandler, 25 class SyncInternalsMessageHandler : public web::WebUIIOSMessageHandler,
26 public syncer::JsEventHandler, 26 public syncer::JsEventHandler,
27 public syncer::SyncServiceObserver, 27 public sync_driver::SyncServiceObserver,
28 public syncer::ProtocolEventObserver, 28 public browser_sync::ProtocolEventObserver,
29 public syncer::TypeDebugInfoObserver { 29 public syncer::TypeDebugInfoObserver {
30 public: 30 public:
31 SyncInternalsMessageHandler(); 31 SyncInternalsMessageHandler();
32 ~SyncInternalsMessageHandler() override; 32 ~SyncInternalsMessageHandler() override;
33 33
34 void RegisterMessages() override; 34 void RegisterMessages() override;
35 35
36 // Sets up observers to receive events and forward them to the UI. 36 // Sets up observers to receive events and forward them to the UI.
37 void HandleRegisterForEvents(const base::ListValue* args); 37 void HandleRegisterForEvents(const base::ListValue* args);
38 38
(...skipping 10 matching lines...) Expand all
49 void HandleGetAllNodes(const base::ListValue* args); 49 void HandleGetAllNodes(const base::ListValue* args);
50 50
51 // syncer::JsEventHandler implementation. 51 // syncer::JsEventHandler implementation.
52 void HandleJsEvent(const std::string& name, 52 void HandleJsEvent(const std::string& name,
53 const syncer::JsEventDetails& details) override; 53 const syncer::JsEventDetails& details) override;
54 54
55 // Callback used in GetAllNodes. 55 // Callback used in GetAllNodes.
56 void OnReceivedAllNodes(int request_id, 56 void OnReceivedAllNodes(int request_id,
57 std::unique_ptr<base::ListValue> nodes); 57 std::unique_ptr<base::ListValue> nodes);
58 58
59 // syncer::SyncServiceObserver implementation. 59 // sync_driver::SyncServiceObserver implementation.
60 void OnStateChanged() override; 60 void OnStateChanged() override;
61 61
62 // ProtocolEventObserver implementation. 62 // ProtocolEventObserver implementation.
63 void OnProtocolEvent(const syncer::ProtocolEvent& e) override; 63 void OnProtocolEvent(const syncer::ProtocolEvent& e) override;
64 64
65 // TypeDebugInfoObserver implementation. 65 // TypeDebugInfoObserver implementation.
66 void OnCommitCountersUpdated(syncer::ModelType type, 66 void OnCommitCountersUpdated(syncer::ModelType type,
67 const syncer::CommitCounters& counters) override; 67 const syncer::CommitCounters& counters) override;
68 void OnUpdateCountersUpdated(syncer::ModelType type, 68 void OnUpdateCountersUpdated(syncer::ModelType type,
69 const syncer::UpdateCounters& counters) override; 69 const syncer::UpdateCounters& counters) override;
70 void OnStatusCountersUpdated(syncer::ModelType type, 70 void OnStatusCountersUpdated(syncer::ModelType type,
71 const syncer::StatusCounters& counters) override; 71 const syncer::StatusCounters& counters) override;
72 72
73 // Helper to emit counter updates. 73 // Helper to emit counter updates.
74 // 74 //
75 // Used in implementation of On*CounterUpdated methods. Emits the given 75 // Used in implementation of On*CounterUpdated methods. Emits the given
76 // dictionary value with additional data to specify the model type and 76 // dictionary value with additional data to specify the model type and
77 // counter type. 77 // counter type.
78 void EmitCounterUpdate(syncer::ModelType type, 78 void EmitCounterUpdate(syncer::ModelType type,
79 const std::string& counter_type, 79 const std::string& counter_type,
80 std::unique_ptr<base::DictionaryValue> value); 80 std::unique_ptr<base::DictionaryValue> value);
81 81
82 private: 82 private:
83 // Fetches updated aboutInfo and sends it to the page in the form of an 83 // Fetches updated aboutInfo and sends it to the page in the form of an
84 // onAboutInfoUpdated event. 84 // onAboutInfoUpdated event.
85 void SendAboutInfo(); 85 void SendAboutInfo();
86 86
87 syncer::SyncService* GetSyncService(); 87 sync_driver::SyncService* GetSyncService();
88 88
89 base::WeakPtr<syncer::JsController> js_controller_; 89 base::WeakPtr<syncer::JsController> js_controller_;
90 90
91 // A flag used to prevent double-registration with ProfileSyncService. 91 // A flag used to prevent double-registration with ProfileSyncService.
92 bool is_registered_; 92 bool is_registered_;
93 93
94 // A flag used to prevent double-registration as TypeDebugInfoObserver with 94 // A flag used to prevent double-registration as TypeDebugInfoObserver with
95 // ProfileSyncService. 95 // ProfileSyncService.
96 bool is_registered_for_counters_; 96 bool is_registered_for_counters_;
97 97
98 base::WeakPtrFactory<SyncInternalsMessageHandler> weak_ptr_factory_; 98 base::WeakPtrFactory<SyncInternalsMessageHandler> weak_ptr_factory_;
99 99
100 DISALLOW_COPY_AND_ASSIGN(SyncInternalsMessageHandler); 100 DISALLOW_COPY_AND_ASSIGN(SyncInternalsMessageHandler);
101 }; 101 };
102 102
103 #endif // IOS_CHROME_BROWSER_UI_WEBUI_SYNC_INTERNALS_SYNC_INTERNALS_MESSAGE_HAN DLER_H_ 103 #endif // IOS_CHROME_BROWSER_UI_WEBUI_SYNC_INTERNALS_SYNC_INTERNALS_MESSAGE_HAN DLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698