summaryrefslogtreecommitdiffstats
path: root/sync/syncable
diff options
context:
space:
mode:
authormaniscalco <maniscalco@chromium.org>2015-06-15 17:36:44 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-16 00:37:49 +0000
commit358cabb346973315059d9afbff9d9c17c4b706f2 (patch)
tree410d746f718826d83205f6416087685887b36695 /sync/syncable
parentf9f1b3f900cf87068880ad6edae608a2abca0132 (diff)
downloadchromium_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/syncable')
-rw-r--r--sync/syncable/model_neutral_mutable_entry.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/sync/syncable/model_neutral_mutable_entry.cc b/sync/syncable/model_neutral_mutable_entry.cc
index 02cdcbb..ca05bdd 100644
--- a/sync/syncable/model_neutral_mutable_entry.cc
+++ b/sync/syncable/model_neutral_mutable_entry.cc
@@ -48,7 +48,10 @@ ModelNeutralMutableEntry::ModelNeutralMutableEntry(BaseWriteTransaction* trans,
CreateNewTypeRoot,
ModelType type)
: Entry(trans), base_write_transaction_(trans) {
- DCHECK(IsTypeWithClientGeneratedRoot(type));
+ // We allow NIGORI because we allow SyncEncryptionHandler to restore a nigori
+ // across Directory instances (see SyncEncryptionHandler::RestoreNigori).
+ if (type != NIGORI)
+ DCHECK(IsTypeWithClientGeneratedRoot(type));
Entry same_type_root(trans, GET_TYPE_ROOT, type);
kernel_ = NULL;
if (same_type_root.good()) {