| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 // Result of the most recent captive portal check. | 73 // Result of the most recent captive portal check. |
| 74 Result last_detection_result() const { return last_detection_result_; } | 74 Result last_detection_result() const { return last_detection_result_; } |
| 75 | 75 |
| 76 // Whether or not the CaptivePortalService is enabled. When disabled, all | 76 // Whether or not the CaptivePortalService is enabled. When disabled, all |
| 77 // checks return INTERNET_CONNECTED. | 77 // checks return INTERNET_CONNECTED. |
| 78 bool enabled() const { return enabled_; } | 78 bool enabled() const { return enabled_; } |
| 79 | 79 |
| 80 private: | 80 private: |
| 81 friend class CaptivePortalServiceTest; | 81 friend class CaptivePortalServiceTest; |
| 82 friend class CaptivePortalBrowserTest; |
| 82 | 83 |
| 83 // Subclass of BackoffEntry that uses the CaptivePortalService's | 84 // Subclass of BackoffEntry that uses the CaptivePortalService's |
| 84 // GetCurrentTime function, for unit testing. | 85 // GetCurrentTime function, for unit testing. |
| 85 class RecheckBackoffEntry; | 86 class RecheckBackoffEntry; |
| 86 | 87 |
| 87 enum State { | 88 enum State { |
| 88 // No check is running or pending. | 89 // No check is running or pending. |
| 89 STATE_IDLE, | 90 STATE_IDLE, |
| 90 // The timer to check for a captive portal is running. | 91 // The timer to check for a captive portal is running. |
| 91 STATE_TIMER_RUNNING, | 92 STATE_TIMER_RUNNING, |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 // Returns true if a captive portal check is currently running. | 161 // Returns true if a captive portal check is currently running. |
| 161 bool FetchingURL() const; | 162 bool FetchingURL() const; |
| 162 | 163 |
| 163 // Returns true if the timer to try and detect a captive portal is running. | 164 // Returns true if the timer to try and detect a captive portal is running. |
| 164 bool TimerRunning() const; | 165 bool TimerRunning() const; |
| 165 | 166 |
| 166 State state() const { return state_; } | 167 State state() const { return state_; } |
| 167 | 168 |
| 168 RecheckPolicy& recheck_policy() { return recheck_policy_; } | 169 RecheckPolicy& recheck_policy() { return recheck_policy_; } |
| 169 | 170 |
| 171 void set_test_url(const GURL& test_url) { test_url_ = test_url; } |
| 172 |
| 170 // The profile that owns this CaptivePortalService. | 173 // The profile that owns this CaptivePortalService. |
| 171 Profile* profile_; | 174 Profile* profile_; |
| 172 | 175 |
| 173 State state_; | 176 State state_; |
| 174 | 177 |
| 175 // True if the service is enabled. When not enabled, all checks will return | 178 // True if the service is enabled. When not enabled, all checks will return |
| 176 // RESULT_INTERNET_CONNECTED. | 179 // RESULT_INTERNET_CONNECTED. |
| 177 bool enabled_; | 180 bool enabled_; |
| 178 | 181 |
| 179 // The result of the most recent captive portal check. | 182 // The result of the most recent captive portal check. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 208 BooleanPrefMember resolve_errors_with_web_service_; | 211 BooleanPrefMember resolve_errors_with_web_service_; |
| 209 | 212 |
| 210 base::OneShotTimer<CaptivePortalService> check_captive_portal_timer_; | 213 base::OneShotTimer<CaptivePortalService> check_captive_portal_timer_; |
| 211 | 214 |
| 212 DISALLOW_COPY_AND_ASSIGN(CaptivePortalService); | 215 DISALLOW_COPY_AND_ASSIGN(CaptivePortalService); |
| 213 }; | 216 }; |
| 214 | 217 |
| 215 } // namespace captive_portal | 218 } // namespace captive_portal |
| 216 | 219 |
| 217 #endif // CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_SERVICE_H_ | 220 #endif // CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_SERVICE_H_ |
| OLD | NEW |