OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_ENCRYPTION_HANDLER_OBSERVER_H_ |
6 #define SYNC_INTERNAL_API_JS_SYNC_MANAGER_OBSERVER_H_ | 6 #define SYNC_INTERNAL_API_JS_SYNC_ENCRYPTION_HANDLER_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/internal_api/public/sync_manager.h" | 12 #include "sync/internal_api/public/sync_encryption_handler.h" |
13 #include "sync/internal_api/public/util/weak_handle.h" | 13 #include "sync/internal_api/public/util/weak_handle.h" |
14 #include "sync/protocol/sync_protocol_error.h" | 14 #include "sync/protocol/sync_protocol_error.h" |
15 | 15 |
16 namespace tracked_objects { | 16 namespace tracked_objects { |
17 class Location; | 17 class Location; |
18 } // namespace tracked_objects | 18 } // namespace tracked_objects |
19 | 19 |
20 namespace syncer { | 20 namespace syncer { |
21 | 21 |
22 class JsEventDetails; | 22 class JsEventDetails; |
23 class JsEventHandler; | 23 class JsEventHandler; |
24 | 24 |
25 // Routes SyncManager events to a JsEventHandler. | 25 // Routes SyncEncryptionHandler events to a JsEventHandler. |
26 class JsSyncManagerObserver : public SyncManager::Observer { | 26 class JsSyncEncryptionHandlerObserver : public SyncEncryptionHandler::Observer { |
27 public: | 27 public: |
28 JsSyncManagerObserver(); | 28 JsSyncEncryptionHandlerObserver(); |
29 virtual ~JsSyncManagerObserver(); | 29 virtual ~JsSyncEncryptionHandlerObserver(); |
30 | 30 |
31 void SetJsEventHandler(const WeakHandle<JsEventHandler>& event_handler); | 31 void SetJsEventHandler(const WeakHandle<JsEventHandler>& event_handler); |
32 | 32 |
33 // SyncManager::Observer implementation. | 33 // SyncEncryptionHandlerObserver::Observer implementation. |
34 virtual void OnSyncCycleCompleted( | |
35 const sessions::SyncSessionSnapshot& snapshot) OVERRIDE; | |
36 virtual void OnConnectionStatusChange(ConnectionStatus status) OVERRIDE; | |
37 virtual void OnUpdatedToken(const std::string& token) OVERRIDE; | |
38 virtual void OnPassphraseRequired( | 34 virtual void OnPassphraseRequired( |
39 PassphraseRequiredReason reason, | 35 PassphraseRequiredReason reason, |
40 const sync_pb::EncryptedData& pending_keys) OVERRIDE; | 36 const sync_pb::EncryptedData& pending_keys) OVERRIDE; |
41 virtual void OnPassphraseAccepted() OVERRIDE; | 37 virtual void OnPassphraseAccepted() OVERRIDE; |
42 virtual void OnBootstrapTokenUpdated( | 38 virtual void OnBootstrapTokenUpdated( |
43 const std::string& bootstrap_token) OVERRIDE; | 39 const std::string& bootstrap_token) OVERRIDE; |
44 virtual void OnEncryptedTypesChanged( | 40 virtual void OnEncryptedTypesChanged( |
45 ModelTypeSet encrypted_types, | 41 ModelTypeSet encrypted_types, |
46 bool encrypt_everything) OVERRIDE; | 42 bool encrypt_everything) OVERRIDE; |
47 virtual void OnEncryptionComplete() OVERRIDE; | 43 virtual void OnEncryptionComplete() OVERRIDE; |
48 virtual void OnInitializationComplete( | 44 virtual void OnCryptographerStateChanged( |
49 const WeakHandle<JsBackend>& js_backend, bool success, | 45 Cryptographer* cryptographer) OVERRIDE; |
50 syncer::ModelTypeSet restored_types) OVERRIDE; | |
51 virtual void OnStopSyncingPermanently() OVERRIDE; | |
52 virtual void OnActionableError( | |
53 const SyncProtocolError& sync_protocol_error) OVERRIDE; | |
54 | 46 |
55 private: | 47 private: |
56 void HandleJsEvent(const tracked_objects::Location& from_here, | 48 void HandleJsEvent(const tracked_objects::Location& from_here, |
57 const std::string& name, const JsEventDetails& details); | 49 const std::string& name, const JsEventDetails& details); |
58 | 50 |
59 WeakHandle<JsEventHandler> event_handler_; | 51 WeakHandle<JsEventHandler> event_handler_; |
60 | 52 |
61 DISALLOW_COPY_AND_ASSIGN(JsSyncManagerObserver); | 53 DISALLOW_COPY_AND_ASSIGN(JsSyncEncryptionHandlerObserver); |
62 }; | 54 }; |
63 | 55 |
64 } // namespace syncer | 56 } // namespace syncer |
65 | 57 |
66 #endif // SYNC_INTERNAL_API_JS_SYNC_MANAGER_OBSERVER_H_ | 58 #endif // SYNC_INTERNAL_API_JS_SYNC_ENCRYPTION_HANDLER_OBSERVER_H_ |
OLD | NEW |