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_LOGIN_DETECTOR_H_ | 5 #ifndef CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_LOGIN_DETECTOR_H_ |
6 #define CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_LOGIN_DETECTOR_H_ | 6 #define CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_LOGIN_DETECTOR_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "chrome/browser/captive_portal/captive_portal_service.h" | 9 #include "chrome/browser/captive_portal/captive_portal_service.h" |
10 | 10 |
11 class Profile; | 11 class Profile; |
12 | 12 |
13 namespace captive_portal { | 13 namespace captive_portal { |
mmenke
2014/04/21 14:32:43
Should we be using the namespace both in component
stevenjb
2014/04/21 16:42:27
I've seen this done before (we definitely do it wi
willchan no longer on Chromium
2014/04/21 17:06:07
I believe when we discussed this previously on chr
| |
14 | 14 |
15 // Triggers a captive portal test on navigations that may indicate a captive | 15 // Triggers a captive portal test on navigations that may indicate a captive |
16 // portal has been logged into. Currently only tracks if a page was opened | 16 // portal has been logged into. Currently only tracks if a page was opened |
17 // at a captive portal tab's login page, and triggers checks every navigation | 17 // at a captive portal tab's login page, and triggers checks every navigation |
18 // until there's no longer a captive portal, relying on the | 18 // until there's no longer a captive portal, relying on the |
19 // CaptivePortalService's throttling to prevent excessive server load. | 19 // CaptivePortalService's throttling to prevent excessive server load. |
20 // | 20 // |
21 // TODO(mmenke): If a page has been broken by a captive portal, and it's | 21 // TODO(mmenke): If a page has been broken by a captive portal, and it's |
22 // successfully reloaded, trigger a captive portal check. | 22 // successfully reloaded, trigger a captive portal check. |
23 class CaptivePortalLoginDetector { | 23 class CaptivePortalLoginDetector { |
24 public: | 24 public: |
25 explicit CaptivePortalLoginDetector(Profile* profile); | 25 explicit CaptivePortalLoginDetector(Profile* profile); |
26 | 26 |
27 ~CaptivePortalLoginDetector(); | 27 ~CaptivePortalLoginDetector(); |
28 | 28 |
29 void OnStoppedLoading(); | 29 void OnStoppedLoading(); |
30 void OnCaptivePortalResults(Result previous_result, Result result); | 30 void OnCaptivePortalResults(CaptivePortalResult previous_result, |
31 CaptivePortalResult result); | |
31 | 32 |
32 bool is_login_tab() const { return is_login_tab_; } | 33 bool is_login_tab() const { return is_login_tab_; } |
33 void SetIsLoginTab(); | 34 void SetIsLoginTab(); |
34 | 35 |
35 private: | 36 private: |
36 Profile* profile_; | 37 Profile* profile_; |
37 | 38 |
38 // True if this is a login tab. Set manually, automatically cleared once | 39 // True if this is a login tab. Set manually, automatically cleared once |
39 // login is detected. | 40 // login is detected. |
40 bool is_login_tab_; | 41 bool is_login_tab_; |
41 | 42 |
42 // Page is on its first load since being tagged as a login tab. Used to | 43 // Page is on its first load since being tagged as a login tab. Used to |
43 // prevent a second captive portal check on the first load of the login page. | 44 // prevent a second captive portal check on the first load of the login page. |
44 bool first_login_tab_load_; | 45 bool first_login_tab_load_; |
45 | 46 |
46 DISALLOW_COPY_AND_ASSIGN(CaptivePortalLoginDetector); | 47 DISALLOW_COPY_AND_ASSIGN(CaptivePortalLoginDetector); |
47 }; | 48 }; |
48 | 49 |
49 } // namespace captive_portal | 50 } // namespace captive_portal |
50 | 51 |
51 #endif // CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_LOGIN_DETECTOR_H_ | 52 #endif // CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_LOGIN_DETECTOR_H_ |
OLD | NEW |