OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_GLUE_SYNC_BACKEND_HOST_CORE_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_CORE_H_ |
6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_CORE_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_CORE_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 | 9 |
10 #include "base/timer/timer.h" | 10 #include "base/timer/timer.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 public syncer::TypeDebugInfoObserver { | 83 public syncer::TypeDebugInfoObserver { |
84 public: | 84 public: |
85 SyncBackendHostCore(const std::string& name, | 85 SyncBackendHostCore(const std::string& name, |
86 const base::FilePath& sync_data_folder_path, | 86 const base::FilePath& sync_data_folder_path, |
87 bool has_sync_setup_completed, | 87 bool has_sync_setup_completed, |
88 const base::WeakPtr<SyncBackendHostImpl>& backend); | 88 const base::WeakPtr<SyncBackendHostImpl>& backend); |
89 | 89 |
90 // SyncManager::Observer implementation. The Core just acts like an air | 90 // SyncManager::Observer implementation. The Core just acts like an air |
91 // traffic controller here, forwarding incoming messages to appropriate | 91 // traffic controller here, forwarding incoming messages to appropriate |
92 // landing threads. | 92 // landing threads. |
93 virtual void OnSyncCycleCompleted( | 93 void OnSyncCycleCompleted( |
94 const syncer::sessions::SyncSessionSnapshot& snapshot) override; | 94 const syncer::sessions::SyncSessionSnapshot& snapshot) override; |
95 virtual void OnInitializationComplete( | 95 void OnInitializationComplete( |
96 const syncer::WeakHandle<syncer::JsBackend>& js_backend, | 96 const syncer::WeakHandle<syncer::JsBackend>& js_backend, |
97 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& | 97 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& |
98 debug_info_listener, | 98 debug_info_listener, |
99 bool success, | 99 bool success, |
100 syncer::ModelTypeSet restored_types) override; | 100 syncer::ModelTypeSet restored_types) override; |
101 virtual void OnConnectionStatusChange( | 101 void OnConnectionStatusChange(syncer::ConnectionStatus status) override; |
102 syncer::ConnectionStatus status) override; | 102 void OnActionableError(const syncer::SyncProtocolError& sync_error) override; |
103 virtual void OnActionableError( | 103 void OnMigrationRequested(syncer::ModelTypeSet types) override; |
104 const syncer::SyncProtocolError& sync_error) override; | 104 void OnProtocolEvent(const syncer::ProtocolEvent& event) override; |
105 virtual void OnMigrationRequested(syncer::ModelTypeSet types) override; | |
106 virtual void OnProtocolEvent(const syncer::ProtocolEvent& event) override; | |
107 | 105 |
108 // SyncEncryptionHandler::Observer implementation. | 106 // SyncEncryptionHandler::Observer implementation. |
109 virtual void OnPassphraseRequired( | 107 void OnPassphraseRequired( |
110 syncer::PassphraseRequiredReason reason, | 108 syncer::PassphraseRequiredReason reason, |
111 const sync_pb::EncryptedData& pending_keys) override; | 109 const sync_pb::EncryptedData& pending_keys) override; |
112 virtual void OnPassphraseAccepted() override; | 110 void OnPassphraseAccepted() override; |
113 virtual void OnBootstrapTokenUpdated( | 111 void OnBootstrapTokenUpdated(const std::string& bootstrap_token, |
114 const std::string& bootstrap_token, | 112 syncer::BootstrapTokenType type) override; |
115 syncer::BootstrapTokenType type) override; | 113 void OnEncryptedTypesChanged(syncer::ModelTypeSet encrypted_types, |
116 virtual void OnEncryptedTypesChanged( | 114 bool encrypt_everything) override; |
117 syncer::ModelTypeSet encrypted_types, | 115 void OnEncryptionComplete() override; |
118 bool encrypt_everything) override; | 116 void OnCryptographerStateChanged( |
119 virtual void OnEncryptionComplete() override; | |
120 virtual void OnCryptographerStateChanged( | |
121 syncer::Cryptographer* cryptographer) override; | 117 syncer::Cryptographer* cryptographer) override; |
122 virtual void OnPassphraseTypeChanged(syncer::PassphraseType type, | 118 void OnPassphraseTypeChanged(syncer::PassphraseType type, |
123 base::Time passphrase_time) override; | 119 base::Time passphrase_time) override; |
124 | 120 |
125 // TypeDebugInfoObserver implementation | 121 // TypeDebugInfoObserver implementation |
126 virtual void OnCommitCountersUpdated( | 122 void OnCommitCountersUpdated(syncer::ModelType type, |
127 syncer::ModelType type, | 123 const syncer::CommitCounters& counters) override; |
128 const syncer::CommitCounters& counters) override; | 124 void OnUpdateCountersUpdated(syncer::ModelType type, |
129 virtual void OnUpdateCountersUpdated( | 125 const syncer::UpdateCounters& counters) override; |
130 syncer::ModelType type, | 126 void OnStatusCountersUpdated(syncer::ModelType type, |
131 const syncer::UpdateCounters& counters) override; | 127 const syncer::StatusCounters& counters) override; |
132 virtual void OnStatusCountersUpdated( | |
133 syncer::ModelType type, | |
134 const syncer::StatusCounters& counters) override; | |
135 | 128 |
136 // Forwards an invalidation state change to the sync manager. | 129 // Forwards an invalidation state change to the sync manager. |
137 void DoOnInvalidatorStateChange(syncer::InvalidatorState state); | 130 void DoOnInvalidatorStateChange(syncer::InvalidatorState state); |
138 | 131 |
139 // Forwards an invalidation to the sync manager. | 132 // Forwards an invalidation to the sync manager. |
140 void DoOnIncomingInvalidation( | 133 void DoOnIncomingInvalidation( |
141 const syncer::ObjectIdInvalidationMap& invalidation_map); | 134 const syncer::ObjectIdInvalidationMap& invalidation_map); |
142 | 135 |
143 // Note: | 136 // Note: |
144 // | 137 // |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 | 234 |
242 // Tell the sync manager to persist its state by writing to disk. | 235 // Tell the sync manager to persist its state by writing to disk. |
243 // Called on the sync thread, both by a timer and, on Android, when the | 236 // Called on the sync thread, both by a timer and, on Android, when the |
244 // application is backgrounded. | 237 // application is backgrounded. |
245 void SaveChanges(); | 238 void SaveChanges(); |
246 | 239 |
247 private: | 240 private: |
248 friend class base::RefCountedThreadSafe<SyncBackendHostCore>; | 241 friend class base::RefCountedThreadSafe<SyncBackendHostCore>; |
249 friend class SyncBackendHostForProfileSyncTest; | 242 friend class SyncBackendHostForProfileSyncTest; |
250 | 243 |
251 virtual ~SyncBackendHostCore(); | 244 ~SyncBackendHostCore() override; |
252 | 245 |
253 // Invoked when initialization of syncapi is complete and we can start | 246 // Invoked when initialization of syncapi is complete and we can start |
254 // our timer. | 247 // our timer. |
255 // This must be called from the thread on which SaveChanges is intended to | 248 // This must be called from the thread on which SaveChanges is intended to |
256 // be run on; the host's |registrar_->sync_thread()|. | 249 // be run on; the host's |registrar_->sync_thread()|. |
257 void StartSavingChanges(); | 250 void StartSavingChanges(); |
258 | 251 |
259 // Name used for debugging. | 252 // Name used for debugging. |
260 const std::string name_; | 253 const std::string name_; |
261 | 254 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 bool forward_type_info_; | 300 bool forward_type_info_; |
308 | 301 |
309 base::WeakPtrFactory<SyncBackendHostCore> weak_ptr_factory_; | 302 base::WeakPtrFactory<SyncBackendHostCore> weak_ptr_factory_; |
310 | 303 |
311 DISALLOW_COPY_AND_ASSIGN(SyncBackendHostCore); | 304 DISALLOW_COPY_AND_ASSIGN(SyncBackendHostCore); |
312 }; | 305 }; |
313 | 306 |
314 } // namespace browser_sync | 307 } // namespace browser_sync |
315 | 308 |
316 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_CORE_H_ | 309 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_CORE_H_ |
OLD | NEW |