| 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 void OpenLoginTab(bool focus); |
| 113 |
| 111 private: | 114 private: |
| 112 friend class CaptivePortalBrowserTest; | 115 friend class CaptivePortalBrowserTest; |
| 113 friend class CaptivePortalTabHelperTest; | 116 friend class CaptivePortalTabHelperTest; |
| 114 | 117 |
| 115 friend class content::WebContentsUserData<CaptivePortalTabHelper>; | 118 friend class content::WebContentsUserData<CaptivePortalTabHelper>; |
| 116 explicit CaptivePortalTabHelper(content::WebContents* web_contents); | 119 explicit CaptivePortalTabHelper(content::WebContents* web_contents); |
| 117 | 120 |
| 118 // Called by Observe in response to the corresponding event. | 121 // Called by Observe in response to the corresponding event. |
| 119 void OnRedirect(int child_id, | 122 void OnRedirect(int child_id, |
| 120 ResourceType::Type resource_type, | 123 ResourceType::Type resource_type, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 133 | 136 |
| 134 // |this| takes ownership of |tab_reloader|. | 137 // |this| takes ownership of |tab_reloader|. |
| 135 void SetTabReloaderForTest(CaptivePortalTabReloader* tab_reloader); | 138 void SetTabReloaderForTest(CaptivePortalTabReloader* tab_reloader); |
| 136 | 139 |
| 137 const content::RenderViewHost* provisional_render_view_host() const { | 140 const content::RenderViewHost* provisional_render_view_host() const { |
| 138 return provisional_render_view_host_; | 141 return provisional_render_view_host_; |
| 139 } | 142 } |
| 140 | 143 |
| 141 CaptivePortalTabReloader* GetTabReloaderForTest(); | 144 CaptivePortalTabReloader* GetTabReloaderForTest(); |
| 142 | 145 |
| 143 // Opens a login tab if the profile's active window doesn't have one already. | |
| 144 void OpenLoginTab(); | |
| 145 | |
| 146 Profile* profile_; | 146 Profile* profile_; |
| 147 | 147 |
| 148 // Neither of these will ever be NULL. | 148 // Neither of these will ever be NULL. |
| 149 scoped_ptr<CaptivePortalTabReloader> tab_reloader_; | 149 scoped_ptr<CaptivePortalTabReloader> tab_reloader_; |
| 150 scoped_ptr<CaptivePortalLoginDetector> login_detector_; | 150 scoped_ptr<CaptivePortalLoginDetector> login_detector_; |
| 151 | 151 |
| 152 content::WebContents* web_contents_; | 152 content::WebContents* web_contents_; |
| 153 | 153 |
| 154 // If a provisional load has failed, and the tab is loading an error page, the | 154 // 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. | 155 // error code associated with the error page we're loading. |
| 156 // net::OK, otherwise. | 156 // net::OK, otherwise. |
| 157 int pending_error_code_; | 157 int pending_error_code_; |
| 158 | 158 |
| 159 // The RenderViewHost with a provisional load, if any. Can either be | 159 // The RenderViewHost with a provisional load, if any. Can either be |
| 160 // the currently displayed RenderViewHost or a pending RenderViewHost for | 160 // the currently displayed RenderViewHost or a pending RenderViewHost for |
| 161 // cross-process navitations. NULL when there's currently no provisional | 161 // cross-process navitations. NULL when there's currently no provisional |
| 162 // load. | 162 // load. |
| 163 content::RenderViewHost* provisional_render_view_host_; | 163 content::RenderViewHost* provisional_render_view_host_; |
| 164 | 164 |
| 165 content::NotificationRegistrar registrar_; | 165 content::NotificationRegistrar registrar_; |
| 166 | 166 |
| 167 DISALLOW_COPY_AND_ASSIGN(CaptivePortalTabHelper); | 167 DISALLOW_COPY_AND_ASSIGN(CaptivePortalTabHelper); |
| 168 }; | 168 }; |
| 169 | 169 |
| 170 #endif // CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_TAB_HELPER_H_ | 170 #endif // CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_TAB_HELPER_H_ |
| OLD | NEW |