Chromium Code Reviews| Index: chrome/browser/ui/webui/sync_setup_handler.cc |
| diff --git a/chrome/browser/ui/webui/sync_setup_handler.cc b/chrome/browser/ui/webui/sync_setup_handler.cc |
| index 11e0aaba09db01d1f2fe1c3ce111d5103894226d..588b8078225f55e1bd7527a9be3395157b5f740c 100644 |
| --- a/chrome/browser/ui/webui/sync_setup_handler.cc |
| +++ b/chrome/browser/ui/webui/sync_setup_handler.cc |
| @@ -421,7 +421,7 @@ bool SyncSetupHandler::IsActiveLogin() const { |
| // LoginUIService can be NULL 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() == web_ui()); |
| + return service && (service->current_login_ui() == this); |
| } |
| void SyncSetupHandler::RegisterMessages() { |
| @@ -756,7 +756,10 @@ void SyncSetupHandler::HandleShowErrorUI(const ListValue* args) { |
| } |
| #endif |
| - LoginUIServiceFactory::GetForProfile(GetProfile())->ShowLoginUI(false); |
| + // Bring up the existing wizard, or just display it on this page. |
| + if (!FocusExistingWizardIfPresent()) { |
|
James Hawkins
2012/04/27 17:19:03
Optional nit: I believe the precedence in this fil
Andrew T Wilson (Slow)
2012/04/28 00:32:28
Done.
|
| + OpenSyncSetup(false); |
| + } |
| } |
| void SyncSetupHandler::HandleShowSetupUI(const ListValue* args) { |
| @@ -792,7 +795,7 @@ void SyncSetupHandler::CloseSyncSetup() { |
| } |
| // Let the various services know that we're no longer active. |
| - GetLoginUIService()->LoginUIClosed(web_ui()); |
| + GetLoginUIService()->LoginUIClosed(this); |
| if (sync_service) |
| sync_service->set_setup_in_progress(false); |
| @@ -835,7 +838,7 @@ void SyncSetupHandler::OpenSyncSetup(bool force_login) { |
| } |
| // Notify services that we are now active. |
| - GetLoginUIService()->SetLoginUI(web_ui()); |
| + GetLoginUIService()->SetLoginUI(this); |
| service->set_setup_in_progress(true); |
| // There are several different UI flows that can bring the user here: |
| @@ -887,13 +890,23 @@ void SyncSetupHandler::PrepareConfigDialog() { |
| } |
| } |
| +void SyncSetupHandler::FocusUI() { |
| + DCHECK(IsActiveLogin()); |
| + web_ui()->GetWebContents()->GetRenderViewHost()->GetDelegate()->Activate(); |
| +} |
| + |
| +void SyncSetupHandler::CloseUI() { |
| + DCHECK(IsActiveLogin()); |
| + CloseOverlay(); |
| +} |
| + |
| // Private member functions. |
| bool SyncSetupHandler::FocusExistingWizardIfPresent() { |
| LoginUIService* service = GetLoginUIService(); |
| if (!service->current_login_ui()) |
| return false; |
| - service->FocusLoginUI(); |
| + service->current_login_ui()->FocusUI(); |
| return true; |
| } |