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

Unified Diff: components/browser_sync/browser/profile_sync_service.cc

Issue 1858673002: [Sync] Inject startup dependencies into StartupController. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 4 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 | « components/browser_sync/browser/profile_sync_service.h ('k') | components/sync_driver/startup_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/browser_sync/browser/profile_sync_service.cc
diff --git a/components/browser_sync/browser/profile_sync_service.cc b/components/browser_sync/browser/profile_sync_service.cc
index 4c475cb1b2eb2baffd26665070dedc973027a366..81adc07fc78ee79fefd75390242d7aa5d8643f9b 100644
--- a/components/browser_sync/browser/profile_sync_service.cc
+++ b/components/browser_sync/browser/profile_sync_service.cc
@@ -261,7 +261,8 @@ void ProfileSyncService::Initialize() {
sync_client_->Initialize();
startup_controller_.reset(new browser_sync::StartupController(
- oauth2_token_service_, &sync_prefs_, signin_.get(),
+ &sync_prefs_,
+ base::Bind(&ProfileSyncService::CanBackendStart, base::Unretained(this)),
base::Bind(&ProfileSyncService::StartUpSlowBackendComponents,
startup_controller_weak_factory_.GetWeakPtr())));
scoped_ptr<browser_sync::LocalSessionEventRouter> router(
@@ -1534,6 +1535,12 @@ bool ProfileSyncService::IsSignedIn() const {
return !signin_->GetAccountIdToUse().empty();
}
+bool ProfileSyncService::CanBackendStart() const {
+ return CanSyncStart() && oauth2_token_service_ &&
+ oauth2_token_service_->RefreshTokenIsAvailable(
+ signin_->GetAccountIdToUse());
+}
+
bool ProfileSyncService::IsBackendInitialized() const {
return backend_initialized_;
}
« no previous file with comments | « components/browser_sync/browser/profile_sync_service.h ('k') | components/sync_driver/startup_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698