Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6174)

Unified Diff: chrome/browser/sync/internal_api/sync_manager.cc

Issue 8759019: [Sync] Add intelligent re-encryption support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Self review Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/internal_api/sync_manager.cc
diff --git a/chrome/browser/sync/internal_api/sync_manager.cc b/chrome/browser/sync/internal_api/sync_manager.cc
index dab01337a988dfac82d7b50fb1b83e60afdf1348..fef46209c8a23f59dc035bb1b2519364bbc8a088 100644
--- a/chrome/browser/sync/internal_api/sync_manager.cc
+++ b/chrome/browser/sync/internal_api/sync_manager.cc
@@ -1066,18 +1066,19 @@ void SyncManager::SyncInternal::SetPassphrase(
return;
cryptographer->AddKey(params);
-
- // TODO(tim): Bug 58231. It would be nice if SetPassphrase didn't require
- // messing with the Nigori node, because we can't call SetPassphrase until
- // download conditions are met vs Cryptographer init. It seems like it's
- // safe to defer this work.
- sync_pb::NigoriSpecifics specifics(node.GetNigoriSpecifics());
- specifics.clear_encrypted();
- cryptographer->GetKeys(specifics.mutable_encrypted());
- specifics.set_using_explicit_passphrase(is_explicit);
- node.SetNigoriSpecifics(specifics);
}
+ // TODO(tim): Bug 58231. It would be nice if SetPassphrase didn't require
akalin 2011/12/06 18:28:02 any reason why you moved this out of the if statem
Nicolas Zea 2011/12/06 20:45:36 To ensure we always have the full set of keys, now
+ // messing with the Nigori node, because we can't call SetPassphrase until
+ // download conditions are met vs Cryptographer init. It seems like it's
+ // safe to defer this work.
+ sync_pb::NigoriSpecifics specifics(node.GetNigoriSpecifics());
+ // Does not modify specifics.encrypted() if the original decrypted data was
+ // the same.
+ cryptographer->GetKeys(specifics.mutable_encrypted());
akalin 2011/12/06 18:28:02 check return value?
Nicolas Zea 2011/12/06 20:45:36 Done.
+ specifics.set_using_explicit_passphrase(is_explicit);
+ node.SetNigoriSpecifics(specifics);
+
// Does nothing if everything is already encrypted or the cryptographer has
// pending keys.
ReEncryptEverything(&trans);
@@ -1138,8 +1139,6 @@ void SyncManager::SyncInternal::RefreshEncryption() {
ReEncryptEverything(&trans);
}
-// TODO(zea): Add unit tests that ensure no sync changes are made when not
-// needed.
void SyncManager::SyncInternal::ReEncryptEverything(WriteTransaction* trans) {
Cryptographer* cryptographer = trans->GetCryptographer();
if (!cryptographer || !cryptographer->is_ready())

Powered by Google App Engine
This is Rietveld 408576698