| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_SYNC_JS_JS_SYNC_MANAGER_OBSERVER_H_ | |
| 6 #define CHROME_BROWSER_SYNC_JS_JS_SYNC_MANAGER_OBSERVER_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/basictypes.h" | |
| 12 #include "base/compiler_specific.h" | |
| 13 #include "chrome/browser/sync/internal_api/sync_manager.h" | |
| 14 #include "chrome/browser/sync/protocol/sync_protocol_error.h" | |
| 15 #include "chrome/browser/sync/util/weak_handle.h" | |
| 16 | |
| 17 namespace tracked_objects { | |
| 18 class Location; | |
| 19 } // namespace tracked_objects | |
| 20 | |
| 21 namespace browser_sync { | |
| 22 | |
| 23 class JsEventDetails; | |
| 24 class JsEventHandler; | |
| 25 | |
| 26 // Routes SyncManager events to a JsEventHandler. | |
| 27 class JsSyncManagerObserver : public sync_api::SyncManager::Observer { | |
| 28 public: | |
| 29 JsSyncManagerObserver(); | |
| 30 virtual ~JsSyncManagerObserver(); | |
| 31 | |
| 32 void SetJsEventHandler(const WeakHandle<JsEventHandler>& event_handler); | |
| 33 | |
| 34 // sync_api::SyncManager::Observer implementation. | |
| 35 virtual void OnSyncCycleCompleted( | |
| 36 const sessions::SyncSessionSnapshot* snapshot) OVERRIDE; | |
| 37 virtual void OnConnectionStatusChange( | |
| 38 sync_api::ConnectionStatus status) OVERRIDE; | |
| 39 virtual void OnUpdatedToken(const std::string& token) OVERRIDE; | |
| 40 virtual void OnPassphraseRequired( | |
| 41 sync_api::PassphraseRequiredReason reason, | |
| 42 const sync_pb::EncryptedData& pending_keys) OVERRIDE; | |
| 43 virtual void OnPassphraseAccepted() OVERRIDE; | |
| 44 virtual void OnBootstrapTokenUpdated( | |
| 45 const std::string& bootstrap_token) OVERRIDE; | |
| 46 virtual void OnEncryptedTypesChanged( | |
| 47 syncable::ModelTypeSet encrypted_types, | |
| 48 bool encrypt_everything) OVERRIDE; | |
| 49 virtual void OnEncryptionComplete() OVERRIDE; | |
| 50 virtual void OnInitializationComplete( | |
| 51 const WeakHandle<JsBackend>& js_backend, bool success) OVERRIDE; | |
| 52 virtual void OnStopSyncingPermanently() OVERRIDE; | |
| 53 virtual void OnClearServerDataSucceeded() OVERRIDE; | |
| 54 virtual void OnClearServerDataFailed() OVERRIDE; | |
| 55 virtual void OnActionableError( | |
| 56 const browser_sync::SyncProtocolError& sync_protocol_error) OVERRIDE; | |
| 57 | |
| 58 private: | |
| 59 void HandleJsEvent(const tracked_objects::Location& from_here, | |
| 60 const std::string& name, const JsEventDetails& details); | |
| 61 | |
| 62 WeakHandle<JsEventHandler> event_handler_; | |
| 63 | |
| 64 DISALLOW_COPY_AND_ASSIGN(JsSyncManagerObserver); | |
| 65 }; | |
| 66 | |
| 67 } // namespace browser_sync | |
| 68 | |
| 69 #endif // CHROME_BROWSER_SYNC_JS_JS_SYNC_MANAGER_OBSERVER_H_ | |
| OLD | NEW |