| 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 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 | 542 |
| 543 if (result == captive_portal::RESULT_NO_RESPONSE) | 543 if (result == captive_portal::RESULT_NO_RESPONSE) |
| 544 ++no_response_result_count_; | 544 ++no_response_result_count_; |
| 545 else | 545 else |
| 546 no_response_result_count_ = 0; | 546 no_response_result_count_ = 0; |
| 547 | 547 |
| 548 if (state.status != CAPTIVE_PORTAL_STATUS_OFFLINE || | 548 if (state.status != CAPTIVE_PORTAL_STATUS_OFFLINE || |
| 549 same_detection_result_count_ >= kMaxOfflineResultsBeforeReport) { | 549 same_detection_result_count_ >= kMaxOfflineResultsBeforeReport) { |
| 550 OnDetectionCompleted(network, state); | 550 OnDetectionCompleted(network, state); |
| 551 } | 551 } |
| 552 ScheduleAttempt(results.retry_after_delta); | 552 |
| 553 // Observers (via OnDetectionCompleted) may already schedule new attempt. |
| 554 if (is_idle()) |
| 555 ScheduleAttempt(results.retry_after_delta); |
| 553 } | 556 } |
| 554 | 557 |
| 555 void NetworkPortalDetectorImpl::Observe( | 558 void NetworkPortalDetectorImpl::Observe( |
| 556 int type, | 559 int type, |
| 557 const content::NotificationSource& source, | 560 const content::NotificationSource& source, |
| 558 const content::NotificationDetails& details) { | 561 const content::NotificationDetails& details) { |
| 559 if (type == chrome::NOTIFICATION_LOGIN_PROXY_CHANGED || | 562 if (type == chrome::NOTIFICATION_LOGIN_PROXY_CHANGED || |
| 560 type == chrome::NOTIFICATION_AUTH_SUPPLIED || | 563 type == chrome::NOTIFICATION_AUTH_SUPPLIED || |
| 561 type == chrome::NOTIFICATION_AUTH_CANCELLED) { | 564 type == chrome::NOTIFICATION_AUTH_CANCELLED) { |
| 562 NET_LOG(EVENT) << "Restarting portal detection due to proxy change" | 565 NET_LOG(EVENT) << "Restarting portal detection due to proxy change" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 } | 645 } |
| 643 | 646 |
| 644 void NetworkPortalDetectorImpl::ResetStrategyAndCounters() { | 647 void NetworkPortalDetectorImpl::ResetStrategyAndCounters() { |
| 645 last_detection_result_ = CAPTIVE_PORTAL_STATUS_UNKNOWN; | 648 last_detection_result_ = CAPTIVE_PORTAL_STATUS_UNKNOWN; |
| 646 same_detection_result_count_ = 0; | 649 same_detection_result_count_ = 0; |
| 647 no_response_result_count_ = 0; | 650 no_response_result_count_ = 0; |
| 648 strategy_->Reset(); | 651 strategy_->Reset(); |
| 649 } | 652 } |
| 650 | 653 |
| 651 } // namespace chromeos | 654 } // namespace chromeos |
| OLD | NEW |