Chromium Code Reviews| 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/threading/non_thread_safe.h" | 10 #include "base/threading/non_thread_safe.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 69 // detected, this URL will take us to the captive portal landing page. | 69 // detected, this URL will take us to the captive portal landing page. |
| 70 const GURL& test_url() const { return test_url_; } | 70 const GURL& test_url() const { return test_url_; } |
| 71 | 71 |
| 72 // Result of the most recent captive portal check. | 72 // Result of the most recent captive portal check. |
| 73 Result last_detection_result() const { return last_detection_result_; } | 73 Result last_detection_result() const { return last_detection_result_; } |
| 74 | 74 |
| 75 // Whether or not the CaptivePortalService is enabled. When disabled, all | 75 // Whether or not the CaptivePortalService is enabled. When disabled, all |
| 76 // checks return INTERNET_CONNECTED. | 76 // checks return INTERNET_CONNECTED. |
| 77 bool enabled() const { return enabled_; } | 77 bool enabled() const { return enabled_; } |
| 78 | 78 |
| 79 // Used to disable captive portal detection so it doesn't interfere with | |
| 80 // tests. Should be called before the service is created. | |
| 81 static void set_is_disabled_for_tests(bool is_disabled_for_tests) { | |
|
jam
2012/07/26 21:47:53
nit: name this set_is_disabled_for_testing. there
mmenke
2012/07/26 22:08:28
Done.
| |
| 82 is_disabled_for_tests_ = is_disabled_for_tests; | |
| 83 } | |
| 84 static bool is_disabled_for_tests() { return is_disabled_for_tests_; } | |
| 85 | |
| 79 private: | 86 private: |
| 80 friend class CaptivePortalServiceTest; | 87 friend class CaptivePortalServiceTest; |
| 81 friend class CaptivePortalBrowserTest; | 88 friend class CaptivePortalBrowserTest; |
| 82 | 89 |
| 83 // Subclass of BackoffEntry that uses the CaptivePortalService's | 90 // Subclass of BackoffEntry that uses the CaptivePortalService's |
| 84 // GetCurrentTime function, for unit testing. | 91 // GetCurrentTime function, for unit testing. |
| 85 class RecheckBackoffEntry; | 92 class RecheckBackoffEntry; |
| 86 | 93 |
| 87 enum State { | 94 enum State { |
| 88 // No check is running or pending. | 95 // No check is running or pending. |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 204 // URL that returns a 204 response code when connected to the Internet. | 211 // URL that returns a 204 response code when connected to the Internet. |
| 205 GURL test_url_; | 212 GURL test_url_; |
| 206 | 213 |
| 207 // The pref member for whether navigation errors should be resolved with a web | 214 // The pref member for whether navigation errors should be resolved with a web |
| 208 // service. Actually called "alternate_error_pages", since it's also used for | 215 // service. Actually called "alternate_error_pages", since it's also used for |
| 209 // the Link Doctor. | 216 // the Link Doctor. |
| 210 BooleanPrefMember resolve_errors_with_web_service_; | 217 BooleanPrefMember resolve_errors_with_web_service_; |
| 211 | 218 |
| 212 base::OneShotTimer<CaptivePortalService> check_captive_portal_timer_; | 219 base::OneShotTimer<CaptivePortalService> check_captive_portal_timer_; |
| 213 | 220 |
| 221 static bool is_disabled_for_tests_; | |
| 222 | |
| 214 DISALLOW_COPY_AND_ASSIGN(CaptivePortalService); | 223 DISALLOW_COPY_AND_ASSIGN(CaptivePortalService); |
| 215 }; | 224 }; |
| 216 | 225 |
| 217 } // namespace captive_portal | 226 } // namespace captive_portal |
| 218 | 227 |
| 219 #endif // CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_SERVICE_H_ | 228 #endif // CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_SERVICE_H_ |
| OLD | NEW |