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" |
11 #include "chrome/browser/chrome_notification_types.h" | 11 #include "chrome/browser/chrome_notification_types.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
14 #include "chrome/browser/ui/browser_finder.h" | 14 #include "chrome/browser/ui/browser_finder.h" |
15 #include "chrome/browser/ui/browser_tabstrip.h" | 15 #include "chrome/browser/ui/browser_tabstrip.h" |
16 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 16 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
17 #include "content/public/browser/notification_details.h" | 17 #include "content/public/browser/notification_details.h" |
18 #include "content/public/browser/notification_service.h" | 18 #include "content/public/browser/notification_service.h" |
19 #include "content/public/browser/notification_source.h" | 19 #include "content/public/browser/notification_source.h" |
20 #include "content/public/browser/notification_types.h" | 20 #include "content/public/browser/notification_types.h" |
21 #include "content/public/browser/render_frame_host.h" | 21 #include "content/public/browser/render_frame_host.h" |
22 #include "content/public/browser/render_process_host.h" | 22 #include "content/public/browser/render_process_host.h" |
23 #include "content/public/browser/render_view_host.h" | 23 #include "content/public/browser/render_view_host.h" |
24 #include "content/public/browser/resource_request_details.h" | 24 #include "content/public/browser/resource_request_details.h" |
25 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
26 #include "net/base/net_errors.h" | 26 #include "net/base/net_errors.h" |
27 #include "net/ssl/ssl_info.h" | 27 #include "net/ssl/ssl_info.h" |
28 | 28 |
29 using captive_portal::CaptivePortalResult; | 29 using captive_portal::CaptivePortalResult; |
| 30 using content::ResourceType; |
30 | 31 |
31 DEFINE_WEB_CONTENTS_USER_DATA_KEY(CaptivePortalTabHelper); | 32 DEFINE_WEB_CONTENTS_USER_DATA_KEY(CaptivePortalTabHelper); |
32 | 33 |
33 CaptivePortalTabHelper::CaptivePortalTabHelper( | 34 CaptivePortalTabHelper::CaptivePortalTabHelper( |
34 content::WebContents* web_contents) | 35 content::WebContents* web_contents) |
35 : content::WebContentsObserver(web_contents), | 36 : content::WebContentsObserver(web_contents), |
36 // web_contents is NULL in unit tests. | 37 // web_contents is NULL in unit tests. |
37 profile_(web_contents ? Profile::FromBrowserContext( | 38 profile_(web_contents ? Profile::FromBrowserContext( |
38 web_contents->GetBrowserContext()) | 39 web_contents->GetBrowserContext()) |
39 : NULL), | 40 : NULL), |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 // 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 |
258 // 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. |
259 content::WebContents* web_contents = chrome::AddSelectedTabWithURL( | 260 content::WebContents* web_contents = chrome::AddSelectedTabWithURL( |
260 browser, | 261 browser, |
261 CaptivePortalServiceFactory::GetForProfile(profile_)->test_url(), | 262 CaptivePortalServiceFactory::GetForProfile(profile_)->test_url(), |
262 content::PAGE_TRANSITION_TYPED); | 263 content::PAGE_TRANSITION_TYPED); |
263 CaptivePortalTabHelper* captive_portal_tab_helper = | 264 CaptivePortalTabHelper* captive_portal_tab_helper = |
264 CaptivePortalTabHelper::FromWebContents(web_contents); | 265 CaptivePortalTabHelper::FromWebContents(web_contents); |
265 captive_portal_tab_helper->SetIsLoginTab(); | 266 captive_portal_tab_helper->SetIsLoginTab(); |
266 } | 267 } |
OLD | NEW |