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

Unified Diff: chrome/browser/ui/webui/settings/people_handler.cc

Issue 2711993002: Ensure PeopleHandler only calls PSS::RequestStart in response to intention to configure sync (Closed)
Patch Set: Created 3 years, 10 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 | « no previous file | chrome/browser/ui/webui/settings/people_handler_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/settings/people_handler.cc
diff --git a/chrome/browser/ui/webui/settings/people_handler.cc b/chrome/browser/ui/webui/settings/people_handler.cc
index b86c221ec98838447933c29ca733b00dffd23c28..88429a8dcebba8f23df9516fbe4eac22edeb1b46 100644
--- a/chrome/browser/ui/webui/settings/people_handler.cc
+++ b/chrome/browser/ui/webui/settings/people_handler.cc
@@ -662,6 +662,24 @@ void PeopleHandler::OpenSyncSetup() {
return;
}
+ if (!service->IsEngineInitialized()) {
+ // Requesting the sync service to start may trigger call to PushSyncPrefs.
+ // Setting up the startup tracker beforehand correctly signals the
+ // re-entrant call to early exit.
+ sync_startup_tracker_.reset(new SyncStartupTracker(profile_, this));
+ service->RequestStart();
+
+ // See if it's even possible to bring up the sync engine - if not
+ // (unrecoverable error?), don't bother displaying a spinner that will be
+ // immediately closed because this leads to some ugly infinite UI loop (see
+ // http://crbug.com/244769).
+ if (SyncStartupTracker::GetSyncServiceState(profile_) !=
+ SyncStartupTracker::SYNC_STARTUP_ERROR) {
+ DisplaySpinner();
+ }
+ return;
+ }
+
// User is already logged in. They must have brought up the config wizard
// via the "Advanced..." button or through One-Click signin (cases 4-6), or
// they are re-enabling sync after having disabled it (case 7).
@@ -776,24 +794,7 @@ void PeopleHandler::PushSyncPrefs() {
ProfileSyncService* service = GetSyncService();
// The sync service may be nullptr if it has been just disabled by policy.
- if (!service)
- return;
-
- if (!service->IsEngineInitialized()) {
- // Requesting the sync service to start may trigger another reentrant call
- // to PushSyncPrefs. Setting up the startup tracker beforehand correctly
- // signals the re-entrant call to early exit.
- sync_startup_tracker_.reset(new SyncStartupTracker(profile_, this));
- service->RequestStart();
-
- // See if it's even possible to bring up the sync engine - if not
- // (unrecoverable error?), don't bother displaying a spinner that will be
- // immediately closed because this leads to some ugly infinite UI loop (see
- // http://crbug.com/244769).
- if (SyncStartupTracker::GetSyncServiceState(profile_) !=
- SyncStartupTracker::SYNC_STARTUP_ERROR) {
- DisplaySpinner();
- }
+ if (!service || !service->IsEngineInitialized()) {
return;
}
« no previous file with comments | « no previous file | chrome/browser/ui/webui/settings/people_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698