1 // Copyright (c) 2011 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_SYNC_MANAGER_OBSERVER_H_ 6 #define CHROME_BROWSER_SYNC_JS_SYNC_MANAGER_OBSERVER_H_ 7 #pragma once 8 9 #include <string> 10 11 #include "base/basictypes.h" 12 #include "chrome/browser/sync/engine/syncapi.h" 13 14 namespace browser_sync { 15 16 class JsEventRouter; 17 18 // Routes SyncManager events to a JsEventRouter. 19 class JsSyncManagerObserver : public sync_api::SyncManager::Observer { 20 public: 21 // |parent_router| must be non-NULL and must outlive this object. 22 explicit JsSyncManagerObserver(JsEventRouter* parent_router); 23 24 virtual ~JsSyncManagerObserver(); 25 26 // sync_api::SyncManager::Observer implementation. 27 virtual void OnChangesApplied( 28 syncable::ModelType model_type, 29 const sync_api::BaseTransaction* trans, 30 const sync_api::SyncManager::ChangeRecord* changes, 31 int change_count); 32 virtual void OnChangesComplete(syncable::ModelType model_type); 33 virtual void OnSyncCycleCompleted( 34 const sessions::SyncSessionSnapshot* snapshot); 35 virtual void OnAuthError(const GoogleServiceAuthError& auth_error); 36 virtual void OnUpdatedToken(const std::string& token); 37 virtual void OnPassphraseRequired(bool for_decryption); 38 virtual void OnPassphraseFailed(); 39 virtual void OnPassphraseAccepted(const std::string& bootstrap_token); 40 virtual void OnEncryptionComplete( 41 const syncable::ModelTypeSet& encrypted_types); 42 virtual void OnInitializationComplete(); 43 virtual void OnStopSyncingPermanently(); 44 virtual void OnClearServerDataSucceeded(); 45 virtual void OnClearServerDataFailed(); 46 virtual void OnMigrationNeededForTypes(const syncable::ModelTypeSet& types); 47 48 private: 49 JsEventRouter* parent_router_; 50 51 DISALLOW_COPY_AND_ASSIGN(JsSyncManagerObserver); 52 }; 53 54 } // namespace browser_sync 55 56 #endif // CHROME_BROWSER_SYNC_JS_SYNC_MANAGER_OBSERVER_H_ 57