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

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

Issue 2910543002: [Merge to M59] Revert "cros: Do not schedule attempt when behind captive portal with response 200 i… (Closed)
Patch Set: Created 3 years, 7 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 return; 555 ScheduleAttempt(results.retry_after_delta);
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);
563 } 556 }
564 557
565 void NetworkPortalDetectorImpl::Observe( 558 void NetworkPortalDetectorImpl::Observe(
566 int type, 559 int type,
567 const content::NotificationSource& source, 560 const content::NotificationSource& source,
568 const content::NotificationDetails& details) { 561 const content::NotificationDetails& details) {
569 if (type == chrome::NOTIFICATION_LOGIN_PROXY_CHANGED || 562 if (type == chrome::NOTIFICATION_LOGIN_PROXY_CHANGED ||
570 type == chrome::NOTIFICATION_AUTH_SUPPLIED || 563 type == chrome::NOTIFICATION_AUTH_SUPPLIED ||
571 type == chrome::NOTIFICATION_AUTH_CANCELLED) { 564 type == chrome::NOTIFICATION_AUTH_CANCELLED) {
572 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
652 } 645 }
653 646
654 void NetworkPortalDetectorImpl::ResetStrategyAndCounters() { 647 void NetworkPortalDetectorImpl::ResetStrategyAndCounters() {
655 last_detection_result_ = CAPTIVE_PORTAL_STATUS_UNKNOWN; 648 last_detection_result_ = CAPTIVE_PORTAL_STATUS_UNKNOWN;
656 same_detection_result_count_ = 0; 649 same_detection_result_count_ = 0;
657 no_response_result_count_ = 0; 650 no_response_result_count_ = 0;
658 strategy_->Reset(); 651 strategy_->Reset();
659 } 652 }
660 653
661 } // namespace chromeos 654 } // 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