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 <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... |
38 class Encryptor; | 38 class Encryptor; |
39 struct Experiments; | 39 struct Experiments; |
40 class ExtensionsActivity; | 40 class ExtensionsActivity; |
41 class HttpPostProviderFactory; | 41 class HttpPostProviderFactory; |
42 class InternalComponentsFactory; | 42 class InternalComponentsFactory; |
43 class JsBackend; | 43 class JsBackend; |
44 class JsEventHandler; | 44 class JsEventHandler; |
45 class SyncEncryptionHandler; | 45 class SyncEncryptionHandler; |
46 class SyncScheduler; | 46 class SyncScheduler; |
47 struct UserShare; | 47 struct UserShare; |
48 class CancelationSignal; | |
49 | 48 |
50 namespace sessions { | 49 namespace sessions { |
51 class SyncSessionSnapshot; | 50 class SyncSessionSnapshot; |
52 } // namespace sessions | 51 } // namespace sessions |
53 | 52 |
54 // Used by SyncManager::OnConnectionStatusChange(). | 53 // Used by SyncManager::OnConnectionStatusChange(). |
55 enum ConnectionStatus { | 54 enum ConnectionStatus { |
56 CONNECTION_OK, | 55 CONNECTION_OK, |
57 CONNECTION_AUTH_ERROR, | 56 CONNECTION_AUTH_ERROR, |
58 CONNECTION_SERVER_ERROR | 57 CONNECTION_SERVER_ERROR |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 ExtensionsActivity* extensions_activity, | 313 ExtensionsActivity* extensions_activity, |
315 ChangeDelegate* change_delegate, | 314 ChangeDelegate* change_delegate, |
316 const SyncCredentials& credentials, | 315 const SyncCredentials& credentials, |
317 const std::string& invalidator_client_id, | 316 const std::string& invalidator_client_id, |
318 const std::string& restored_key_for_bootstrapping, | 317 const std::string& restored_key_for_bootstrapping, |
319 const std::string& restored_keystore_key_for_bootstrapping, | 318 const std::string& restored_keystore_key_for_bootstrapping, |
320 InternalComponentsFactory* internal_components_factory, | 319 InternalComponentsFactory* internal_components_factory, |
321 Encryptor* encryptor, | 320 Encryptor* encryptor, |
322 scoped_ptr<UnrecoverableErrorHandler> unrecoverable_error_handler, | 321 scoped_ptr<UnrecoverableErrorHandler> unrecoverable_error_handler, |
323 ReportUnrecoverableErrorFunction report_unrecoverable_error_function, | 322 ReportUnrecoverableErrorFunction report_unrecoverable_error_function, |
324 bool use_oauth2_token, | 323 bool use_oauth2_token) = 0; |
325 CancelationSignal* cancelation_signal) = 0; | |
326 | 324 |
327 // Throw an unrecoverable error from a transaction (mostly used for | 325 // Throw an unrecoverable error from a transaction (mostly used for |
328 // testing). | 326 // testing). |
329 virtual void ThrowUnrecoverableError() = 0; | 327 virtual void ThrowUnrecoverableError() = 0; |
330 | 328 |
331 virtual ModelTypeSet InitialSyncEndedTypes() = 0; | 329 virtual ModelTypeSet InitialSyncEndedTypes() = 0; |
332 | 330 |
333 // Returns those types within |types| that have an empty progress marker | 331 // Returns those types within |types| that have an empty progress marker |
334 // token. | 332 // token. |
335 virtual ModelTypeSet GetTypesWithEmptyProgressMarkerToken( | 333 virtual ModelTypeSet GetTypesWithEmptyProgressMarkerToken( |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 // potentially dereference garbage. | 385 // potentially dereference garbage. |
388 virtual void RemoveObserver(Observer* observer) = 0; | 386 virtual void RemoveObserver(Observer* observer) = 0; |
389 | 387 |
390 // Status-related getter. May be called on any thread. | 388 // Status-related getter. May be called on any thread. |
391 virtual SyncStatus GetDetailedStatus() const = 0; | 389 virtual SyncStatus GetDetailedStatus() const = 0; |
392 | 390 |
393 // Call periodically from a database-safe thread to persist recent changes | 391 // Call periodically from a database-safe thread to persist recent changes |
394 // to the syncapi model. | 392 // to the syncapi model. |
395 virtual void SaveChanges() = 0; | 393 virtual void SaveChanges() = 0; |
396 | 394 |
| 395 // Initiates shutdown of various components in the sync engine. Must be |
| 396 // called from the main thread to allow preempting ongoing tasks on the sync |
| 397 // loop (that may be blocked on I/O). The semantics of |callback| are the |
| 398 // same as with StartConfigurationMode. If provided and a scheduler / sync |
| 399 // loop exists, it will be invoked from the sync loop by the scheduler to |
| 400 // notify that all work has been flushed + cancelled, and it is idle. |
| 401 // If no scheduler exists, the callback is run immediately (from the loop |
| 402 // this was created on, which is the sync loop), as sync is effectively |
| 403 // stopped. |
| 404 virtual void StopSyncingForShutdown() = 0; |
| 405 |
397 // Issue a final SaveChanges, and close sqlite handles. | 406 // Issue a final SaveChanges, and close sqlite handles. |
398 virtual void ShutdownOnSyncThread() = 0; | 407 virtual void ShutdownOnSyncThread() = 0; |
399 | 408 |
400 // May be called from any thread. | 409 // May be called from any thread. |
401 virtual UserShare* GetUserShare() = 0; | 410 virtual UserShare* GetUserShare() = 0; |
402 | 411 |
403 // Returns the cache_guid of the currently open database. | 412 // Returns the cache_guid of the currently open database. |
404 // Requires that the SyncManager be initialized. | 413 // Requires that the SyncManager be initialized. |
405 virtual const std::string cache_guid() = 0; | 414 virtual const std::string cache_guid() = 0; |
406 | 415 |
407 // Reads the nigori node to determine if any experimental features should | 416 // Reads the nigori node to determine if any experimental features should |
408 // be enabled. | 417 // be enabled. |
409 // Note: opens a transaction. May be called on any thread. | 418 // Note: opens a transaction. May be called on any thread. |
410 virtual bool ReceivedExperiment(Experiments* experiments) = 0; | 419 virtual bool ReceivedExperiment(Experiments* experiments) = 0; |
411 | 420 |
412 // Uses a read-only transaction to determine if the directory being synced has | 421 // Uses a read-only transaction to determine if the directory being synced has |
413 // any remaining unsynced items. May be called on any thread. | 422 // any remaining unsynced items. May be called on any thread. |
414 virtual bool HasUnsyncedItems() = 0; | 423 virtual bool HasUnsyncedItems() = 0; |
415 | 424 |
416 // Returns the SyncManager's encryption handler. | 425 // Returns the SyncManager's encryption handler. |
417 virtual SyncEncryptionHandler* GetEncryptionHandler() = 0; | 426 virtual SyncEncryptionHandler* GetEncryptionHandler() = 0; |
418 | 427 |
419 // Ask the SyncManager to fetch updates for the given types. | 428 // Ask the SyncManager to fetch updates for the given types. |
420 virtual void RefreshTypes(ModelTypeSet types) = 0; | 429 virtual void RefreshTypes(ModelTypeSet types) = 0; |
421 }; | 430 }; |
422 | 431 |
423 } // namespace syncer | 432 } // namespace syncer |
424 | 433 |
425 #endif // SYNC_INTERNAL_API_PUBLIC_SYNC_MANAGER_H_ | 434 #endif // SYNC_INTERNAL_API_PUBLIC_SYNC_MANAGER_H_ |
OLD | NEW |