summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-28 23:39:14 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-28 23:39:14 +0000
commitfa76d13877821cbc6fb2714915ab7f5fa8fc00b8 (patch)
treea0db141e0a221fb57065483098d02112c8bc6f6a
parent4cec2534e7b72beae06b75b19ee60e01e0bca2de (diff)
downloadchromium_src-fa76d13877821cbc6fb2714915ab7f5fa8fc00b8.zip
chromium_src-fa76d13877821cbc6fb2714915ab7f5fa8fc00b8.tar.gz
chromium_src-fa76d13877821cbc6fb2714915ab7f5fa8fc00b8.tar.bz2
Get rid of browser::FindLastActiveWithProfile call in AppNotifyChannelUIImpl. Since we already have the TabContents, it's easy to get to its browser.
BUG=129187 Review URL: https://chromiumcodereview.appspot.com/10698033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144836 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/extensions/app_notify_channel_ui.cc55
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() {