| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 CHROME_BROWSER_SYNC_JS_JS_SYNC_MANAGER_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_SYNC_JS_JS_SYNC_MANAGER_OBSERVER_H_ |
| 6 #define CHROME_BROWSER_SYNC_JS_JS_SYNC_MANAGER_OBSERVER_H_ | 6 #define CHROME_BROWSER_SYNC_JS_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 "chrome/browser/sync/internal_api/sync_manager.h" | 13 #include "chrome/browser/sync/internal_api/sync_manager.h" |
| 14 #include "chrome/browser/sync/protocol/sync_protocol_error.h" | 14 #include "chrome/browser/sync/protocol/sync_protocol_error.h" |
| 15 #include "chrome/browser/sync/util/weak_handle.h" | 15 #include "chrome/browser/sync/util/weak_handle.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 browser_sync { | 21 namespace browser_sync { |
| 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 | 27 class JsSyncManagerObserver : public sync_api::SyncManager::Observer { |
| 28 : public sync_api::SyncManager::ChangeObserver, | |
| 29 public sync_api::SyncManager::Observer { | |
| 30 public: | 28 public: |
| 31 JsSyncManagerObserver(); | 29 JsSyncManagerObserver(); |
| 32 virtual ~JsSyncManagerObserver(); | 30 virtual ~JsSyncManagerObserver(); |
| 33 | 31 |
| 34 void SetJsEventHandler(const WeakHandle<JsEventHandler>& event_handler); | 32 void SetJsEventHandler(const WeakHandle<JsEventHandler>& event_handler); |
| 35 | 33 |
| 36 // sync_api::SyncManager::ChangeObserver implementation. | |
| 37 virtual void OnChangesApplied( | |
| 38 syncable::ModelType model_type, | |
| 39 int64 write_transaction_id, | |
| 40 const sync_api::ImmutableChangeRecordList& changes) OVERRIDE; | |
| 41 virtual void OnChangesComplete(syncable::ModelType model_type) OVERRIDE; | |
| 42 | |
| 43 // sync_api::SyncManager::Observer implementation. | 34 // sync_api::SyncManager::Observer implementation. |
| 44 virtual void OnSyncCycleCompleted( | 35 virtual void OnSyncCycleCompleted( |
| 45 const sessions::SyncSessionSnapshot* snapshot) OVERRIDE; | 36 const sessions::SyncSessionSnapshot* snapshot) OVERRIDE; |
| 46 virtual void OnAuthError(const GoogleServiceAuthError& auth_error) OVERRIDE; | 37 virtual void OnAuthError(const GoogleServiceAuthError& auth_error) OVERRIDE; |
| 47 virtual void OnUpdatedToken(const std::string& token) OVERRIDE; | 38 virtual void OnUpdatedToken(const std::string& token) OVERRIDE; |
| 48 virtual void OnPassphraseRequired( | 39 virtual void OnPassphraseRequired( |
| 49 sync_api::PassphraseRequiredReason reason) OVERRIDE; | 40 sync_api::PassphraseRequiredReason reason) OVERRIDE; |
| 50 virtual void OnPassphraseAccepted( | 41 virtual void OnPassphraseAccepted( |
| 51 const std::string& bootstrap_token) OVERRIDE; | 42 const std::string& bootstrap_token) OVERRIDE; |
| 52 virtual void OnEncryptionComplete( | 43 virtual void OnEncryptionComplete( |
| (...skipping 11 matching lines...) Expand all Loading... |
| 64 const std::string& name, const JsEventDetails& details); | 55 const std::string& name, const JsEventDetails& details); |
| 65 | 56 |
| 66 WeakHandle<JsEventHandler> event_handler_; | 57 WeakHandle<JsEventHandler> event_handler_; |
| 67 | 58 |
| 68 DISALLOW_COPY_AND_ASSIGN(JsSyncManagerObserver); | 59 DISALLOW_COPY_AND_ASSIGN(JsSyncManagerObserver); |
| 69 }; | 60 }; |
| 70 | 61 |
| 71 } // namespace browser_sync | 62 } // namespace browser_sync |
| 72 | 63 |
| 73 #endif // CHROME_BROWSER_SYNC_JS_JS_SYNC_MANAGER_OBSERVER_H_ | 64 #endif // CHROME_BROWSER_SYNC_JS_JS_SYNC_MANAGER_OBSERVER_H_ |
| OLD | NEW |