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_INTERNAL_API_SYNC_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_SYNC_INTERNAL_API_SYNC_MANAGER_H_ |
6 #define CHROME_BROWSER_SYNC_INTERNAL_API_SYNC_MANAGER_H_ | 6 #define CHROME_BROWSER_SYNC_INTERNAL_API_SYNC_MANAGER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 // be disabled and state cleaned up at once. This can happen for a number | 369 // be disabled and state cleaned up at once. This can happen for a number |
370 // of reasons, e.g. swapping from a test instance to production, or a | 370 // of reasons, e.g. swapping from a test instance to production, or a |
371 // global stop syncing operation has wiped the store. | 371 // global stop syncing operation has wiped the store. |
372 virtual void OnStopSyncingPermanently() = 0; | 372 virtual void OnStopSyncingPermanently() = 0; |
373 | 373 |
374 // After a request to clear server data, these callbacks are invoked to | 374 // After a request to clear server data, these callbacks are invoked to |
375 // indicate success or failure. | 375 // indicate success or failure. |
376 virtual void OnClearServerDataSucceeded() = 0; | 376 virtual void OnClearServerDataSucceeded() = 0; |
377 virtual void OnClearServerDataFailed() = 0; | 377 virtual void OnClearServerDataFailed() = 0; |
378 | 378 |
| 379 // Called when the set of encrypted types changes. Called from |
| 380 // within a transaction. |
| 381 virtual void OnEncryptedTypesChanged( |
| 382 const syncable::ModelTypeSet& encrypted_types, |
| 383 bool encrypt_everything) = 0; |
| 384 |
379 // Called after we finish encrypting all appropriate datatypes. | 385 // Called after we finish encrypting all appropriate datatypes. |
380 virtual void OnEncryptionComplete( | 386 // Always preceded by a call to OnEncryptedTypesChanged with the |
381 const syncable::ModelTypeSet& encrypted_types) = 0; | 387 // latest set of encrypted types. Called from within a |
| 388 // transaction. |
| 389 virtual void OnEncryptionComplete() = 0; |
382 | 390 |
383 virtual void OnActionableError( | 391 virtual void OnActionableError( |
384 const browser_sync::SyncProtocolError& sync_protocol_error) = 0; | 392 const browser_sync::SyncProtocolError& sync_protocol_error) = 0; |
385 | 393 |
386 protected: | 394 protected: |
387 virtual ~Observer(); | 395 virtual ~Observer(); |
388 }; | 396 }; |
389 | 397 |
390 // Create an uninitialized SyncManager. Callers must Init() before using. | 398 // Create an uninitialized SyncManager. Callers must Init() before using. |
391 explicit SyncManager(const std::string& name); | 399 explicit SyncManager(const std::string& name); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 // Note: opens a transaction and can trigger ON_PASSPHRASE_REQUIRED, so must | 536 // Note: opens a transaction and can trigger ON_PASSPHRASE_REQUIRED, so must |
529 // only be called after syncapi has been initialized. | 537 // only be called after syncapi has been initialized. |
530 void RefreshEncryption(); | 538 void RefreshEncryption(); |
531 | 539 |
532 // Enable encryption of all sync data. Once enabled, it can never be disabled | 540 // Enable encryption of all sync data. Once enabled, it can never be disabled |
533 // without clearing the server data. | 541 // without clearing the server data. |
534 void EnableEncryptEverything(); | 542 void EnableEncryptEverything(); |
535 | 543 |
536 // Returns true if we are currently encrypting all sync data. May | 544 // Returns true if we are currently encrypting all sync data. May |
537 // be called on any thread. | 545 // be called on any thread. |
538 bool EncryptEverythingEnabled() const; | 546 bool EncryptEverythingEnabledForTest() const; |
539 | 547 |
540 // Gets the set of encrypted types from the cryptographer | 548 // Gets the set of encrypted types from the cryptographer |
541 // Note: opens a transaction. May be called from any thread. | 549 // Note: opens a transaction. May be called from any thread. |
542 syncable::ModelTypeSet GetEncryptedDataTypes() const; | 550 syncable::ModelTypeSet GetEncryptedDataTypesForTest() const; |
543 | 551 |
544 // Reads the nigori node to determine if any experimental types should be | 552 // Reads the nigori node to determine if any experimental types should be |
545 // enabled. | 553 // enabled. |
546 // Note: opens a transaction. May be called on any thread. | 554 // Note: opens a transaction. May be called on any thread. |
547 bool ReceivedExperimentalTypes(syncable::ModelTypeSet* to_add) const; | 555 bool ReceivedExperimentalTypes(syncable::ModelTypeSet* to_add) const; |
548 | 556 |
549 // Uses a read-only transaction to determine if the directory being synced has | 557 // Uses a read-only transaction to determine if the directory being synced has |
550 // any remaining unsynced items. May be called on any thread. | 558 // any remaining unsynced items. May be called on any thread. |
551 bool HasUnsyncedItems() const; | 559 bool HasUnsyncedItems() const; |
552 | 560 |
(...skipping 15 matching lines...) Expand all Loading... |
568 }; | 576 }; |
569 | 577 |
570 bool InitialSyncEndedForTypes(syncable::ModelTypeSet types, UserShare* share); | 578 bool InitialSyncEndedForTypes(syncable::ModelTypeSet types, UserShare* share); |
571 | 579 |
572 // Returns the string representation of a PassphraseRequiredReason value. | 580 // Returns the string representation of a PassphraseRequiredReason value. |
573 std::string PassphraseRequiredReasonToString(PassphraseRequiredReason reason); | 581 std::string PassphraseRequiredReasonToString(PassphraseRequiredReason reason); |
574 | 582 |
575 } // namespace sync_api | 583 } // namespace sync_api |
576 | 584 |
577 #endif // CHROME_BROWSER_SYNC_INTERNAL_API_SYNC_MANAGER_H_ | 585 #endif // CHROME_BROWSER_SYNC_INTERNAL_API_SYNC_MANAGER_H_ |
OLD | NEW |