| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 SYNC_INTERNAL_API_PUBLIC_SYNC_MANAGER_H_ | 5 #ifndef SYNC_INTERNAL_API_PUBLIC_SYNC_MANAGER_H_ |
| 6 #define SYNC_INTERNAL_API_PUBLIC_SYNC_MANAGER_H_ | 6 #define SYNC_INTERNAL_API_PUBLIC_SYNC_MANAGER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> |
| 10 #include <string> | 11 #include <string> |
| 11 #include <vector> | 12 #include <vector> |
| 12 | 13 |
| 13 #include "base/callback.h" | 14 #include "base/callback.h" |
| 14 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
| 15 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 16 #include "base/memory/scoped_ptr.h" | |
| 17 #include "base/memory/scoped_vector.h" | 17 #include "base/memory/scoped_vector.h" |
| 18 #include "base/task_runner.h" | 18 #include "base/task_runner.h" |
| 19 #include "base/threading/thread_checker.h" | 19 #include "base/threading/thread_checker.h" |
| 20 #include "google_apis/gaia/oauth2_token_service.h" | 20 #include "google_apis/gaia/oauth2_token_service.h" |
| 21 #include "sync/base/sync_export.h" | 21 #include "sync/base/sync_export.h" |
| 22 #include "sync/internal_api/public/base/invalidation_interface.h" | 22 #include "sync/internal_api/public/base/invalidation_interface.h" |
| 23 #include "sync/internal_api/public/base/model_type.h" | 23 #include "sync/internal_api/public/base/model_type.h" |
| 24 #include "sync/internal_api/public/change_record.h" | 24 #include "sync/internal_api/public/change_record.h" |
| 25 #include "sync/internal_api/public/configure_reason.h" | 25 #include "sync/internal_api/public/configure_reason.h" |
| 26 #include "sync/internal_api/public/connection_status.h" | 26 #include "sync/internal_api/public/connection_status.h" |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 // directory). | 224 // directory). |
| 225 base::FilePath database_location; | 225 base::FilePath database_location; |
| 226 | 226 |
| 227 // Used to propagate events to chrome://sync-internals. Optional. | 227 // Used to propagate events to chrome://sync-internals. Optional. |
| 228 WeakHandle<JsEventHandler> event_handler; | 228 WeakHandle<JsEventHandler> event_handler; |
| 229 | 229 |
| 230 // URL of the sync server. | 230 // URL of the sync server. |
| 231 GURL service_url; | 231 GURL service_url; |
| 232 | 232 |
| 233 // Used to communicate with the sync server. | 233 // Used to communicate with the sync server. |
| 234 scoped_ptr<HttpPostProviderFactory> post_factory; | 234 std::unique_ptr<HttpPostProviderFactory> post_factory; |
| 235 | 235 |
| 236 std::vector<scoped_refptr<ModelSafeWorker> > workers; | 236 std::vector<scoped_refptr<ModelSafeWorker> > workers; |
| 237 | 237 |
| 238 // Must outlive SyncManager. | 238 // Must outlive SyncManager. |
| 239 ExtensionsActivity* extensions_activity; | 239 ExtensionsActivity* extensions_activity; |
| 240 | 240 |
| 241 // Must outlive SyncManager. | 241 // Must outlive SyncManager. |
| 242 ChangeDelegate* change_delegate; | 242 ChangeDelegate* change_delegate; |
| 243 | 243 |
| 244 // Credentials to be used when talking to the sync server. | 244 // Credentials to be used when talking to the sync server. |
| 245 SyncCredentials credentials; | 245 SyncCredentials credentials; |
| 246 | 246 |
| 247 // Unqiuely identifies this client to the invalidation notification server. | 247 // Unqiuely identifies this client to the invalidation notification server. |
| 248 std::string invalidator_client_id; | 248 std::string invalidator_client_id; |
| 249 | 249 |
| 250 // Used to boostrap the cryptographer. | 250 // Used to boostrap the cryptographer. |
| 251 std::string restored_key_for_bootstrapping; | 251 std::string restored_key_for_bootstrapping; |
| 252 std::string restored_keystore_key_for_bootstrapping; | 252 std::string restored_keystore_key_for_bootstrapping; |
| 253 | 253 |
| 254 scoped_ptr<InternalComponentsFactory> internal_components_factory; | 254 std::unique_ptr<InternalComponentsFactory> internal_components_factory; |
| 255 | 255 |
| 256 // Must outlive SyncManager. | 256 // Must outlive SyncManager. |
| 257 Encryptor* encryptor; | 257 Encryptor* encryptor; |
| 258 | 258 |
| 259 WeakHandle<UnrecoverableErrorHandler> unrecoverable_error_handler; | 259 WeakHandle<UnrecoverableErrorHandler> unrecoverable_error_handler; |
| 260 base::Closure report_unrecoverable_error_function; | 260 base::Closure report_unrecoverable_error_function; |
| 261 | 261 |
| 262 // Carries shutdown requests across threads and will be used to cut short | 262 // Carries shutdown requests across threads and will be used to cut short |
| 263 // any network I/O and tell the syncer to exit early. | 263 // any network I/O and tell the syncer to exit early. |
| 264 // | 264 // |
| 265 // Must outlive SyncManager. | 265 // Must outlive SyncManager. |
| 266 CancelationSignal* cancelation_signal; | 266 CancelationSignal* cancelation_signal; |
| 267 | 267 |
| 268 // Optional nigori state to be restored. | 268 // Optional nigori state to be restored. |
| 269 scoped_ptr<SyncEncryptionHandler::NigoriState> saved_nigori_state; | 269 std::unique_ptr<SyncEncryptionHandler::NigoriState> saved_nigori_state; |
| 270 | 270 |
| 271 // Whether sync should clear server data when transitioning to passphrase | 271 // Whether sync should clear server data when transitioning to passphrase |
| 272 // encryption. | 272 // encryption. |
| 273 PassphraseTransitionClearDataOption clear_data_option; | 273 PassphraseTransitionClearDataOption clear_data_option; |
| 274 }; | 274 }; |
| 275 | 275 |
| 276 typedef base::Callback<void(void)> ClearServerDataCallback; | 276 typedef base::Callback<void(void)> ClearServerDataCallback; |
| 277 | 277 |
| 278 SyncManager(); | 278 SyncManager(); |
| 279 virtual ~SyncManager(); | 279 virtual ~SyncManager(); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 const ModelSafeRoutingInfo& new_routing_info, | 326 const ModelSafeRoutingInfo& new_routing_info, |
| 327 const base::Closure& ready_task, | 327 const base::Closure& ready_task, |
| 328 const base::Closure& retry_task) = 0; | 328 const base::Closure& retry_task) = 0; |
| 329 | 329 |
| 330 // Inform the syncer of a change in the invalidator's state. | 330 // Inform the syncer of a change in the invalidator's state. |
| 331 virtual void SetInvalidatorEnabled(bool invalidator_enabled) = 0; | 331 virtual void SetInvalidatorEnabled(bool invalidator_enabled) = 0; |
| 332 | 332 |
| 333 // Inform the syncer that its cached information about a type is obsolete. | 333 // Inform the syncer that its cached information about a type is obsolete. |
| 334 virtual void OnIncomingInvalidation( | 334 virtual void OnIncomingInvalidation( |
| 335 syncer::ModelType type, | 335 syncer::ModelType type, |
| 336 scoped_ptr<syncer::InvalidationInterface> invalidation) = 0; | 336 std::unique_ptr<syncer::InvalidationInterface> invalidation) = 0; |
| 337 | 337 |
| 338 // Adds a listener to be notified of sync events. | 338 // Adds a listener to be notified of sync events. |
| 339 // NOTE: It is OK (in fact, it's probably a good idea) to call this before | 339 // NOTE: It is OK (in fact, it's probably a good idea) to call this before |
| 340 // having received OnInitializationCompleted. | 340 // having received OnInitializationCompleted. |
| 341 virtual void AddObserver(Observer* observer) = 0; | 341 virtual void AddObserver(Observer* observer) = 0; |
| 342 | 342 |
| 343 // Remove the given observer. Make sure to call this if the | 343 // Remove the given observer. Make sure to call this if the |
| 344 // Observer is being destroyed so the SyncManager doesn't | 344 // Observer is being destroyed so the SyncManager doesn't |
| 345 // potentially dereference garbage. | 345 // potentially dereference garbage. |
| 346 virtual void RemoveObserver(Observer* observer) = 0; | 346 virtual void RemoveObserver(Observer* observer) = 0; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 370 // Note: opens a transaction. May be called on any thread. | 370 // Note: opens a transaction. May be called on any thread. |
| 371 virtual bool ReceivedExperiment(Experiments* experiments) = 0; | 371 virtual bool ReceivedExperiment(Experiments* experiments) = 0; |
| 372 | 372 |
| 373 // Uses a read-only transaction to determine if the directory being synced has | 373 // Uses a read-only transaction to determine if the directory being synced has |
| 374 // any remaining unsynced items. May be called on any thread. | 374 // any remaining unsynced items. May be called on any thread. |
| 375 virtual bool HasUnsyncedItems() = 0; | 375 virtual bool HasUnsyncedItems() = 0; |
| 376 | 376 |
| 377 // Returns the SyncManager's encryption handler. | 377 // Returns the SyncManager's encryption handler. |
| 378 virtual SyncEncryptionHandler* GetEncryptionHandler() = 0; | 378 virtual SyncEncryptionHandler* GetEncryptionHandler() = 0; |
| 379 | 379 |
| 380 virtual scoped_ptr<base::ListValue> GetAllNodesForType( | 380 virtual std::unique_ptr<base::ListValue> GetAllNodesForType( |
| 381 syncer::ModelType type) = 0; | 381 syncer::ModelType type) = 0; |
| 382 | 382 |
| 383 // Ask the SyncManager to fetch updates for the given types. | 383 // Ask the SyncManager to fetch updates for the given types. |
| 384 virtual void RefreshTypes(ModelTypeSet types) = 0; | 384 virtual void RefreshTypes(ModelTypeSet types) = 0; |
| 385 | 385 |
| 386 // Returns any buffered protocol events. Does not clear the buffer. | 386 // Returns any buffered protocol events. Does not clear the buffer. |
| 387 virtual ScopedVector<syncer::ProtocolEvent> GetBufferedProtocolEvents() = 0; | 387 virtual ScopedVector<syncer::ProtocolEvent> GetBufferedProtocolEvents() = 0; |
| 388 | 388 |
| 389 // Functions to manage registrations of DebugInfoObservers. | 389 // Functions to manage registrations of DebugInfoObservers. |
| 390 virtual void RegisterDirectoryTypeDebugInfoObserver( | 390 virtual void RegisterDirectoryTypeDebugInfoObserver( |
| (...skipping 16 matching lines...) Expand all Loading... |
| 407 | 407 |
| 408 // Updates Sync's tracking of whether the cookie jar has a mismatch with the | 408 // Updates Sync's tracking of whether the cookie jar has a mismatch with the |
| 409 // chrome account. See ClientConfigParams proto message for more info. | 409 // chrome account. See ClientConfigParams proto message for more info. |
| 410 // Note: this does not trigger a sync cycle. It just updates the sync context. | 410 // Note: this does not trigger a sync cycle. It just updates the sync context. |
| 411 virtual void OnCookieJarChanged(bool account_mismatch) = 0; | 411 virtual void OnCookieJarChanged(bool account_mismatch) = 0; |
| 412 }; | 412 }; |
| 413 | 413 |
| 414 } // namespace syncer | 414 } // namespace syncer |
| 415 | 415 |
| 416 #endif // SYNC_INTERNAL_API_PUBLIC_SYNC_MANAGER_H_ | 416 #endif // SYNC_INTERNAL_API_PUBLIC_SYNC_MANAGER_H_ |
| OLD | NEW |