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

Unified Diff: chrome/browser/sync/profile_sync_service.cc

Issue 10020028: Merge 130722 - On ChromeOS, the user is always signed in and we should not (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1084/src/
Patch Set: Created 8 years, 8 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
« no previous file with comments | « chrome/browser/sync/profile_sync_service.h ('k') | chrome/browser/sync/sync_prefs.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/profile_sync_service.cc
===================================================================
--- chrome/browser/sync/profile_sync_service.cc (revision 131686)
+++ chrome/browser/sync/profile_sync_service.cc (working copy)
@@ -33,6 +33,7 @@
#include "chrome/browser/sync/api/sync_error.h"
#include "chrome/browser/sync/backend_migrator.h"
#include "chrome/browser/sync/glue/change_processor.h"
+#include "chrome/browser/sync/glue/chrome_encryptor.h"
#include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h"
#include "chrome/browser/sync/glue/data_type_controller.h"
#include "chrome/browser/sync/glue/session_data_type_controller.h"
@@ -397,6 +398,13 @@
last_synced_time_ = sync_prefs_.GetLastSyncedTime();
+#if defined(OS_CHROMEOS)
+ std::string bootstrap_token = sync_prefs_.GetEncryptionBootstrapToken();
+ if (bootstrap_token.empty()) {
+ sync_prefs_.SetEncryptionBootstrapToken(
+ sync_prefs_.GetSpareBootstrapToken());
+ }
+#endif
CreateBackend();
// Initialize the backend. Every time we start up a new SyncBackendHost,
@@ -1074,6 +1082,23 @@
}
}
+#if defined(OS_CHROMEOS)
+void ProfileSyncService::RefreshSpareBootstrapToken(
+ const std::string& passphrase) {
+ browser_sync::ChromeEncryptor encryptor;
+ browser_sync::Cryptographer temp_cryptographer(&encryptor);
+ // The first 2 params (hostname and username) doesn't have any effect here.
+ browser_sync::KeyParams key_params = {"localhost", "dummy", passphrase};
+
+ std::string bootstrap_token;
+ if (!temp_cryptographer.AddKey(key_params)) {
+ NOTREACHED() << "Failed to add key to cryptographer.";
+ }
+ temp_cryptographer.GetBootstrapToken(&bootstrap_token);
+ sync_prefs_.SetSpareBootstrapToken(bootstrap_token);
+}
+#endif
+
void ProfileSyncService::OnUserChoseDatatypes(bool sync_everything,
syncable::ModelTypeSet chosen_types) {
if (!backend_.get() &&
@@ -1441,6 +1466,9 @@
// backend starts up.
ConsumeCachedPassphraseIfPossible();
}
+#if defined(OS_CHROMEOS)
+ RefreshSpareBootstrapToken(successful->password);
+#endif
if (!sync_initialized() ||
GetAuthError().state() != GoogleServiceAuthError::NONE) {
// Track the fact that we're still waiting for auth to complete.
« no previous file with comments | « chrome/browser/sync/profile_sync_service.h ('k') | chrome/browser/sync/sync_prefs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698