diff options
author | maniscalco <maniscalco@chromium.org> | 2015-06-15 17:36:44 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-16 00:37:49 +0000 |
commit | 358cabb346973315059d9afbff9d9c17c4b706f2 (patch) | |
tree | 410d746f718826d83205f6416087685887b36695 /sync/internal_api/sync_encryption_handler_impl.h | |
parent | f9f1b3f900cf87068880ad6edae608a2abca0132 (diff) | |
download | chromium_src-358cabb346973315059d9afbff9d9c17c4b706f2.zip chromium_src-358cabb346973315059d9afbff9d9c17c4b706f2.tar.gz chromium_src-358cabb346973315059d9afbff9d9c17c4b706f2.tar.bz2 |
[Sync] Add ability to save/restore Nigori to SyncEncryptionHandlerImpl
SyncEncryptionHandlerImpl now detects when a user enables passphrase
encryption locally and notifies observers with the updated Nigori
state. An observer can then use this state to restore a future instance
of SyncEncryptionHandler. The ability to save/restore Nigori across
Directory instances is a prerequisite for issuing a lightweight
"dashboard stop and clear" when a user enables passphrase encryption.
Add OnLocalSetCustomPassphrase to SyncEncryptionHandler interface.
Plumb OnLocalSetCustomPassphrase events from SyncEncryptionHandlerImpl
on the sync thread to ProfileSyncService on the UI thread.
Loosen a restriction on ModelNeutralMutableEntry's capabilities.
BUG=490836
Review URL: https://codereview.chromium.org/1177853002
Cr-Commit-Position: refs/heads/master@{#334513}
Diffstat (limited to 'sync/internal_api/sync_encryption_handler_impl.h')
-rw-r--r-- | sync/internal_api/sync_encryption_handler_impl.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/sync/internal_api/sync_encryption_handler_impl.h b/sync/internal_api/sync_encryption_handler_impl.h index 79f43f2..4e466f1 100644 --- a/sync/internal_api/sync_encryption_handler_impl.h +++ b/sync/internal_api/sync_encryption_handler_impl.h @@ -88,6 +88,11 @@ class SYNC_EXPORT_PRIVATE SyncEncryptionHandlerImpl base::Time migration_time() const; base::Time custom_passphrase_time() const; + // Restore a saved nigori obtained from OnLocalSetPassphraseEncryption. + // + // Writes the nigori to the Directory and updates the Cryptographer. + void RestoreNigori(const SyncEncryptionHandler::NigoriState& nigori_state); + private: friend class SyncEncryptionHandlerImplTest; FRIEND_TEST_ALL_PREFIXES(SyncEncryptionHandlerImplTest, @@ -139,7 +144,10 @@ class SYNC_EXPORT_PRIVATE SyncEncryptionHandlerImpl // Iterate over all encrypted types ensuring each entry is properly encrypted. void ReEncryptEverything(WriteTransaction* trans); - // Apply a nigori update. Updates internal and cryptographer state. + // Updates internal and cryptographer state. + // + // Assumes |nigori| is already present in the Sync Directory. + // // Returns true on success, false if |nigori| was incompatible, and the // nigori node must be corrected. // Note: must be called from within a transaction. @@ -261,6 +269,9 @@ class SYNC_EXPORT_PRIVATE SyncEncryptionHandlerImpl // (if known). Else return base::Time(). base::Time GetExplicitPassphraseTime() const; + // Notify observers when a custom passphrase is set by this device. + void NotifyObserversOfLocalCustomPassphrase(WriteTransaction* trans); + base::ThreadChecker thread_checker_; base::ObserverList<SyncEncryptionHandler::Observer> observers_; |