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 #ifndef CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_TAB_RELOADER_H_ | 5 #ifndef CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_TAB_RELOADER_H_ |
6 #define CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_TAB_RELOADER_H_ | 6 #define CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_TAB_RELOADER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback_forward.h" | 9 #include "base/callback_forward.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "base/timer/timer.h" | 13 #include "base/timer/timer.h" |
14 #include "chrome/browser/captive_portal/captive_portal_service.h" | 14 #include "chrome/browser/captive_portal/captive_portal_service.h" |
15 | 15 |
16 class Profile; | 16 class Profile; |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 class WebContents; | 19 class WebContents; |
20 } | 20 } |
21 | 21 |
22 namespace net { | 22 namespace net { |
23 class SSLInfo; | 23 class SSLInfo; |
24 } | 24 } |
25 | 25 |
26 namespace captive_portal { | |
27 | |
28 // Keeps track of whether a tab has encountered a navigation error caused by a | 26 // Keeps track of whether a tab has encountered a navigation error caused by a |
29 // captive portal. Also triggers captive portal checks when a page load may | 27 // captive portal. Also triggers captive portal checks when a page load may |
30 // have been broken or be taking longer due to a captive portal. All methods | 28 // have been broken or be taking longer due to a captive portal. All methods |
31 // may only be called on the UI thread. | 29 // may only be called on the UI thread. |
32 // | 30 // |
33 // Only supports SSL main frames which end at error pages as a result of | 31 // Only supports SSL main frames which end at error pages as a result of |
34 // captive portals, since these make for a particularly bad user experience. | 32 // captive portals, since these make for a particularly bad user experience. |
35 // Non-SSL requests are intercepted by captive portals, which take users to the | 33 // Non-SSL requests are intercepted by captive portals, which take users to the |
36 // login page. SSL requests, however, may be silently blackholed, or result | 34 // login page. SSL requests, however, may be silently blackholed, or result |
37 // in a variety of error pages, and will continue to do so if a user tries to | 35 // in a variety of error pages, and will continue to do so if a user tries to |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 virtual void OnLoadCommitted(int net_error); | 97 virtual void OnLoadCommitted(int net_error); |
100 | 98 |
101 // This is called when the current provisional main frame load is canceled. | 99 // This is called when the current provisional main frame load is canceled. |
102 // Sets state to STATE_NONE, unless this is a login tab. | 100 // Sets state to STATE_NONE, unless this is a login tab. |
103 virtual void OnAbort(); | 101 virtual void OnAbort(); |
104 | 102 |
105 // Called whenever a provisional load to the main frame is redirected. | 103 // Called whenever a provisional load to the main frame is redirected. |
106 virtual void OnRedirect(bool is_ssl); | 104 virtual void OnRedirect(bool is_ssl); |
107 | 105 |
108 // Called whenever a captive portal test completes. | 106 // Called whenever a captive portal test completes. |
109 virtual void OnCaptivePortalResults(Result previous_result, Result result); | 107 virtual void OnCaptivePortalResults( |
| 108 captive_portal::CaptivePortalResult previous_result, |
| 109 captive_portal::CaptivePortalResult result); |
110 | 110 |
111 // Called on certificate errors, which often indicate a captive portal. | 111 // Called on certificate errors, which often indicate a captive portal. |
112 void OnSSLCertError(const net::SSLInfo& ssl_info); | 112 void OnSSLCertError(const net::SSLInfo& ssl_info); |
113 | 113 |
114 protected: | 114 protected: |
115 // The following functions are used only when testing: | 115 // The following functions are used only when testing: |
116 | 116 |
117 State state() const { return state_; } | 117 State state() const { return state_; } |
118 | 118 |
119 content::WebContents* web_contents() { return web_contents_; } | 119 content::WebContents* web_contents() { return web_contents_; } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 // portal check. | 176 // portal check. |
177 base::TimeDelta slow_ssl_load_time_; | 177 base::TimeDelta slow_ssl_load_time_; |
178 | 178 |
179 const OpenLoginTabCallback open_login_tab_callback_; | 179 const OpenLoginTabCallback open_login_tab_callback_; |
180 | 180 |
181 base::WeakPtrFactory<CaptivePortalTabReloader> weak_factory_; | 181 base::WeakPtrFactory<CaptivePortalTabReloader> weak_factory_; |
182 | 182 |
183 DISALLOW_COPY_AND_ASSIGN(CaptivePortalTabReloader); | 183 DISALLOW_COPY_AND_ASSIGN(CaptivePortalTabReloader); |
184 }; | 184 }; |
185 | 185 |
186 } // namespace captive_portal | |
187 | |
188 #endif // CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_TAB_RELOADER_H_ | 186 #endif // CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_TAB_RELOADER_H_ |
OLD | NEW |