| 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_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_H_ | 6 #define CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 : public base::NonThreadSafe, | 37 : public base::NonThreadSafe, |
| 38 public chromeos::NetworkLibrary::NetworkManagerObserver, | 38 public chromeos::NetworkLibrary::NetworkManagerObserver, |
| 39 public chromeos::NetworkLibrary::NetworkObserver, | 39 public chromeos::NetworkLibrary::NetworkObserver, |
| 40 public content::NotificationObserver { | 40 public content::NotificationObserver { |
| 41 public: | 41 public: |
| 42 enum CaptivePortalStatus { | 42 enum CaptivePortalStatus { |
| 43 CAPTIVE_PORTAL_STATUS_UNKNOWN = 0, | 43 CAPTIVE_PORTAL_STATUS_UNKNOWN = 0, |
| 44 CAPTIVE_PORTAL_STATUS_OFFLINE = 1, | 44 CAPTIVE_PORTAL_STATUS_OFFLINE = 1, |
| 45 CAPTIVE_PORTAL_STATUS_ONLINE = 2, | 45 CAPTIVE_PORTAL_STATUS_ONLINE = 2, |
| 46 CAPTIVE_PORTAL_STATUS_PORTAL = 3, | 46 CAPTIVE_PORTAL_STATUS_PORTAL = 3, |
| 47 CAPTIVE_PORTAL_STATUS_PROXY_AUTH_REQUIRED = 4 | 47 CAPTIVE_PORTAL_STATUS_PROXY_AUTH_REQUIRED = 4, |
| 48 CAPTIVE_PORTAL_STATUS_COUNT |
| 48 }; | 49 }; |
| 49 | 50 |
| 50 struct CaptivePortalState { | 51 struct CaptivePortalState { |
| 51 CaptivePortalState() | 52 CaptivePortalState() |
| 52 : status(CAPTIVE_PORTAL_STATUS_UNKNOWN), | 53 : status(CAPTIVE_PORTAL_STATUS_UNKNOWN), |
| 53 response_code(net::URLFetcher::RESPONSE_CODE_INVALID) { | 54 response_code(net::URLFetcher::RESPONSE_CODE_INVALID) { |
| 54 } | 55 } |
| 55 | 56 |
| 56 CaptivePortalStatus status; | 57 CaptivePortalStatus status; |
| 57 int response_code; | 58 int response_code; |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 | 207 |
| 207 base::WeakPtrFactory<NetworkPortalDetector> weak_ptr_factory_; | 208 base::WeakPtrFactory<NetworkPortalDetector> weak_ptr_factory_; |
| 208 | 209 |
| 209 // Number of portal detection attemps for an active network. | 210 // Number of portal detection attemps for an active network. |
| 210 int attempt_count_; | 211 int attempt_count_; |
| 211 | 212 |
| 212 // Minimum time between consecutive portal checks for the same | 213 // Minimum time between consecutive portal checks for the same |
| 213 // active network. | 214 // active network. |
| 214 base::TimeDelta min_time_between_attempts_; | 215 base::TimeDelta min_time_between_attempts_; |
| 215 | 216 |
| 217 // Start time of portal detection. |
| 218 base::TimeTicks detection_start_time_; |
| 219 |
| 216 // Start time of portal detection attempt. | 220 // Start time of portal detection attempt. |
| 217 base::TimeTicks attempt_start_time_; | 221 base::TimeTicks attempt_start_time_; |
| 218 | 222 |
| 219 // Timeout for a portal detection. | 223 // Timeout for a portal detection. |
| 220 base::TimeDelta request_timeout_; | 224 base::TimeDelta request_timeout_; |
| 221 | 225 |
| 222 // Delay before next portal detection. | 226 // Delay before next portal detection. |
| 223 base::TimeDelta next_attempt_delay_; | 227 base::TimeDelta next_attempt_delay_; |
| 224 | 228 |
| 225 // Test time ticks used by unit tests. | 229 // Test time ticks used by unit tests. |
| 226 base::TimeTicks time_ticks_for_testing_; | 230 base::TimeTicks time_ticks_for_testing_; |
| 227 | 231 |
| 228 content::NotificationRegistrar registrar_; | 232 content::NotificationRegistrar registrar_; |
| 229 | 233 |
| 230 DISALLOW_COPY_AND_ASSIGN(NetworkPortalDetector); | 234 DISALLOW_COPY_AND_ASSIGN(NetworkPortalDetector); |
| 231 }; | 235 }; |
| 232 | 236 |
| 233 } // namespace chromeos | 237 } // namespace chromeos |
| 234 | 238 |
| 235 #endif // CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_H_ | 239 #endif // CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_H_ |
| OLD | NEW |