OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 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 | 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 SYNC_INTERNAL_API_JS_SYNC_MANAGER_OBSERVER_H_ | 5 #ifndef SYNC_INTERNAL_API_JS_SYNC_MANAGER_OBSERVER_H_ |
6 #define SYNC_INTERNAL_API_JS_SYNC_MANAGER_OBSERVER_H_ | 6 #define SYNC_INTERNAL_API_JS_SYNC_MANAGER_OBSERVER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "sync/base/sync_export.h" | 12 #include "sync/base/sync_export.h" |
13 #include "sync/internal_api/public/sync_manager.h" | 13 #include "sync/internal_api/public/sync_manager.h" |
14 #include "sync/internal_api/public/util/weak_handle.h" | 14 #include "sync/internal_api/public/util/weak_handle.h" |
15 #include "sync/protocol/sync_protocol_error.h" | 15 #include "sync/protocol/sync_protocol_error.h" |
16 | 16 |
17 namespace tracked_objects { | 17 namespace tracked_objects { |
18 class Location; | 18 class Location; |
19 } // namespace tracked_objects | 19 } // namespace tracked_objects |
20 | 20 |
21 namespace syncer { | 21 namespace syncer { |
22 | 22 |
23 class JsEventDetails; | 23 class JsEventDetails; |
24 class JsEventHandler; | 24 class JsEventHandler; |
25 | 25 |
26 // Routes SyncManager events to a JsEventHandler. | 26 // Routes SyncManager events to a JsEventHandler. |
27 class SYNC_EXPORT_PRIVATE JsSyncManagerObserver : public SyncManager::Observer { | 27 class SYNC_EXPORT_PRIVATE JsSyncManagerObserver : public SyncManager::Observer { |
28 public: | 28 public: |
29 JsSyncManagerObserver(); | 29 JsSyncManagerObserver(); |
30 virtual ~JsSyncManagerObserver(); | 30 ~JsSyncManagerObserver() override; |
31 | 31 |
32 void SetJsEventHandler(const WeakHandle<JsEventHandler>& event_handler); | 32 void SetJsEventHandler(const WeakHandle<JsEventHandler>& event_handler); |
33 | 33 |
34 // SyncManager::Observer implementation. | 34 // SyncManager::Observer implementation. |
35 virtual void OnSyncCycleCompleted( | 35 void OnSyncCycleCompleted( |
36 const sessions::SyncSessionSnapshot& snapshot) override; | 36 const sessions::SyncSessionSnapshot& snapshot) override; |
37 virtual void OnConnectionStatusChange(ConnectionStatus status) override; | 37 void OnConnectionStatusChange(ConnectionStatus status) override; |
38 virtual void OnInitializationComplete( | 38 void OnInitializationComplete( |
39 const WeakHandle<JsBackend>& js_backend, | 39 const WeakHandle<JsBackend>& js_backend, |
40 const WeakHandle<DataTypeDebugInfoListener>& debug_info_listener, | 40 const WeakHandle<DataTypeDebugInfoListener>& debug_info_listener, |
41 bool success, | 41 bool success, |
42 syncer::ModelTypeSet restored_types) override; | 42 syncer::ModelTypeSet restored_types) override; |
43 virtual void OnActionableError( | 43 void OnActionableError(const SyncProtocolError& sync_protocol_error) override; |
44 const SyncProtocolError& sync_protocol_error) override; | 44 void OnProtocolEvent(const ProtocolEvent& event) override; |
45 virtual void OnProtocolEvent(const ProtocolEvent& event) override; | 45 void OnMigrationRequested(syncer::ModelTypeSet types) override; |
46 virtual void OnMigrationRequested( | |
47 syncer::ModelTypeSet types) override; | |
48 | 46 |
49 private: | 47 private: |
50 void HandleJsEvent(const tracked_objects::Location& from_here, | 48 void HandleJsEvent(const tracked_objects::Location& from_here, |
51 const std::string& name, const JsEventDetails& details); | 49 const std::string& name, const JsEventDetails& details); |
52 | 50 |
53 WeakHandle<JsEventHandler> event_handler_; | 51 WeakHandle<JsEventHandler> event_handler_; |
54 | 52 |
55 DISALLOW_COPY_AND_ASSIGN(JsSyncManagerObserver); | 53 DISALLOW_COPY_AND_ASSIGN(JsSyncManagerObserver); |
56 }; | 54 }; |
57 | 55 |
58 } // namespace syncer | 56 } // namespace syncer |
59 | 57 |
60 #endif // SYNC_INTERNAL_API_JS_SYNC_MANAGER_OBSERVER_H_ | 58 #endif // SYNC_INTERNAL_API_JS_SYNC_MANAGER_OBSERVER_H_ |
OLD | NEW |