| OLD | NEW |
| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 void HandleRequestListOfTypes(const base::ListValue* args); | 45 void HandleRequestListOfTypes(const base::ListValue* args); |
| 46 | 46 |
| 47 // Handler for getAllNodes message. Needs a |request_id| argument. | 47 // Handler for getAllNodes message. Needs a |request_id| argument. |
| 48 void HandleGetAllNodes(const base::ListValue* args); | 48 void HandleGetAllNodes(const base::ListValue* args); |
| 49 | 49 |
| 50 // syncer::JsEventHandler implementation. | 50 // syncer::JsEventHandler implementation. |
| 51 void HandleJsEvent(const std::string& name, | 51 void HandleJsEvent(const std::string& name, |
| 52 const syncer::JsEventDetails& details) override; | 52 const syncer::JsEventDetails& details) override; |
| 53 | 53 |
| 54 // Callback used in GetAllNodes. | 54 // Callback used in GetAllNodes. |
| 55 void OnReceivedAllNodes(int request_id, scoped_ptr<base::ListValue> nodes); | 55 void OnReceivedAllNodes(int request_id, |
| 56 std::unique_ptr<base::ListValue> nodes); |
| 56 | 57 |
| 57 // sync_driver::SyncServiceObserver implementation. | 58 // sync_driver::SyncServiceObserver implementation. |
| 58 void OnStateChanged() override; | 59 void OnStateChanged() override; |
| 59 | 60 |
| 60 // ProtocolEventObserver implementation. | 61 // ProtocolEventObserver implementation. |
| 61 void OnProtocolEvent(const syncer::ProtocolEvent& e) override; | 62 void OnProtocolEvent(const syncer::ProtocolEvent& e) override; |
| 62 | 63 |
| 63 // TypeDebugInfoObserver implementation. | 64 // TypeDebugInfoObserver implementation. |
| 64 void OnCommitCountersUpdated(syncer::ModelType type, | 65 void OnCommitCountersUpdated(syncer::ModelType type, |
| 65 const syncer::CommitCounters& counters) override; | 66 const syncer::CommitCounters& counters) override; |
| 66 void OnUpdateCountersUpdated(syncer::ModelType type, | 67 void OnUpdateCountersUpdated(syncer::ModelType type, |
| 67 const syncer::UpdateCounters& counters) override; | 68 const syncer::UpdateCounters& counters) override; |
| 68 void OnStatusCountersUpdated(syncer::ModelType type, | 69 void OnStatusCountersUpdated(syncer::ModelType type, |
| 69 const syncer::StatusCounters& counters) override; | 70 const syncer::StatusCounters& counters) override; |
| 70 | 71 |
| 71 // Helper to emit counter updates. | 72 // Helper to emit counter updates. |
| 72 // | 73 // |
| 73 // Used in implementation of On*CounterUpdated methods. Emits the given | 74 // Used in implementation of On*CounterUpdated methods. Emits the given |
| 74 // dictionary value with additional data to specify the model type and | 75 // dictionary value with additional data to specify the model type and |
| 75 // counter type. | 76 // counter type. |
| 76 void EmitCounterUpdate(syncer::ModelType type, | 77 void EmitCounterUpdate(syncer::ModelType type, |
| 77 const std::string& counter_type, | 78 const std::string& counter_type, |
| 78 scoped_ptr<base::DictionaryValue> value); | 79 std::unique_ptr<base::DictionaryValue> value); |
| 79 | 80 |
| 80 private: | 81 private: |
| 81 // Fetches updated aboutInfo and sends it to the page in the form of an | 82 // Fetches updated aboutInfo and sends it to the page in the form of an |
| 82 // onAboutInfoUpdated event. | 83 // onAboutInfoUpdated event. |
| 83 void SendAboutInfo(); | 84 void SendAboutInfo(); |
| 84 | 85 |
| 85 sync_driver::SyncService* GetSyncService(); | 86 sync_driver::SyncService* GetSyncService(); |
| 86 | 87 |
| 87 base::WeakPtr<syncer::JsController> js_controller_; | 88 base::WeakPtr<syncer::JsController> js_controller_; |
| 88 | 89 |
| 89 // A flag used to prevent double-registration with ProfileSyncService. | 90 // A flag used to prevent double-registration with ProfileSyncService. |
| 90 bool is_registered_; | 91 bool is_registered_; |
| 91 | 92 |
| 92 // A flag used to prevent double-registration as TypeDebugInfoObserver with | 93 // A flag used to prevent double-registration as TypeDebugInfoObserver with |
| 93 // ProfileSyncService. | 94 // ProfileSyncService. |
| 94 bool is_registered_for_counters_; | 95 bool is_registered_for_counters_; |
| 95 | 96 |
| 96 base::WeakPtrFactory<SyncInternalsMessageHandler> weak_ptr_factory_; | 97 base::WeakPtrFactory<SyncInternalsMessageHandler> weak_ptr_factory_; |
| 97 | 98 |
| 98 DISALLOW_COPY_AND_ASSIGN(SyncInternalsMessageHandler); | 99 DISALLOW_COPY_AND_ASSIGN(SyncInternalsMessageHandler); |
| 99 }; | 100 }; |
| 100 | 101 |
| 101 #endif // IOS_CHROME_BROWSER_UI_WEBUI_SYNC_INTERNALS_SYNC_INTERNALS_MESSAGE_HAN
DLER_H_ | 102 #endif // IOS_CHROME_BROWSER_UI_WEBUI_SYNC_INTERNALS_SYNC_INTERNALS_MESSAGE_HAN
DLER_H_ |
| OLD | NEW |