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

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

Issue 10656033: [sync] Automatic bootstrapping of Sync on Win 8 from cached credentials (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 94cd272d18d31ed5a53149174d513a62f4d2623c..756f96274e99ba55a392a92cfa769cf2068443cc 100644
--- a/chrome/browser/sync/glue/sync_backend_host.cc
+++ b/chrome/browser/sync/glue/sync_backend_host.cc
@@ -15,14 +15,21 @@
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/location.h"
+#include "base/memory/ref_counted.h"
#include "base/metrics/histogram.h"
#include "base/threading/sequenced_worker_pool.h"
#include "base/threading/thread_restrictions.h"
#include "base/timer.h"
#include "base/tracked_objects.h"
#include "base/utf_string_conversions.h"
+#if defined(OS_WIN)
+#include "base/win/windows_version.h"
+#endif
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/token_service.h"
+#if defined(OS_WIN)
+#include "chrome/browser/sync/credential_cache_win.h"
+#endif
#include "chrome/browser/sync/glue/bridged_sync_notifier.h"
#include "chrome/browser/sync/glue/change_processor.h"
#include "chrome/browser/sync/glue/chrome_encryptor.h"
@@ -30,6 +37,7 @@
#include "chrome/browser/sync/invalidations/invalidator_storage.h"
#include "chrome/browser/sync/sync_prefs.h"
#include "chrome/common/chrome_notification_types.h"
+#include "chrome/common/chrome_paths_internal.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_version_info.h"
#include "chrome/common/net/gaia/gaia_constants.h"
@@ -1308,6 +1316,26 @@ void SyncBackendHost::PersistEncryptionBootstrapToken(
const std::string& token) {
CHECK(sync_prefs_.get());
sync_prefs_->SetEncryptionBootstrapToken(token);
+
+#if defined(OS_WIN)
+ // On Windows 8, we persist the encryption bootstrap token to a separate cache
+ // for sync credentials on Desktop (or Metro) Chrome so that when the
+ // corresponding Metro (or Desktop) Chrome is subsequently launched, we can
+ // automatically bootstrap sync for encrypted types without the user having to
+ // manually enter a sync passphrase all over again.
+ // Note: We currently do this only for the "Default" profile, because there is
+ // no 1:1 correspondence between non-default profiles on Metro and Desktop.
+ if (base::win::GetVersion() >= base::win::VERSION_WIN8 &&
+ csync::CredentialCache::IsDefaultProfileDir(profile_->GetPath())) {
+ scoped_refptr<csync::CredentialCache> credentials =
+ new csync::CredentialCache("", "", "", token, profile_->GetPath());
+ BrowserThread::PostTask(
+ BrowserThread::FILE,
+ FROM_HERE,
+ base::Bind(&csync::CredentialCache::PersistEncryptionBootstrapToken,
+ credentials));
Roger Tawa OOO till Jul 10th 2012/06/27 21:23:28 why create a csync::CredentialCache instead of jus
Raghu Simha 2012/07/19 06:57:07 We now create a CredentialCacheService using a Cre
+ }
+#endif // OS_WIN
}
void SyncBackendHost::HandleActionableErrorEventOnFrontendLoop(

Powered by Google App Engine
This is Rietveld 408576698