| 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 8dff9c7129954090f5283d9919a5d6d4c86f4887..d6065866f3e60ad7b89845cf422c37588870166e 100644
|
| --- a/chrome/browser/ui/webui/settings/people_handler.cc
|
| +++ b/chrome/browser/ui/webui/settings/people_handler.cc
|
| @@ -164,13 +164,6 @@ PeopleHandler::~PeopleHandler() {
|
| CloseSyncSetup();
|
| }
|
|
|
| -bool PeopleHandler::IsActiveLogin() const {
|
| - // LoginUIService can be nullptr if page is brought up in incognito mode
|
| - // (i.e. if the user is running in guest mode in cros and brings up settings).
|
| - LoginUIService* service = GetLoginUIService();
|
| - return service && (service->current_login_ui() == this);
|
| -}
|
| -
|
| void PeopleHandler::RegisterMessages() {
|
| web_ui()->RegisterMessageCallback(
|
| "SyncSetupDidClosePage",
|
| @@ -291,24 +284,6 @@ void PeopleHandler::DisplayGaiaLoginInNewTabOrWindow(
|
| }
|
| #endif
|
|
|
| -bool PeopleHandler::PrepareSyncSetup() {
|
| - // If the wizard is already visible, just focus that one.
|
| - if (FocusExistingWizardIfPresent()) {
|
| - if (!IsActiveLogin())
|
| - CloseSyncSetup();
|
| - return false;
|
| - }
|
| -
|
| - // Notify services that login UI is now active.
|
| - GetLoginUIService()->SetLoginUI(this);
|
| -
|
| - ProfileSyncService* service = GetSyncService();
|
| - if (service)
|
| - service->SetSetupInProgress(true);
|
| -
|
| - return true;
|
| -}
|
| -
|
| void PeopleHandler::DisplaySpinner() {
|
| configuring_sync_ = true;
|
|
|
| @@ -499,18 +474,7 @@ void PeopleHandler::HandleShowSetupUI(const base::ListValue* args) {
|
| return;
|
| }
|
|
|
| - // If a setup wizard is already present, but not on this page, close the
|
| - // blank setup overlay on this page by showing the "done" page. This can
|
| - // happen if the user navigates to chrome://settings/syncSetup in more than
|
| - // one tab. See crbug.com/261566.
|
| - // Note: The following block will transfer focus to the existing wizard.
|
| - if (IsExistingWizardPresent() && !IsActiveLogin())
|
| - CloseUI();
|
| -
|
| - // If a setup wizard is present on this page or another, bring it to focus.
|
| - // Otherwise, display a new one on this page.
|
| - if (!FocusExistingWizardIfPresent())
|
| - OpenSyncSetup(false /* creating_supervised_user */);
|
| + OpenSyncSetup(false /* creating_supervised_user */);
|
| }
|
|
|
| #if defined(OS_CHROMEOS)
|
| @@ -575,7 +539,11 @@ void PeopleHandler::CloseSyncSetup() {
|
| sync_startup_tracker_.reset();
|
|
|
| ProfileSyncService* sync_service = GetSyncService();
|
| - if (IsActiveLogin()) {
|
| +
|
| + // LoginUIService can be nullptr if page is brought up in incognito mode
|
| + // (i.e. if the user is running in guest mode in cros and brings up settings).
|
| + LoginUIService* service = GetLoginUIService();
|
| + if (service && (service->current_login_ui() == this)) {
|
| // Don't log a cancel event if the sync setup dialog is being
|
| // automatically closed due to an auth error.
|
| if (!sync_service || (!sync_service->IsFirstSetupComplete() &&
|
| @@ -621,8 +589,12 @@ void PeopleHandler::CloseSyncSetup() {
|
| }
|
|
|
| void PeopleHandler::OpenSyncSetup(bool creating_supervised_user) {
|
| - if (!PrepareSyncSetup())
|
| - return;
|
| + // Notify services that login UI is now active.
|
| + GetLoginUIService()->SetLoginUI(this);
|
| +
|
| + ProfileSyncService* service = GetSyncService();
|
| + if (service)
|
| + service->SetSetupInProgress(true);
|
|
|
| // There are several different UI flows that can bring the user here:
|
| // 1) Signin promo.
|
| @@ -651,7 +623,7 @@ void PeopleHandler::OpenSyncSetup(bool creating_supervised_user) {
|
| return;
|
| }
|
| #endif
|
| - if (!GetSyncService()) {
|
| + if (!service) {
|
| // This can happen if the user directly navigates to /settings/syncSetup.
|
| DLOG(WARNING) << "Cannot display sync UI when sync is disabled";
|
| CloseUI();
|
| @@ -662,11 +634,9 @@ void PeopleHandler::OpenSyncSetup(bool creating_supervised_user) {
|
| // via the "Advanced..." button or through One-Click signin (cases 4-6), or
|
| // they are re-enabling sync after having disabled it (case 7).
|
| PushSyncPrefs();
|
| - FocusUI();
|
| }
|
|
|
| void PeopleHandler::FocusUI() {
|
| - DCHECK(IsActiveLogin());
|
| WebContents* web_contents = web_ui()->GetWebContents();
|
| web_contents->GetDelegate()->ActivateContents(web_contents);
|
| }
|
| @@ -751,22 +721,6 @@ PeopleHandler::GetSyncStatusDictionary() {
|
| return sync_status;
|
| }
|
|
|
| -bool PeopleHandler::IsExistingWizardPresent() {
|
| - LoginUIService* service = GetLoginUIService();
|
| - DCHECK(service);
|
| - return service->current_login_ui() != nullptr;
|
| -}
|
| -
|
| -bool PeopleHandler::FocusExistingWizardIfPresent() {
|
| - if (!IsExistingWizardPresent())
|
| - return false;
|
| -
|
| - LoginUIService* service = GetLoginUIService();
|
| - DCHECK(service);
|
| - service->current_login_ui()->FocusUI();
|
| - return true;
|
| -}
|
| -
|
| void PeopleHandler::PushSyncPrefs() {
|
| #if !defined(OS_CHROMEOS)
|
| // Early exit if the user has not signed in yet.
|
|
|