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 : public sync_api::SyncManager::Observer { | 27 class JsSyncManagerObserver |
| 28 : public sync_api::SyncManager::ChangeObserver, |
| 29 public sync_api::SyncManager::Observer { |
28 public: | 30 public: |
29 JsSyncManagerObserver(); | 31 JsSyncManagerObserver(); |
30 virtual ~JsSyncManagerObserver(); | 32 virtual ~JsSyncManagerObserver(); |
31 | 33 |
32 void SetJsEventHandler(const WeakHandle<JsEventHandler>& event_handler); | 34 void SetJsEventHandler(const WeakHandle<JsEventHandler>& event_handler); |
33 | 35 |
34 // sync_api::SyncManager::Observer implementation. | 36 // sync_api::SyncManager::ChangeObserver implementation. |
35 virtual void OnChangesApplied( | 37 virtual void OnChangesApplied( |
36 syncable::ModelType model_type, | 38 syncable::ModelType model_type, |
37 const sync_api::BaseTransaction* trans, | 39 int64 write_transaction_id, |
38 const sync_api::ImmutableChangeRecordList& changes) OVERRIDE; | 40 const sync_api::ImmutableChangeRecordList& changes) OVERRIDE; |
39 virtual void OnChangesComplete(syncable::ModelType model_type) OVERRIDE; | 41 virtual void OnChangesComplete(syncable::ModelType model_type) OVERRIDE; |
| 42 |
| 43 // sync_api::SyncManager::Observer implementation. |
40 virtual void OnSyncCycleCompleted( | 44 virtual void OnSyncCycleCompleted( |
41 const sessions::SyncSessionSnapshot* snapshot) OVERRIDE; | 45 const sessions::SyncSessionSnapshot* snapshot) OVERRIDE; |
42 virtual void OnAuthError(const GoogleServiceAuthError& auth_error) OVERRIDE; | 46 virtual void OnAuthError(const GoogleServiceAuthError& auth_error) OVERRIDE; |
43 virtual void OnUpdatedToken(const std::string& token) OVERRIDE; | 47 virtual void OnUpdatedToken(const std::string& token) OVERRIDE; |
44 virtual void OnPassphraseRequired( | 48 virtual void OnPassphraseRequired( |
45 sync_api::PassphraseRequiredReason reason) OVERRIDE; | 49 sync_api::PassphraseRequiredReason reason) OVERRIDE; |
46 virtual void OnPassphraseAccepted( | 50 virtual void OnPassphraseAccepted( |
47 const std::string& bootstrap_token) OVERRIDE; | 51 const std::string& bootstrap_token) OVERRIDE; |
48 virtual void OnEncryptionComplete( | 52 virtual void OnEncryptionComplete( |
49 const syncable::ModelTypeSet& encrypted_types) OVERRIDE; | 53 const syncable::ModelTypeSet& encrypted_types) OVERRIDE; |
(...skipping 10 matching lines...) Expand all Loading... |
60 const std::string& name, const JsEventDetails& details); | 64 const std::string& name, const JsEventDetails& details); |
61 | 65 |
62 WeakHandle<JsEventHandler> event_handler_; | 66 WeakHandle<JsEventHandler> event_handler_; |
63 | 67 |
64 DISALLOW_COPY_AND_ASSIGN(JsSyncManagerObserver); | 68 DISALLOW_COPY_AND_ASSIGN(JsSyncManagerObserver); |
65 }; | 69 }; |
66 | 70 |
67 } // namespace browser_sync | 71 } // namespace browser_sync |
68 | 72 |
69 #endif // CHROME_BROWSER_SYNC_JS_JS_SYNC_MANAGER_OBSERVER_H_ | 73 #endif // CHROME_BROWSER_SYNC_JS_JS_SYNC_MANAGER_OBSERVER_H_ |
OLD | NEW |