Chromium Code Reviews| 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 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 | 552 |
| 553 // Observers (via OnDetectionCompleted) may already schedule new attempt. | 553 // Do not schedule attempt if Observers (via OnDetectionCompleted) already |
| 554 if (is_idle()) | 554 // schedule new attempt or we are already behind captive portal, which can be |
|
stevenjb
2017/03/17 00:26:46
nit: 'has already scheduled a new attempt', 'behin
| |
| 555 // either the result of NetworkPortalDetector or shill's detection. | |
| 556 if (is_idle() && state.status != CAPTIVE_PORTAL_STATUS_PORTAL) | |
| 555 ScheduleAttempt(results.retry_after_delta); | 557 ScheduleAttempt(results.retry_after_delta); |
| 556 } | 558 } |
| 557 | 559 |
| 558 void NetworkPortalDetectorImpl::Observe( | 560 void NetworkPortalDetectorImpl::Observe( |
| 559 int type, | 561 int type, |
| 560 const content::NotificationSource& source, | 562 const content::NotificationSource& source, |
| 561 const content::NotificationDetails& details) { | 563 const content::NotificationDetails& details) { |
| 562 if (type == chrome::NOTIFICATION_LOGIN_PROXY_CHANGED || | 564 if (type == chrome::NOTIFICATION_LOGIN_PROXY_CHANGED || |
| 563 type == chrome::NOTIFICATION_AUTH_SUPPLIED || | 565 type == chrome::NOTIFICATION_AUTH_SUPPLIED || |
| 564 type == chrome::NOTIFICATION_AUTH_CANCELLED) { | 566 type == chrome::NOTIFICATION_AUTH_CANCELLED) { |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 645 } | 647 } |
| 646 | 648 |
| 647 void NetworkPortalDetectorImpl::ResetStrategyAndCounters() { | 649 void NetworkPortalDetectorImpl::ResetStrategyAndCounters() { |
| 648 last_detection_result_ = CAPTIVE_PORTAL_STATUS_UNKNOWN; | 650 last_detection_result_ = CAPTIVE_PORTAL_STATUS_UNKNOWN; |
| 649 same_detection_result_count_ = 0; | 651 same_detection_result_count_ = 0; |
| 650 no_response_result_count_ = 0; | 652 no_response_result_count_ = 0; |
| 651 strategy_->Reset(); | 653 strategy_->Reset(); |
| 652 } | 654 } |
| 653 | 655 |
| 654 } // namespace chromeos | 656 } // namespace chromeos |
| OLD | NEW |