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_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_SERVICE_H_ |
6 #define CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_SERVICE_H_ | 6 #define CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_SERVICE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/prefs/pref_member.h" | 10 #include "base/prefs/pref_member.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 IGNORE_REQUESTS_FOR_TESTING // Disables actual portal checks. This also | 35 IGNORE_REQUESTS_FOR_TESTING // Disables actual portal checks. This also |
36 // implies SKIP_OS_CHECK_FOR_TESTING. | 36 // implies SKIP_OS_CHECK_FOR_TESTING. |
37 }; | 37 }; |
38 | 38 |
39 // The details sent via a NOTIFICATION_CAPTIVE_PORTAL_CHECK_RESULT. | 39 // The details sent via a NOTIFICATION_CAPTIVE_PORTAL_CHECK_RESULT. |
40 struct Results { | 40 struct Results { |
41 // The result of the second most recent captive portal check. | 41 // The result of the second most recent captive portal check. |
42 captive_portal::CaptivePortalResult previous_result; | 42 captive_portal::CaptivePortalResult previous_result; |
43 // The result of the most recent captive portal check. | 43 // The result of the most recent captive portal check. |
44 captive_portal::CaptivePortalResult result; | 44 captive_portal::CaptivePortalResult result; |
| 45 // Landing url of the captive portal check ping. If behind a captive portal, |
| 46 // this points to the login page. |
| 47 GURL landing_url; |
45 }; | 48 }; |
46 | 49 |
47 explicit CaptivePortalService(Profile* profile); | 50 explicit CaptivePortalService(Profile* profile); |
48 ~CaptivePortalService() override; | 51 ~CaptivePortalService() override; |
49 | 52 |
50 // Triggers a check for a captive portal. If there's already a check in | 53 // Triggers a check for a captive portal. If there's already a check in |
51 // progress, does nothing. Throttles the rate at which requests are sent. | 54 // progress, does nothing. Throttles the rate at which requests are sent. |
52 // Always sends the result notification asynchronously. | 55 // Always sends the result notification asynchronously. |
53 void DetectCaptivePortal(); | 56 void DetectCaptivePortal(); |
54 | 57 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 116 |
114 // Called by CaptivePortalDetector when detection completes. | 117 // Called by CaptivePortalDetector when detection completes. |
115 void OnPortalDetectionCompleted( | 118 void OnPortalDetectionCompleted( |
116 const captive_portal::CaptivePortalDetector::Results& results); | 119 const captive_portal::CaptivePortalDetector::Results& results); |
117 | 120 |
118 // KeyedService: | 121 // KeyedService: |
119 void Shutdown() override; | 122 void Shutdown() override; |
120 | 123 |
121 // Called when a captive portal check completes. Passes the result to all | 124 // Called when a captive portal check completes. Passes the result to all |
122 // observers. | 125 // observers. |
123 void OnResult(captive_portal::CaptivePortalResult result); | 126 void OnResult(captive_portal::CaptivePortalResult result, |
| 127 const GURL& landing_url); |
124 | 128 |
125 // Updates BackoffEntry::Policy and creates a new BackoffEntry, which | 129 // Updates BackoffEntry::Policy and creates a new BackoffEntry, which |
126 // resets the count used for throttling. | 130 // resets the count used for throttling. |
127 void ResetBackoffEntry(captive_portal::CaptivePortalResult result); | 131 void ResetBackoffEntry(captive_portal::CaptivePortalResult result); |
128 | 132 |
129 // Updates |enabled_| based on command line flags and Profile preferences, | 133 // Updates |enabled_| based on command line flags and Profile preferences, |
130 // and sets |state_| to STATE_NONE if it's false. | 134 // and sets |state_| to STATE_NONE if it's false. |
131 // TODO(mmenke): Figure out on which platforms, if any, should not use | 135 // TODO(mmenke): Figure out on which platforms, if any, should not use |
132 // automatic captive portal detection. Currently it's enabled | 136 // automatic captive portal detection. Currently it's enabled |
133 // on all platforms, though this code is not compiled on | 137 // on all platforms, though this code is not compiled on |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 207 |
204 static TestingState testing_state_; | 208 static TestingState testing_state_; |
205 | 209 |
206 // Test time ticks used by unit tests. | 210 // Test time ticks used by unit tests. |
207 base::TimeTicks time_ticks_for_testing_; | 211 base::TimeTicks time_ticks_for_testing_; |
208 | 212 |
209 DISALLOW_COPY_AND_ASSIGN(CaptivePortalService); | 213 DISALLOW_COPY_AND_ASSIGN(CaptivePortalService); |
210 }; | 214 }; |
211 | 215 |
212 #endif // CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_SERVICE_H_ | 216 #endif // CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_SERVICE_H_ |
OLD | NEW |