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

Unified Diff: chrome/browser/sync/glue/sync_backend_host.cc

Issue 10540149: [Sync] Persist keystore key across restarts (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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: chrome/browser/sync/glue/sync_backend_host.cc
diff --git a/chrome/browser/sync/glue/sync_backend_host.cc b/chrome/browser/sync/glue/sync_backend_host.cc
index e92d73ecb8b721d93cafa84163f1e69d7f9d05f3..4b28fd5697462fcacc3140a270f757c5fedf7467 100644
--- a/chrome/browser/sync/glue/sync_backend_host.cc
+++ b/chrome/browser/sync/glue/sync_backend_host.cc
@@ -378,6 +378,7 @@ void SyncBackendHost::Initialize(
&sync_notifier_factory_,
delete_sync_data_folder,
sync_prefs_->GetEncryptionBootstrapToken(),
+ sync_prefs_->GetKeystoreEncryptionBootstrapToken(),
sync_api::SyncManager::NON_TEST,
unrecoverable_error_handler,
report_unrecoverable_error_function));
@@ -720,6 +721,7 @@ void SyncBackendHost::RequestConfigureSyncer(
}
void SyncBackendHost::FinishConfigureDataTypesOnFrontendLoop(
+ const std::string& keystore_bootstrap_token,
rlarocque 2012/06/13 23:35:04 Is it really necessary to send the token back on e
Nicolas Zea 2012/06/15 00:42:07 Yeah, I guess the bootstrap token doesn't really r
rlarocque 2012/06/15 19:02:00 I'm not sure that's much better. Wouldn't it make
Nicolas Zea 2012/06/15 20:15:30 This is effectively the same logic used in the boo
const syncable::ModelTypeSet& types_to_configure,
const syncable::ModelTypeSet& configured_types,
const base::Callback<void(syncable::ModelTypeSet)>& ready_task) {
@@ -742,6 +744,11 @@ void SyncBackendHost::FinishConfigureDataTypesOnFrontendLoop(
base::Bind(&SyncBackendHost::Core::DoUpdateEnabledTypes, core_.get(),
configured_types));
+ if (!keystore_bootstrap_token.empty()) {
+ DVLOG(1) << "Persisting keystore encryption bootstrap token.";
+ sync_prefs_->SetKeystoreEncryptionBootstrapToken(keystore_bootstrap_token);
+ }
+
if (!ready_task.is_null())
ready_task.Run(failed_configuration_types);
}
@@ -760,6 +767,7 @@ SyncBackendHost::DoInitializeOptions::DoInitializeOptions(
sync_notifier::SyncNotifierFactory* sync_notifier_factory,
bool delete_sync_data_folder,
const std::string& restored_key_for_bootstrapping,
+ const std::string& restored_keystore_key_for_bootstrapping,
sync_api::SyncManager::TestingMode testing_mode,
UnrecoverableErrorHandler* unrecoverable_error_handler,
ReportUnrecoverableErrorFunction report_unrecoverable_error_function)
@@ -776,6 +784,8 @@ SyncBackendHost::DoInitializeOptions::DoInitializeOptions(
sync_notifier_factory(sync_notifier_factory),
delete_sync_data_folder(delete_sync_data_folder),
restored_key_for_bootstrapping(restored_key_for_bootstrapping),
+ restored_keystore_key_for_bootstrapping(
+ restored_keystore_key_for_bootstrapping),
testing_mode(testing_mode),
unrecoverable_error_handler(unrecoverable_error_handler),
report_unrecoverable_error_function(
@@ -1010,6 +1020,7 @@ void SyncBackendHost::Core::DoInitialize(const DoInitializeOptions& options) {
options.chrome_sync_notification_bridge,
options.sync_notifier_factory->CreateSyncNotifier()),
options.restored_key_for_bootstrapping,
+ options.restored_keystore_key_for_bootstrapping,
CommandLine::ForCurrentProcess()->HasSwitch(
switches::kSyncKeystoreEncryption),
options.testing_mode,
@@ -1131,8 +1142,13 @@ void SyncBackendHost::Core::DoFinishConfigureDataTypes(
syncable::ModelTypeSet configured_types =
sync_manager_->InitialSyncEndedTypes();
configured_types.RetainAll(types_to_config);
+
+ std::string keystore_token;
+ sync_manager_->GetKeystoreKeyBootstrapToken(&keystore_token);
+
host_.Call(FROM_HERE,
&SyncBackendHost::FinishConfigureDataTypesOnFrontendLoop,
+ keystore_token,
types_to_config,
configured_types,
ready_task);

Powered by Google App Engine
This is Rietveld 408576698