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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
43 }; | 43 }; |
44 | 44 |
45 explicit CaptivePortalService(Profile* profile); | 45 explicit CaptivePortalService(Profile* profile); |
46 ~CaptivePortalService() override; | 46 ~CaptivePortalService() override; |
47 | 47 |
48 // Triggers a check for a captive portal. If there's already a check in | 48 // Triggers a check for a captive portal. If there's already a check in |
49 // progress, does nothing. Throttles the rate at which requests are sent. | 49 // progress, does nothing. Throttles the rate at which requests are sent. |
50 // Always sends the result notification asynchronously. | 50 // Always sends the result notification asynchronously. |
51 void DetectCaptivePortal(); | 51 void DetectCaptivePortal(); |
52 | 52 |
53 // Enables or disables actual portal checks. | |
54 void SetPortalDetectionEnabledForTest(bool enabled); | |
mmenke
2014/12/09 22:42:26
Having both this and set_state_for_testing seems a
meacer
2014/12/10 22:48:02
I considered doing that previously but wasn't sure
| |
55 | |
53 // Returns the URL used for captive portal testing. When a captive portal is | 56 // Returns the URL used for captive portal testing. When a captive portal is |
54 // detected, this URL will take us to the captive portal landing page. | 57 // detected, this URL will take us to the captive portal landing page. |
55 const GURL& test_url() const { return test_url_; } | 58 const GURL& test_url() const { return test_url_; } |
56 | 59 |
57 // Result of the most recent captive portal check. | 60 // Result of the most recent captive portal check. |
58 captive_portal::CaptivePortalResult last_detection_result() const { | 61 captive_portal::CaptivePortalResult last_detection_result() const { |
59 return last_detection_result_; | 62 return last_detection_result_; |
60 } | 63 } |
61 | 64 |
62 // Whether or not the CaptivePortalService is enabled. When disabled, all | 65 // Whether or not the CaptivePortalService is enabled. When disabled, all |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
197 // the Link Doctor. | 200 // the Link Doctor. |
198 BooleanPrefMember resolve_errors_with_web_service_; | 201 BooleanPrefMember resolve_errors_with_web_service_; |
199 | 202 |
200 base::OneShotTimer<CaptivePortalService> check_captive_portal_timer_; | 203 base::OneShotTimer<CaptivePortalService> check_captive_portal_timer_; |
201 | 204 |
202 static TestingState testing_state_; | 205 static TestingState testing_state_; |
203 | 206 |
204 // Test time ticks used by unit tests. | 207 // Test time ticks used by unit tests. |
205 base::TimeTicks time_ticks_for_testing_; | 208 base::TimeTicks time_ticks_for_testing_; |
206 | 209 |
210 // If true, portal detection is enabled. Only false in tests. | |
211 bool portal_detection_enabled_; | |
212 | |
207 DISALLOW_COPY_AND_ASSIGN(CaptivePortalService); | 213 DISALLOW_COPY_AND_ASSIGN(CaptivePortalService); |
208 }; | 214 }; |
209 | 215 |
210 #endif // CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_SERVICE_H_ | 216 #endif // CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_SERVICE_H_ |
OLD | NEW |