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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
12 #include "chrome/browser/chrome_notification_types.h" | 12 #include "chrome/browser/chrome_notification_types.h" |
13 #include "chromeos/dbus/shill_service_client_stub.h" | 13 #include "chromeos/dbus/shill_stub_helper.h" |
14 #include "chromeos/network/network_state.h" | 14 #include "chromeos/network/network_state.h" |
15 #include "chromeos/network/network_state_handler.h" | 15 #include "chromeos/network/network_state_handler.h" |
16 #include "content/public/browser/notification_service.h" | 16 #include "content/public/browser/notification_service.h" |
17 #include "grit/generated_resources.h" | 17 #include "grit/generated_resources.h" |
18 #include "net/http/http_status_code.h" | 18 #include "net/http/http_status_code.h" |
19 #include "third_party/cros_system_api/dbus/service_constants.h" | 19 #include "third_party/cros_system_api/dbus/service_constants.h" |
20 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
21 | 21 |
22 using captive_portal::CaptivePortalDetector; | 22 using captive_portal::CaptivePortalDetector; |
23 | 23 |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 captive_portal_detector_->Cancel(); | 342 captive_portal_detector_->Cancel(); |
343 detection_timeout_.Cancel(); | 343 detection_timeout_.Cancel(); |
344 state_ = STATE_IDLE; | 344 state_ = STATE_IDLE; |
345 } | 345 } |
346 | 346 |
347 void NetworkPortalDetectorImpl::OnPortalDetectionCompleted( | 347 void NetworkPortalDetectorImpl::OnPortalDetectionCompleted( |
348 const CaptivePortalDetector::Results& results) { | 348 const CaptivePortalDetector::Results& results) { |
349 captive_portal::Result result = results.result; | 349 captive_portal::Result result = results.result; |
350 int response_code = results.response_code; | 350 int response_code = results.response_code; |
351 | 351 |
352 if (ShillServiceClientStub::IsStubPortalledWifiEnabled( | 352 if (shill_stub_helper::IsStubPortalledWifiEnabled(default_service_path_)) { |
353 default_service_path_)) { | |
354 result = captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL; | 353 result = captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL; |
355 response_code = 200; | 354 response_code = 200; |
356 } | 355 } |
357 | 356 |
358 DCHECK(CalledOnValidThread()); | 357 DCHECK(CalledOnValidThread()); |
359 DCHECK(IsCheckingForPortal()); | 358 DCHECK(IsCheckingForPortal()); |
360 | 359 |
361 VLOG(1) << "Portal detection completed: " | 360 VLOG(1) << "Portal detection completed: " |
362 << "network=" << default_network_id_ << ", " | 361 << "network=" << default_network_id_ << ", " |
363 << "result=" << CaptivePortalDetector::CaptivePortalResultToString( | 362 << "result=" << CaptivePortalDetector::CaptivePortalResultToString( |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 const NetworkState* network = | 488 const NetworkState* network = |
490 NetworkHandler::Get()->network_state_handler()->DefaultNetwork(); | 489 NetworkHandler::Get()->network_state_handler()->DefaultNetwork(); |
491 if (!network) | 490 if (!network) |
492 return kBaseRequestTimeoutSec; | 491 return kBaseRequestTimeoutSec; |
493 if (lazy_detection_enabled_) | 492 if (lazy_detection_enabled_) |
494 return kLazyRequestTimeoutSec; | 493 return kLazyRequestTimeoutSec; |
495 return attempt_count_ * kBaseRequestTimeoutSec; | 494 return attempt_count_ * kBaseRequestTimeoutSec; |
496 } | 495 } |
497 | 496 |
498 } // namespace chromeos | 497 } // namespace chromeos |
OLD | NEW |