| 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_MANAGER_OBSERVER_H_ |
| 6 #define SYNC_INTERNAL_API_JS_SYNC_MANAGER_OBSERVER_H_ | 6 #define SYNC_INTERNAL_API_JS_SYNC_MANAGER_OBSERVER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.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 csync { | 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 JsSyncManagerObserver : public csync::SyncManager::Observer { | 27 class JsSyncManagerObserver : public syncer::SyncManager::Observer { |
| 28 public: | 28 public: |
| 29 JsSyncManagerObserver(); | 29 JsSyncManagerObserver(); |
| 30 virtual ~JsSyncManagerObserver(); | 30 virtual ~JsSyncManagerObserver(); |
| 31 | 31 |
| 32 void SetJsEventHandler(const WeakHandle<JsEventHandler>& event_handler); | 32 void SetJsEventHandler(const WeakHandle<JsEventHandler>& event_handler); |
| 33 | 33 |
| 34 // csync::SyncManager::Observer implementation. | 34 // syncer::SyncManager::Observer implementation. |
| 35 virtual void OnSyncCycleCompleted( | 35 virtual void OnSyncCycleCompleted( |
| 36 const sessions::SyncSessionSnapshot& snapshot) OVERRIDE; | 36 const sessions::SyncSessionSnapshot& snapshot) OVERRIDE; |
| 37 virtual void OnConnectionStatusChange( | 37 virtual void OnConnectionStatusChange( |
| 38 csync::ConnectionStatus status) OVERRIDE; | 38 syncer::ConnectionStatus status) OVERRIDE; |
| 39 virtual void OnUpdatedToken(const std::string& token) OVERRIDE; | 39 virtual void OnUpdatedToken(const std::string& token) OVERRIDE; |
| 40 virtual void OnPassphraseRequired( | 40 virtual void OnPassphraseRequired( |
| 41 csync::PassphraseRequiredReason reason, | 41 syncer::PassphraseRequiredReason reason, |
| 42 const sync_pb::EncryptedData& pending_keys) OVERRIDE; | 42 const sync_pb::EncryptedData& pending_keys) OVERRIDE; |
| 43 virtual void OnPassphraseAccepted() OVERRIDE; | 43 virtual void OnPassphraseAccepted() OVERRIDE; |
| 44 virtual void OnBootstrapTokenUpdated( | 44 virtual void OnBootstrapTokenUpdated( |
| 45 const std::string& bootstrap_token) OVERRIDE; | 45 const std::string& bootstrap_token) OVERRIDE; |
| 46 virtual void OnEncryptedTypesChanged( | 46 virtual void OnEncryptedTypesChanged( |
| 47 syncable::ModelTypeSet encrypted_types, | 47 syncable::ModelTypeSet encrypted_types, |
| 48 bool encrypt_everything) OVERRIDE; | 48 bool encrypt_everything) OVERRIDE; |
| 49 virtual void OnEncryptionComplete() OVERRIDE; | 49 virtual void OnEncryptionComplete() OVERRIDE; |
| 50 virtual void OnInitializationComplete( | 50 virtual void OnInitializationComplete( |
| 51 const WeakHandle<JsBackend>& js_backend, bool success) OVERRIDE; | 51 const WeakHandle<JsBackend>& js_backend, bool success) OVERRIDE; |
| 52 virtual void OnStopSyncingPermanently() OVERRIDE; | 52 virtual void OnStopSyncingPermanently() OVERRIDE; |
| 53 virtual void OnActionableError( | 53 virtual void OnActionableError( |
| 54 const csync::SyncProtocolError& sync_protocol_error) OVERRIDE; | 54 const syncer::SyncProtocolError& sync_protocol_error) OVERRIDE; |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 void HandleJsEvent(const tracked_objects::Location& from_here, | 57 void HandleJsEvent(const tracked_objects::Location& from_here, |
| 58 const std::string& name, const JsEventDetails& details); | 58 const std::string& name, const JsEventDetails& details); |
| 59 | 59 |
| 60 WeakHandle<JsEventHandler> event_handler_; | 60 WeakHandle<JsEventHandler> event_handler_; |
| 61 | 61 |
| 62 DISALLOW_COPY_AND_ASSIGN(JsSyncManagerObserver); | 62 DISALLOW_COPY_AND_ASSIGN(JsSyncManagerObserver); |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 } // namespace csync | 65 } // namespace syncer |
| 66 | 66 |
| 67 #endif // SYNC_INTERNAL_API_JS_SYNC_MANAGER_OBSERVER_H_ | 67 #endif // SYNC_INTERNAL_API_JS_SYNC_MANAGER_OBSERVER_H_ |
| OLD | NEW |