diff options
Diffstat (limited to 'chrome/browser/extensions/app_notify_channel_ui.cc')
-rw-r--r-- | chrome/browser/extensions/app_notify_channel_ui.cc | 55 |
1 files changed, 26 insertions, 29 deletions
diff --git a/chrome/browser/extensions/app_notify_channel_ui.cc b/chrome/browser/extensions/app_notify_channel_ui.cc index 3b3ff18..f4bd4b0 100644 --- a/chrome/browser/extensions/app_notify_channel_ui.cc +++ b/chrome/browser/extensions/app_notify_channel_ui.cc @@ -132,38 +132,35 @@ void AppNotifyChannelUIImpl::PromptSyncSetup( } void AppNotifyChannelUIImpl::OnInfoBarResult(bool accepted) { - if (accepted) { - StartObservingSync(); - // Bring up the login page. - LoginUIService* login_ui_service = - LoginUIServiceFactory::GetForProfile(profile_); - LoginUIService::LoginUI* login_ui = login_ui_service->current_login_ui(); - if (login_ui) { - // Some sort of login UI is already visible. - SigninManager* signin = SigninManagerFactory::GetForProfile(profile_); - if (signin->GetAuthenticatedUsername().empty()) { - // User is not logged in yet, so just bring up the login UI (could be - // the promo UI). - login_ui->FocusUI(); - return; - } else { - // User is already logged in, so close whatever sync config UI the - // user is looking at and display new login UI. - login_ui->CloseUI(); - DCHECK(!login_ui_service->current_login_ui()); - } - } - // Any existing UI is now closed - display new login UI. - Browser* browser = browser::FindLastActiveWithProfile(profile_); - if (browser) { - chrome::ShowSettingsSubPage(browser, chrome::kSyncSetupForceLoginSubPage); + if (!accepted) { + delegate_->OnSyncSetupResult(false); + return; + } + + StartObservingSync(); + // Bring up the login page. + LoginUIService* login_ui_service = + LoginUIServiceFactory::GetForProfile(profile_); + LoginUIService::LoginUI* login_ui = login_ui_service->current_login_ui(); + if (login_ui) { + // Some sort of login UI is already visible. + SigninManager* signin = SigninManagerFactory::GetForProfile(profile_); + if (signin->GetAuthenticatedUsername().empty()) { + // User is not logged in yet, so just bring up the login UI (could be + // the promo UI). + login_ui->FocusUI(); return; + } else { + // User is already logged in, so close whatever sync config UI the + // user is looking at and display new login UI. + login_ui->CloseUI(); + DCHECK(!login_ui_service->current_login_ui()); } - // Should not be possible to have no browser here, since we're in an - // infobar callback. - NOTREACHED(); } - delegate_->OnSyncSetupResult(false); + // Any existing UI is now closed - display new login UI. + Browser* browser = browser::FindBrowserWithWebContents( + tab_contents_->web_contents()); + chrome::ShowSettingsSubPage(browser, chrome::kSyncSetupForceLoginSubPage); } void AppNotifyChannelUIImpl::OnStateChanged() { |