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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
389 DCHECK(CanPerformAttempt()); | 389 DCHECK(CanPerformAttempt()); |
390 | 390 |
391 if (!IsEnabled()) | 391 if (!IsEnabled()) |
392 return; | 392 return; |
393 | 393 |
394 attempt_task_.Cancel(); | 394 attempt_task_.Cancel(); |
395 attempt_timeout_.Cancel(); | 395 attempt_timeout_.Cancel(); |
396 state_ = STATE_PORTAL_CHECK_PENDING; | 396 state_ = STATE_PORTAL_CHECK_PENDING; |
397 | 397 |
398 next_attempt_delay_ = std::max(delay, strategy_->GetDelayTillNextAttempt()); | 398 next_attempt_delay_ = std::max(delay, strategy_->GetDelayTillNextAttempt()); |
399 LOG(ERROR) << "Scheduling attempt after: " << next_attempt_delay_.InSeconds(); | |
Nikita (slow)
2014/07/14 09:16:49
Remove debug logging?
| |
399 attempt_task_.Reset(base::Bind(&NetworkPortalDetectorImpl::StartAttempt, | 400 attempt_task_.Reset(base::Bind(&NetworkPortalDetectorImpl::StartAttempt, |
400 weak_factory_.GetWeakPtr())); | 401 weak_factory_.GetWeakPtr())); |
401 base::MessageLoop::current()->PostDelayedTask( | 402 base::MessageLoop::current()->PostDelayedTask( |
402 FROM_HERE, attempt_task_.callback(), next_attempt_delay_); | 403 FROM_HERE, attempt_task_.callback(), next_attempt_delay_); |
403 } | 404 } |
404 | 405 |
405 void NetworkPortalDetectorImpl::StartAttempt() { | 406 void NetworkPortalDetectorImpl::StartAttempt() { |
406 DCHECK(is_portal_check_pending()); | 407 DCHECK(is_portal_check_pending()); |
407 | 408 |
408 state_ = STATE_CHECKING_FOR_PORTAL; | 409 state_ = STATE_CHECKING_FOR_PORTAL; |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
602 if (network->connection_state() != shill::kStateOnline) | 603 if (network->connection_state() != shill::kStateOnline) |
603 RecordDiscrepancyWithShill(network, status); | 604 RecordDiscrepancyWithShill(network, status); |
604 break; | 605 break; |
605 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_COUNT: | 606 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_COUNT: |
606 NOTREACHED(); | 607 NOTREACHED(); |
607 break; | 608 break; |
608 } | 609 } |
609 } | 610 } |
610 | 611 |
611 } // namespace chromeos | 612 } // namespace chromeos |
OLD | NEW |