| 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 11 matching lines...) Expand all Loading... |
| 22 // NOTIFICATION_CAPTIVE_PORTAL_CHECK_RESULT with the Profile as the source and | 22 // NOTIFICATION_CAPTIVE_PORTAL_CHECK_RESULT with the Profile as the source and |
| 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 |
| 34 // native captive portal detection. | 34 // has native captive portal detection. |
| 35 IGNORE_REQUESTS_FOR_TESTING // Disables actual portal checks. This also |
| 36 // implies SKIP_OS_CHECK_FOR_TESTING. |
| 35 }; | 37 }; |
| 36 | 38 |
| 37 // The details sent via a NOTIFICATION_CAPTIVE_PORTAL_CHECK_RESULT. | 39 // The details sent via a NOTIFICATION_CAPTIVE_PORTAL_CHECK_RESULT. |
| 38 struct Results { | 40 struct Results { |
| 39 // The result of the second most recent captive portal check. | 41 // The result of the second most recent captive portal check. |
| 40 captive_portal::CaptivePortalResult previous_result; | 42 captive_portal::CaptivePortalResult previous_result; |
| 41 // The result of the most recent captive portal check. | 43 // The result of the most recent captive portal check. |
| 42 captive_portal::CaptivePortalResult result; | 44 captive_portal::CaptivePortalResult result; |
| 43 }; | 45 }; |
| 44 | 46 |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 | 203 |
| 202 static TestingState testing_state_; | 204 static TestingState testing_state_; |
| 203 | 205 |
| 204 // Test time ticks used by unit tests. | 206 // Test time ticks used by unit tests. |
| 205 base::TimeTicks time_ticks_for_testing_; | 207 base::TimeTicks time_ticks_for_testing_; |
| 206 | 208 |
| 207 DISALLOW_COPY_AND_ASSIGN(CaptivePortalService); | 209 DISALLOW_COPY_AND_ASSIGN(CaptivePortalService); |
| 208 }; | 210 }; |
| 209 | 211 |
| 210 #endif // CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_SERVICE_H_ | 212 #endif // CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_SERVICE_H_ |
| OLD | NEW |