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

Unified Diff: sync/internal_api/sync_encryption_handler_impl.cc

Issue 10905191: [Sync] Add keystore migration conflict support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 3 months 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: sync/internal_api/sync_encryption_handler_impl.cc
diff --git a/sync/internal_api/sync_encryption_handler_impl.cc b/sync/internal_api/sync_encryption_handler_impl.cc
index f0bb6f873d32edfb32a57518ed0a9508cc47d4a3..5617df9582b0509aac86a5e5f84a8403e4307dc2 100644
--- a/sync/internal_api/sync_encryption_handler_impl.cc
+++ b/sync/internal_api/sync_encryption_handler_impl.cc
@@ -1104,6 +1104,12 @@ bool SyncEncryptionHandlerImpl::ShouldTriggerMigration(
} else if (passphrase_type_ == KEYSTORE_PASSPHRASE &&
encrypt_everything_) {
return true;
+ } else if (
+ cryptographer.is_ready() &&
+ !cryptographer.CanDecryptUsingDefaultKey(nigori.encryption_keybag())) {
+ // We need to overwrite the keybag. This might involve overwriting the
+ // keystore decryptor too.
+ return true;
} else {
return false;
}
@@ -1148,7 +1154,6 @@ bool SyncEncryptionHandlerImpl::AttemptToMigrateNigoriToKeystore(
new_encrypt_everything = true;
migrated_nigori.clear_keystore_decryptor_token();
} else {
- DCHECK_EQ(passphrase_type_, IMPLICIT_PASSPHRASE);
DCHECK(!encrypt_everything_);
new_passphrase_type = KEYSTORE_PASSPHRASE;
DVLOG(1) << "Switching to keystore passphrase state.";
« no previous file with comments | « sync/internal_api/sync_encryption_handler_impl.h ('k') | sync/internal_api/sync_encryption_handler_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698