| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_IMPL_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_IMPL_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_IMPL_H_ | 6 #define CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/cancelable_callback.h" | 11 #include "base/cancelable_callback.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/containers/hash_tables.h" | 13 #include "base/containers/hash_tables.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "base/observer_list.h" | 17 #include "base/observer_list.h" |
| 18 #include "base/threading/non_thread_safe.h" | 18 #include "base/threading/non_thread_safe.h" |
| 19 #include "base/time/time.h" | 19 #include "base/time/time.h" |
| 20 #include "chrome/browser/captive_portal/captive_portal_detector.h" | |
| 21 #include "chrome/browser/chromeos/net/network_portal_detector.h" | 20 #include "chrome/browser/chromeos/net/network_portal_detector.h" |
| 22 #include "chrome/browser/chromeos/net/network_portal_detector_strategy.h" | 21 #include "chrome/browser/chromeos/net/network_portal_detector_strategy.h" |
| 23 #include "chrome/browser/chromeos/net/network_portal_notification_controller.h" | 22 #include "chrome/browser/chromeos/net/network_portal_notification_controller.h" |
| 24 #include "chromeos/network/network_state_handler_observer.h" | 23 #include "chromeos/network/network_state_handler_observer.h" |
| 24 #include "components/captive_portal/captive_portal_detector.h" |
| 25 #include "content/public/browser/notification_observer.h" | 25 #include "content/public/browser/notification_observer.h" |
| 26 #include "content/public/browser/notification_registrar.h" | 26 #include "content/public/browser/notification_registrar.h" |
| 27 #include "net/url_request/url_fetcher.h" | 27 #include "net/url_request/url_fetcher.h" |
| 28 #include "url/gurl.h" | 28 #include "url/gurl.h" |
| 29 | 29 |
| 30 namespace net { | 30 namespace net { |
| 31 class URLRequestContextGetter; | 31 class URLRequestContextGetter; |
| 32 } | 32 } |
| 33 | 33 |
| 34 namespace chromeos { | 34 namespace chromeos { |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 return next_attempt_delay_; | 172 return next_attempt_delay_; |
| 173 } | 173 } |
| 174 | 174 |
| 175 // Returns true if attempt timeout callback isn't fired or | 175 // Returns true if attempt timeout callback isn't fired or |
| 176 // cancelled. | 176 // cancelled. |
| 177 bool AttemptTimeoutIsCancelledForTesting() const; | 177 bool AttemptTimeoutIsCancelledForTesting() const; |
| 178 | 178 |
| 179 // Record detection stats such as detection duration and detection | 179 // Record detection stats such as detection duration and detection |
| 180 // result in UMA. | 180 // result in UMA. |
| 181 void RecordDetectionStats(const NetworkState* network, | 181 void RecordDetectionStats(const NetworkState* network, |
| 182 CaptivePortalStatus status); | 182 captive_portal::CaptivePortalStatus status); |
| 183 | 183 |
| 184 // Sets current test time ticks. Used by unit tests. | 184 // Sets current test time ticks. Used by unit tests. |
| 185 void set_time_ticks_for_testing(const base::TimeTicks& time_ticks) { | 185 void set_time_ticks_for_testing(const base::TimeTicks& time_ticks) { |
| 186 time_ticks_for_testing_ = time_ticks; | 186 time_ticks_for_testing_ = time_ticks; |
| 187 } | 187 } |
| 188 | 188 |
| 189 // Advances current test time ticks. Used by unit tests. | 189 // Advances current test time ticks. Used by unit tests. |
| 190 void advance_time_ticks_for_testing(const base::TimeDelta& delta) { | 190 void advance_time_ticks_for_testing(const base::TimeDelta& delta) { |
| 191 time_ticks_for_testing_ += delta; | 191 time_ticks_for_testing_ += delta; |
| 192 } | 192 } |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 | 246 |
| 247 // Test time ticks used by unit tests. | 247 // Test time ticks used by unit tests. |
| 248 base::TimeTicks time_ticks_for_testing_; | 248 base::TimeTicks time_ticks_for_testing_; |
| 249 | 249 |
| 250 DISALLOW_COPY_AND_ASSIGN(NetworkPortalDetectorImpl); | 250 DISALLOW_COPY_AND_ASSIGN(NetworkPortalDetectorImpl); |
| 251 }; | 251 }; |
| 252 | 252 |
| 253 } // namespace chromeos | 253 } // namespace chromeos |
| 254 | 254 |
| 255 #endif // CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_IMPL_H_ | 255 #endif // CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_IMPL_H_ |
| OLD | NEW |