Chromium Code Reviews| 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 2271fb05c0f205f0f699ca9c3125463a0e0479ee..ec9165217b6e421e3877723a2d140f5059fdf0d7 100644 |
| --- a/chrome/browser/sync/internal_api/sync_manager.cc |
| +++ b/chrome/browser/sync/internal_api/sync_manager.cc |
| @@ -854,7 +854,7 @@ bool SyncManager::SyncInternal::UpdateCryptographerAndNigori() { |
| // are present in the nigori node. If they're not, we write the current set of |
| // keys. |
| if (!nigori.has_encrypted() && cryptographer->is_ready()) { |
| - cryptographer->GetKeys(nigori.mutable_encrypted()); |
| + DCHECK(cryptographer->GetKeys(nigori.mutable_encrypted())); |
|
akalin
2011/12/09 23:52:42
Change to a CHECK, or rewrite as:
if (!...) {
N
Nicolas Zea
2011/12/12 20:12:26
Done.
|
| } |
| // Ensure the nigori node reflects the most recent set of sensitive types |
| @@ -1061,18 +1061,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 |
| + // 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. |
| + DCHECK(cryptographer->GetKeys(specifics.mutable_encrypted())); |
|
akalin
2011/12/09 23:52:42
here, too
Nicolas Zea
2011/12/12 20:12:26
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); |
| @@ -1133,8 +1134,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()) |