Index: chrome/browser/captive_portal/captive_portal_tab_helper.cc |
diff --git a/chrome/browser/captive_portal/captive_portal_tab_helper.cc b/chrome/browser/captive_portal/captive_portal_tab_helper.cc |
index d939bdaec5a99cb906a6acea4c9fc02fa199e557..ec45f4b59ff2d743be3a7ce9405ba903266dd33b 100644 |
--- a/chrome/browser/captive_portal/captive_portal_tab_helper.cc |
+++ b/chrome/browser/captive_portal/captive_portal_tab_helper.cc |
@@ -41,7 +41,7 @@ CaptivePortalTabHelper::CaptivePortalTabHelper( |
profile_, |
web_contents, |
base::Bind(&CaptivePortalTabHelper::OpenLoginTab, |
- base::Unretained(this)))), |
+ base::Unretained(this), false))), |
login_detector_(new CaptivePortalLoginDetector(profile_)), |
web_contents_(web_contents), |
pending_error_code_(net::OK), |
@@ -239,7 +239,7 @@ CaptivePortalTabReloader* CaptivePortalTabHelper::GetTabReloaderForTest() { |
return tab_reloader_.get(); |
} |
-void CaptivePortalTabHelper::OpenLoginTab() { |
+void CaptivePortalTabHelper::OpenLoginTab(bool focus) { |
Browser* browser = chrome::FindBrowserWithWebContents(web_contents_); |
// If the Profile doesn't have a tabbed browser window open, do nothing. |
@@ -255,8 +255,11 @@ void CaptivePortalTabHelper::OpenLoginTab() { |
browser->tab_strip_model()->GetWebContentsAt(i); |
CaptivePortalTabHelper* captive_portal_tab_helper = |
CaptivePortalTabHelper::FromWebContents(web_contents); |
- if (captive_portal_tab_helper->IsLoginTab()) |
+ if (captive_portal_tab_helper->IsLoginTab()) { |
+ if (focus) |
+ browser->tab_strip_model()->ActivateTabAt(i, false); |
return; |
+ } |
} |
// Otherwise, open a login tab. Only end up here when a captive portal result |
@@ -268,4 +271,8 @@ void CaptivePortalTabHelper::OpenLoginTab() { |
CaptivePortalTabHelper* captive_portal_tab_helper = |
CaptivePortalTabHelper::FromWebContents(web_contents); |
captive_portal_tab_helper->SetIsLoginTab(); |
+ if (focus) { |
+ int index = browser->tab_strip_model()->GetIndexOfWebContents(web_contents); |
+ browser->tab_strip_model()->ActivateTabAt(index, false); |
+ } |
mmenke
2014/06/17 19:17:03
I don't believe this is needed - "AddSelectedTabWi
meacer
2014/06/18 21:23:08
Correct.
|
} |