| 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 12 matching lines...) Expand all Loading... |
| 23 // a CaptivePortalService::Results as the details. | 23 // a CaptivePortalService::Results as the details. |
| 24 // | 24 // |
| 25 // Captive portal checks are rate-limited. The CaptivePortalService may only | 25 // Captive portal checks are rate-limited. The CaptivePortalService may only |
| 26 // be accessed on the UI thread. | 26 // be accessed on the UI thread. |
| 27 // Design doc: https://docs.google.com/document/d/1k-gP2sswzYNvryu9NcgN7q5XrsMlU
dlUdoW9WRaEmfM/edit | 27 // Design doc: https://docs.google.com/document/d/1k-gP2sswzYNvryu9NcgN7q5XrsMlU
dlUdoW9WRaEmfM/edit |
| 28 class CaptivePortalService : public KeyedService, public base::NonThreadSafe { | 28 class CaptivePortalService : public KeyedService, public base::NonThreadSafe { |
| 29 public: | 29 public: |
| 30 enum TestingState { | 30 enum TestingState { |
| 31 NOT_TESTING, | 31 NOT_TESTING, |
| 32 DISABLED_FOR_TESTING, // The service is always disabled. | 32 DISABLED_FOR_TESTING, // The service is always disabled. |
| 33 SKIP_OS_CHECK_FOR_TESTING // The service can be enabled even if the OS has | 33 SKIP_OS_CHECK_FOR_TESTING, // The service can be enabled even if the OS has |
| 34 // native captive portal detection. | 34 // native captive portal detection. |
| 35 IGNORE_REQUESTS_FOR_TESTING // Disables actual portal checks. |
| 35 }; | 36 }; |
| 36 | 37 |
| 37 // The details sent via a NOTIFICATION_CAPTIVE_PORTAL_CHECK_RESULT. | 38 // The details sent via a NOTIFICATION_CAPTIVE_PORTAL_CHECK_RESULT. |
| 38 struct Results { | 39 struct Results { |
| 39 // The result of the second most recent captive portal check. | 40 // The result of the second most recent captive portal check. |
| 40 captive_portal::CaptivePortalResult previous_result; | 41 captive_portal::CaptivePortalResult previous_result; |
| 41 // The result of the most recent captive portal check. | 42 // The result of the most recent captive portal check. |
| 42 captive_portal::CaptivePortalResult result; | 43 captive_portal::CaptivePortalResult result; |
| 43 }; | 44 }; |
| 44 | 45 |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 | 202 |
| 202 static TestingState testing_state_; | 203 static TestingState testing_state_; |
| 203 | 204 |
| 204 // Test time ticks used by unit tests. | 205 // Test time ticks used by unit tests. |
| 205 base::TimeTicks time_ticks_for_testing_; | 206 base::TimeTicks time_ticks_for_testing_; |
| 206 | 207 |
| 207 DISALLOW_COPY_AND_ASSIGN(CaptivePortalService); | 208 DISALLOW_COPY_AND_ASSIGN(CaptivePortalService); |
| 208 }; | 209 }; |
| 209 | 210 |
| 210 #endif // CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_SERVICE_H_ | 211 #endif // CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_SERVICE_H_ |
| OLD | NEW |