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_HELPER_H_ | 5 #ifndef CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_TAB_HELPER_H_ |
6 #define CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_TAB_HELPER_H_ | 6 #define CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_TAB_HELPER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 const content::NotificationSource& source, | 101 const content::NotificationSource& source, |
102 const content::NotificationDetails& details) OVERRIDE; | 102 const content::NotificationDetails& details) OVERRIDE; |
103 | 103 |
104 // Called when a certificate interstitial error page is about to be shown. | 104 // Called when a certificate interstitial error page is about to be shown. |
105 void OnSSLCertError(const net::SSLInfo& ssl_info); | 105 void OnSSLCertError(const net::SSLInfo& ssl_info); |
106 | 106 |
107 // A "Login Tab" is a tab that was originally at a captive portal login | 107 // A "Login Tab" is a tab that was originally at a captive portal login |
108 // page. This is set to false when a captive portal is no longer detected. | 108 // page. This is set to false when a captive portal is no longer detected. |
109 bool IsLoginTab() const; | 109 bool IsLoginTab() const; |
110 | 110 |
| 111 // Opens a login tab if the profile's active window doesn't have one already. |
| 112 static void OpenLoginTabForWebContents(content::WebContents* web_contents, |
| 113 bool focus); |
| 114 |
111 private: | 115 private: |
112 friend class CaptivePortalBrowserTest; | 116 friend class CaptivePortalBrowserTest; |
113 friend class CaptivePortalTabHelperTest; | 117 friend class CaptivePortalTabHelperTest; |
114 | 118 |
115 friend class content::WebContentsUserData<CaptivePortalTabHelper>; | 119 friend class content::WebContentsUserData<CaptivePortalTabHelper>; |
116 explicit CaptivePortalTabHelper(content::WebContents* web_contents); | 120 explicit CaptivePortalTabHelper(content::WebContents* web_contents); |
117 | 121 |
118 // Called by Observe in response to the corresponding event. | 122 // Called by Observe in response to the corresponding event. |
119 void OnRedirect(int child_id, | 123 void OnRedirect(int child_id, |
120 ResourceType::Type resource_type, | 124 ResourceType::Type resource_type, |
(...skipping 12 matching lines...) Expand all Loading... |
133 | 137 |
134 // |this| takes ownership of |tab_reloader|. | 138 // |this| takes ownership of |tab_reloader|. |
135 void SetTabReloaderForTest(CaptivePortalTabReloader* tab_reloader); | 139 void SetTabReloaderForTest(CaptivePortalTabReloader* tab_reloader); |
136 | 140 |
137 const content::RenderViewHost* provisional_render_view_host() const { | 141 const content::RenderViewHost* provisional_render_view_host() const { |
138 return provisional_render_view_host_; | 142 return provisional_render_view_host_; |
139 } | 143 } |
140 | 144 |
141 CaptivePortalTabReloader* GetTabReloaderForTest(); | 145 CaptivePortalTabReloader* GetTabReloaderForTest(); |
142 | 146 |
143 // Opens a login tab if the profile's active window doesn't have one already. | |
144 void OpenLoginTab(); | |
145 | |
146 Profile* profile_; | 147 Profile* profile_; |
147 | 148 |
148 // Neither of these will ever be NULL. | 149 // Neither of these will ever be NULL. |
149 scoped_ptr<CaptivePortalTabReloader> tab_reloader_; | 150 scoped_ptr<CaptivePortalTabReloader> tab_reloader_; |
150 scoped_ptr<CaptivePortalLoginDetector> login_detector_; | 151 scoped_ptr<CaptivePortalLoginDetector> login_detector_; |
151 | 152 |
152 content::WebContents* web_contents_; | 153 content::WebContents* web_contents_; |
153 | 154 |
154 // If a provisional load has failed, and the tab is loading an error page, the | 155 // If a provisional load has failed, and the tab is loading an error page, the |
155 // error code associated with the error page we're loading. | 156 // error code associated with the error page we're loading. |
156 // net::OK, otherwise. | 157 // net::OK, otherwise. |
157 int pending_error_code_; | 158 int pending_error_code_; |
158 | 159 |
159 // The RenderViewHost with a provisional load, if any. Can either be | 160 // The RenderViewHost with a provisional load, if any. Can either be |
160 // the currently displayed RenderViewHost or a pending RenderViewHost for | 161 // the currently displayed RenderViewHost or a pending RenderViewHost for |
161 // cross-process navitations. NULL when there's currently no provisional | 162 // cross-process navitations. NULL when there's currently no provisional |
162 // load. | 163 // load. |
163 content::RenderViewHost* provisional_render_view_host_; | 164 content::RenderViewHost* provisional_render_view_host_; |
164 | 165 |
165 content::NotificationRegistrar registrar_; | 166 content::NotificationRegistrar registrar_; |
166 | 167 |
167 DISALLOW_COPY_AND_ASSIGN(CaptivePortalTabHelper); | 168 DISALLOW_COPY_AND_ASSIGN(CaptivePortalTabHelper); |
168 }; | 169 }; |
169 | 170 |
170 #endif // CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_TAB_HELPER_H_ | 171 #endif // CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_TAB_HELPER_H_ |
OLD | NEW |