| 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 #include "chrome/browser/chromeos/net/network_portal_detector_impl.h" | 5 #include "chrome/browser/chromeos/net/network_portal_detector_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 const char NetworkPortalDetectorImpl::kSessionPortalToOnlineHistogram[] = | 214 const char NetworkPortalDetectorImpl::kSessionPortalToOnlineHistogram[] = |
| 215 "CaptivePortal.Session.PortalToOnlineTransition"; | 215 "CaptivePortal.Session.PortalToOnlineTransition"; |
| 216 | 216 |
| 217 // static | 217 // static |
| 218 void NetworkPortalDetectorImpl::Initialize( | 218 void NetworkPortalDetectorImpl::Initialize( |
| 219 net::URLRequestContextGetter* url_context) { | 219 net::URLRequestContextGetter* url_context) { |
| 220 if (NetworkPortalDetector::set_for_testing()) | 220 if (NetworkPortalDetector::set_for_testing()) |
| 221 return; | 221 return; |
| 222 CHECK(!NetworkPortalDetector::network_portal_detector()) | 222 CHECK(!NetworkPortalDetector::network_portal_detector()) |
| 223 << "NetworkPortalDetector was initialized twice."; | 223 << "NetworkPortalDetector was initialized twice."; |
| 224 if (CommandLine::ForCurrentProcess()->HasSwitch(::switches::kTestType)) | 224 if (base::CommandLine::ForCurrentProcess()->HasSwitch(::switches::kTestType)) |
| 225 set_network_portal_detector(new NetworkPortalDetectorStubImpl()); | 225 set_network_portal_detector(new NetworkPortalDetectorStubImpl()); |
| 226 else | 226 else |
| 227 set_network_portal_detector(new NetworkPortalDetectorImpl(url_context)); | 227 set_network_portal_detector(new NetworkPortalDetectorImpl(url_context)); |
| 228 } | 228 } |
| 229 | 229 |
| 230 NetworkPortalDetectorImpl::NetworkPortalDetectorImpl( | 230 NetworkPortalDetectorImpl::NetworkPortalDetectorImpl( |
| 231 const scoped_refptr<net::URLRequestContextGetter>& request_context) | 231 const scoped_refptr<net::URLRequestContextGetter>& request_context) |
| 232 : state_(STATE_IDLE), | 232 : state_(STATE_IDLE), |
| 233 test_url_(CaptivePortalDetector::kDefaultURL), | 233 test_url_(CaptivePortalDetector::kDefaultURL), |
| 234 enabled_(false), | 234 enabled_(false), |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 } | 651 } |
| 652 | 652 |
| 653 void NetworkPortalDetectorImpl::ResetStrategyAndCounters() { | 653 void NetworkPortalDetectorImpl::ResetStrategyAndCounters() { |
| 654 last_detection_result_ = CAPTIVE_PORTAL_STATUS_UNKNOWN; | 654 last_detection_result_ = CAPTIVE_PORTAL_STATUS_UNKNOWN; |
| 655 same_detection_result_count_ = 0; | 655 same_detection_result_count_ = 0; |
| 656 no_response_result_count_ = 0; | 656 no_response_result_count_ = 0; |
| 657 strategy_->Reset(); | 657 strategy_->Reset(); |
| 658 } | 658 } |
| 659 | 659 |
| 660 } // namespace chromeos | 660 } // namespace chromeos |
| OLD | NEW |