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

Unified Diff: components/browser_sync/profile_sync_service.cc

Issue 2953253002: [DICE] Enable sync for an account that is already present in the token service. (Closed)
Patch Set: Address code review Created 3 years, 5 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: components/browser_sync/profile_sync_service.cc
diff --git a/components/browser_sync/profile_sync_service.cc b/components/browser_sync/profile_sync_service.cc
index 72c18a837470aef623b750c907c6eb6887be7cb4..3cf073b6ce9c9e007fc67b4150ed4fa0369b9a08 100644
--- a/components/browser_sync/profile_sync_service.cc
+++ b/components/browser_sync/profile_sync_service.cc
@@ -37,6 +37,7 @@
#include "components/signin/core/browser/profile_oauth2_token_service.h"
#include "components/signin/core/browser/signin_manager.h"
#include "components/signin/core/browser/signin_metrics.h"
+#include "components/signin/core/common/profile_management_switches.h"
#include "components/strings/grit/components_strings.h"
#include "components/sync/base/bind_to_task_runner.h"
#include "components/sync/base/cryptographer.h"
@@ -1962,6 +1963,14 @@ void ProfileSyncService::GoogleSigninSucceededWithPassword(
// Track the fact that we're still waiting for auth to complete.
is_auth_in_progress_ = true;
}
+
+ if (switches::IsAccountConsistencyDiceEnabled() &&
+ oauth2_token_service_->RefreshTokenIsAvailable(account_id)) {
+ // When Dice is enabled, the refresh token may be available before the user
+ // enables sync. Start sync if the refresh token is already available in the
+ // token service when the authenticated account is set.
+ OnRefreshTokenAvailable(account_id);
+ }
}
void ProfileSyncService::GoogleSignedOut(const std::string& account_id,

Powered by Google App Engine
This is Rietveld 408576698