Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(530)

Side by Side Diff: chrome/browser/chromeos/net/network_portal_detector_impl.cc

Issue 2756643002: cros: Do not schedule attempt when behind captive portal with response 200 is detected (Closed)
Patch Set: feedback Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/chromeos/net/network_portal_detector_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // Observers (via OnDetectionCompleted) may already schedule new attempt.
554 if (is_idle()) 554 if (!is_idle())
555 ScheduleAttempt(results.retry_after_delta); 555 return;
556
557 // If behind a captive portal and the response code was 200 (OK), do not
558 // schedule a new attempt.
559 if (state.status == CAPTIVE_PORTAL_STATUS_PORTAL && response_code == 200)
560 return;
561
562 ScheduleAttempt(results.retry_after_delta);
556 } 563 }
557 564
558 void NetworkPortalDetectorImpl::Observe( 565 void NetworkPortalDetectorImpl::Observe(
559 int type, 566 int type,
560 const content::NotificationSource& source, 567 const content::NotificationSource& source,
561 const content::NotificationDetails& details) { 568 const content::NotificationDetails& details) {
562 if (type == chrome::NOTIFICATION_LOGIN_PROXY_CHANGED || 569 if (type == chrome::NOTIFICATION_LOGIN_PROXY_CHANGED ||
563 type == chrome::NOTIFICATION_AUTH_SUPPLIED || 570 type == chrome::NOTIFICATION_AUTH_SUPPLIED ||
564 type == chrome::NOTIFICATION_AUTH_CANCELLED) { 571 type == chrome::NOTIFICATION_AUTH_CANCELLED) {
565 NET_LOG(EVENT) << "Restarting portal detection due to proxy change" 572 NET_LOG(EVENT) << "Restarting portal detection due to proxy change"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 } 652 }
646 653
647 void NetworkPortalDetectorImpl::ResetStrategyAndCounters() { 654 void NetworkPortalDetectorImpl::ResetStrategyAndCounters() {
648 last_detection_result_ = CAPTIVE_PORTAL_STATUS_UNKNOWN; 655 last_detection_result_ = CAPTIVE_PORTAL_STATUS_UNKNOWN;
649 same_detection_result_count_ = 0; 656 same_detection_result_count_ = 0;
650 no_response_result_count_ = 0; 657 no_response_result_count_ = 0;
651 strategy_->Reset(); 658 strategy_->Reset();
652 } 659 }
653 660
654 } // namespace chromeos 661 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/net/network_portal_detector_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698