OLD | NEW |
| (Empty) |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef COMPONENTS_SYNC_CORE_IMPL_JS_SYNC_MANAGER_OBSERVER_H_ | |
6 #define COMPONENTS_SYNC_CORE_IMPL_JS_SYNC_MANAGER_OBSERVER_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/compiler_specific.h" | |
11 #include "base/macros.h" | |
12 #include "components/sync/base/weak_handle.h" | |
13 #include "components/sync/core/sync_manager.h" | |
14 #include "components/sync/protocol/sync_protocol_error.h" | |
15 | |
16 namespace tracked_objects { | |
17 class Location; | |
18 } // namespace tracked_objects | |
19 | |
20 namespace syncer { | |
21 | |
22 class JsEventDetails; | |
23 class JsEventHandler; | |
24 | |
25 // Routes SyncManager events to a JsEventHandler. | |
26 class JsSyncManagerObserver : public SyncManager::Observer { | |
27 public: | |
28 JsSyncManagerObserver(); | |
29 ~JsSyncManagerObserver() override; | |
30 | |
31 void SetJsEventHandler(const WeakHandle<JsEventHandler>& event_handler); | |
32 | |
33 // SyncManager::Observer implementation. | |
34 void OnSyncCycleCompleted(const SyncCycleSnapshot& snapshot) override; | |
35 void OnConnectionStatusChange(ConnectionStatus status) override; | |
36 void OnInitializationComplete( | |
37 const WeakHandle<JsBackend>& js_backend, | |
38 const WeakHandle<DataTypeDebugInfoListener>& debug_info_listener, | |
39 bool success, | |
40 ModelTypeSet restored_types) override; | |
41 void OnActionableError(const SyncProtocolError& sync_protocol_error) override; | |
42 void OnProtocolEvent(const ProtocolEvent& event) override; | |
43 void OnMigrationRequested(ModelTypeSet types) override; | |
44 | |
45 private: | |
46 void HandleJsEvent(const tracked_objects::Location& from_here, | |
47 const std::string& name, | |
48 const JsEventDetails& details); | |
49 | |
50 WeakHandle<JsEventHandler> event_handler_; | |
51 | |
52 DISALLOW_COPY_AND_ASSIGN(JsSyncManagerObserver); | |
53 }; | |
54 | |
55 } // namespace syncer | |
56 | |
57 #endif // COMPONENTS_SYNC_CORE_IMPL_JS_SYNC_MANAGER_OBSERVER_H_ | |
OLD | NEW |