OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h" | 5 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "chrome/browser/captive_portal/captive_portal_login_detector.h" | 8 #include "chrome/browser/captive_portal/captive_portal_login_detector.h" |
9 #include "chrome/browser/captive_portal/captive_portal_service_factory.h" | 9 #include "chrome/browser/captive_portal/captive_portal_service_factory.h" |
10 #include "chrome/browser/captive_portal/captive_portal_tab_reloader.h" | 10 #include "chrome/browser/captive_portal/captive_portal_tab_reloader.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 93 |
94 provisional_render_view_host_ = render_view_host; | 94 provisional_render_view_host_ = render_view_host; |
95 pending_error_code_ = net::OK; | 95 pending_error_code_ = net::OK; |
96 | 96 |
97 tab_reloader_->OnLoadStart(validated_url.SchemeIsSecure()); | 97 tab_reloader_->OnLoadStart(validated_url.SchemeIsSecure()); |
98 } | 98 } |
99 | 99 |
100 void CaptivePortalTabHelper::DidCommitProvisionalLoadForFrame( | 100 void CaptivePortalTabHelper::DidCommitProvisionalLoadForFrame( |
101 content::RenderFrameHost* render_frame_host, | 101 content::RenderFrameHost* render_frame_host, |
102 const GURL& url, | 102 const GURL& url, |
103 content::PageTransition transition_type) { | 103 ui::PageTransition transition_type) { |
104 DCHECK(CalledOnValidThread()); | 104 DCHECK(CalledOnValidThread()); |
105 | 105 |
106 // Ignore subframes. | 106 // Ignore subframes. |
107 if (render_frame_host->GetParent()) | 107 if (render_frame_host->GetParent()) |
108 return; | 108 return; |
109 | 109 |
110 if (provisional_render_view_host_ == render_frame_host->GetRenderViewHost()) { | 110 if (provisional_render_view_host_ == render_frame_host->GetRenderViewHost()) { |
111 tab_reloader_->OnLoadCommitted(pending_error_code_); | 111 tab_reloader_->OnLoadCommitted(pending_error_code_); |
112 } else { | 112 } else { |
113 // This may happen if the active RenderView commits a page before a cross | 113 // This may happen if the active RenderView commits a page before a cross |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 CaptivePortalTabHelper::FromWebContents(web_contents); | 253 CaptivePortalTabHelper::FromWebContents(web_contents); |
254 if (captive_portal_tab_helper->IsLoginTab()) | 254 if (captive_portal_tab_helper->IsLoginTab()) |
255 return; | 255 return; |
256 } | 256 } |
257 | 257 |
258 // Otherwise, open a login tab. Only end up here when a captive portal result | 258 // Otherwise, open a login tab. Only end up here when a captive portal result |
259 // was received, so it's safe to assume |profile_| has a CaptivePortalService. | 259 // was received, so it's safe to assume |profile_| has a CaptivePortalService. |
260 content::WebContents* web_contents = chrome::AddSelectedTabWithURL( | 260 content::WebContents* web_contents = chrome::AddSelectedTabWithURL( |
261 browser, | 261 browser, |
262 CaptivePortalServiceFactory::GetForProfile(profile_)->test_url(), | 262 CaptivePortalServiceFactory::GetForProfile(profile_)->test_url(), |
263 content::PAGE_TRANSITION_TYPED); | 263 ui::PAGE_TRANSITION_TYPED); |
264 CaptivePortalTabHelper* captive_portal_tab_helper = | 264 CaptivePortalTabHelper* captive_portal_tab_helper = |
265 CaptivePortalTabHelper::FromWebContents(web_contents); | 265 CaptivePortalTabHelper::FromWebContents(web_contents); |
266 captive_portal_tab_helper->SetIsLoginTab(); | 266 captive_portal_tab_helper->SetIsLoginTab(); |
267 } | 267 } |
OLD | NEW |