Index: chrome/browser/sync/profile_sync_service.h |
diff --git a/chrome/browser/sync/profile_sync_service.h b/chrome/browser/sync/profile_sync_service.h |
index f86ce30cc87998856df88f550b7398e22f8636f0..10c3d34011cc69b6dca7f435ea4cf5ce18775602 100644 |
--- a/chrome/browser/sync/profile_sync_service.h |
+++ b/chrome/browser/sync/profile_sync_service.h |
@@ -14,6 +14,7 @@ |
#include "base/gtest_prod_util.h" |
#include "base/location.h" |
#include "base/memory/scoped_ptr.h" |
+#include "base/memory/ref_counted.h" |
#include "base/memory/weak_ptr.h" |
#include "base/observer_list.h" |
#include "base/string16.h" |
@@ -55,6 +56,9 @@ namespace sessions { class SyncSessionSnapshot; } |
namespace csync { |
class BaseTransaction; |
+#if defined(OS_WIN) |
+class CredentialCache; |
+#endif |
struct SyncCredentials; |
struct UserShare; |
} |
@@ -605,6 +609,27 @@ class ProfileSyncService : public browser_sync::SyncFrontend, |
// Called from Initialize() and UnsuppressAndStart(). |
void TryStart(); |
+#if defined(OS_WIN) |
+ // Returns true if the user is not signed in to sync, but cached credentials |
+ // are available for bootstrapping sync. Returns false otherwise. |
+ // Used on Windows 8 by Metro / Desktop Chrome, to prevent the user from |
+ // having to sign in twice with the same account. |
+ bool ShouldSigninUsingCachedCredentials(); |
+ |
+ // Attempts to load cached sync credentials from the alternate Windows 8 |
+ // profile in order to automatically bootstrap sync. For example, if PSS is |
+ // starting up for the first time on Desktop, and the user has already signed |
+ // in to sync on Metro, we look for the presence of cached credentials from |
+ // the corresponding profile directory on Metro. Must be called only when |
+ // ShouldSigninUsingCachedCredentials returns true. |
+ void TryLoadingCachedCredentials(); |
+ |
+ // Automatically bootstraps sync using cached credentials that were |
+ // successfully loaded from the alternate profile directory on Windows 8. |
+ void OnLoadedCachedCredentials( |
+ scoped_refptr<csync::CredentialCache> credentials); |
+#endif |
+ |
// Puts the backend's sync scheduler into NORMAL mode. |
// Called when configuration is complete. |
void StartSyncingWithServer(); |
@@ -784,6 +809,10 @@ class ProfileSyncService : public browser_sync::SyncFrontend, |
// data types. |
bool setup_in_progress_; |
+ // If true, we are bootstrapping sync using cached credentials. Happens only |
+ // on Windows 8 to avoid having to sign in manually on both Metro and Desktop. |
+ bool setting_up_with_cached_credentials_; |
+ |
// The set of currently enabled sync experiments. |
csync::Experiments current_experiments; |