Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3772)

Unified Diff: chrome/browser/captive_portal/captive_portal_tab_helper.cc

Issue 318213002: Add custom interstitial for captive portals. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix build Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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.
}

Powered by Google App Engine
This is Rietveld 408576698