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

Unified Diff: sync/internal_api/sync_manager.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: sync/internal_api/sync_manager.cc
diff --git a/sync/internal_api/sync_manager.cc b/sync/internal_api/sync_manager.cc
index 3923fe0fcb26c5c0d136514ff859ea2a00b83ea5..f3bd8211842e4645791034a87cb3143d62a6bccd 100644
--- a/sync/internal_api/sync_manager.cc
+++ b/sync/internal_api/sync_manager.cc
@@ -205,6 +205,7 @@ class SyncManager::SyncInternal
const SyncCredentials& credentials,
sync_notifier::SyncNotifier* sync_notifier,
const std::string& restored_key_for_bootstrapping,
+ const std::string& restored_keystore_key_for_bootstrapping,
bool keystore_encryption_enabled,
TestingMode testing_mode,
Encryptor* encryptor,
@@ -750,6 +751,7 @@ bool SyncManager::Init(
const SyncCredentials& credentials,
sync_notifier::SyncNotifier* sync_notifier,
const std::string& restored_key_for_bootstrapping,
+ const std::string& restored_keystore_key_for_bootstrapping,
bool keystore_encryption_enabled,
TestingMode testing_mode,
Encryptor* encryptor,
@@ -774,6 +776,7 @@ bool SyncManager::Init(
credentials,
sync_notifier,
restored_key_for_bootstrapping,
+ restored_keystore_key_for_bootstrapping,
keystore_encryption_enabled,
testing_mode,
encryptor,
@@ -846,6 +849,11 @@ bool SyncManager::IsUsingExplicitPassphrase() {
return data_ && data_->IsUsingExplicitPassphrase();
}
+bool SyncManager::GetKeystoreKeyBootstrapToken(std::string* token) {
+ ReadTransaction trans(FROM_HERE, GetUserShare());
+ return trans.GetCryptographer()->GetKeystoreKeyBootstrapToken(token);
+}
+
void SyncManager::RequestClearServerData() {
DCHECK(thread_checker_.CalledOnValidThread());
if (data_->scheduler())
@@ -911,6 +919,7 @@ bool SyncManager::SyncInternal::Init(
const SyncCredentials& credentials,
sync_notifier::SyncNotifier* sync_notifier,
const std::string& restored_key_for_bootstrapping,
+ const std::string& restored_keystore_key_for_bootstrapping,
bool keystore_encryption_enabled,
TestingMode testing_mode,
Encryptor* encryptor,
@@ -990,6 +999,8 @@ bool SyncManager::SyncInternal::Init(
// |initialized_| is set to true.
ReadTransaction trans(FROM_HERE, GetUserShare());
trans.GetCryptographer()->Bootstrap(restored_key_for_bootstrapping);
+ trans.GetCryptographer()->BootstrapKeystoreKey(
+ restored_keystore_key_for_bootstrapping);
trans.GetCryptographer()->AddObserver(this);
}

Powered by Google App Engine
This is Rietveld 408576698