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 5617df9582b0509aac86a5e5f84a8403e4307dc2..a1cab7ed6dc1efce2b695e8df898105fbfbb6ed9 100644 |
--- a/sync/internal_api/sync_encryption_handler_impl.cc |
+++ b/sync/internal_api/sync_encryption_handler_impl.cc |
@@ -588,6 +588,13 @@ bool SyncEncryptionHandlerImpl::MigratedToKeystore() { |
return IsNigoriMigratedToKeystore(nigori_node.GetNigoriSpecifics()); |
} |
+base::Time SyncEncryptionHandlerImpl::GetKeystoreMigrationTime() const { |
+ if (migration_time_ms_ != 0) |
+ return ProtoTimeToTime(migration_time_ms_); |
+ else |
+ return base::Time(); |
+} |
+ |
// This function iterates over all encrypted types. There are many scenarios in |
// which data for some or all types is not currently available. In that case, |
// the lookup of the root node will fail and we will skip encryption for that |
@@ -1136,10 +1143,7 @@ bool SyncEncryptionHandlerImpl::AttemptToMigrateNigoriToKeystore( |
return false; |
DVLOG(1) << "Starting nigori migration to keystore support."; |
- if (migration_time_ms_ == 0) |
- migration_time_ms_ = TimeToProtoTime(base::Time::Now()); |
sync_pb::NigoriSpecifics migrated_nigori(old_nigori); |
- migrated_nigori.set_keystore_migration_time(migration_time_ms_); |
PassphraseType new_passphrase_type = passphrase_type_; |
bool new_encrypt_everything = encrypt_everything_; |
@@ -1183,13 +1187,23 @@ bool SyncEncryptionHandlerImpl::AttemptToMigrateNigoriToKeystore( |
return false; |
} |
+ if (migration_time_ms_ == 0) |
+ migration_time_ms_ = TimeToProtoTime(base::Time::Now()); |
+ migrated_nigori.set_keystore_migration_time(migration_time_ms_); |
+ |
DVLOG(1) << "Completing nigori migration to keystore support."; |
nigori_node->SetNigoriSpecifics(migrated_nigori); |
+ |
+ FOR_EACH_OBSERVER( |
+ SyncEncryptionHandler::Observer, |
+ observers_, |
+ OnCryptographerStateChanged(cryptographer)); |
if (passphrase_type_ != new_passphrase_type) { |
passphrase_type_ = new_passphrase_type; |
FOR_EACH_OBSERVER(SyncEncryptionHandler::Observer, observers_, |
OnPassphraseTypeChanged(passphrase_type_)); |
} |
+ |
if (new_encrypt_everything && !encrypt_everything_) { |
EnableEncryptEverythingImpl(trans->GetWrappedTrans()); |
ReEncryptEverything(trans); |