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

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: Address comment 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 1d33be5dac79e536876d8593656d851a83f06762..fd07196cceda95f09de30f8d61742c5929e24f12 100644
--- a/chrome/browser/ui/webui/settings/people_handler.cc
+++ b/chrome/browser/ui/webui/settings/people_handler.cc
@@ -662,6 +662,28 @@ void PeopleHandler::OpenSyncSetup() {
return;
}
+ // Early exit if there is already a preferences push pending sync startup.
+ if (sync_startup_tracker_)
+ 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).
@@ -770,30 +792,9 @@ void PeopleHandler::PushSyncPrefs() {
}
#endif
- // Early exit if there is already a preferences push pending sync startup.
- if (sync_startup_tracker_)
- return;
-
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