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

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

Issue 2923343004: cros: no active portal check when successfully behind portal (Closed)
Patch Set: Created 3 years, 6 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
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 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 response_code = 200; 491 response_code = 200;
492 } 492 }
493 493
494 DetectionAttemptCompletedReport attempt_completed_report( 494 DetectionAttemptCompletedReport attempt_completed_report(
495 default_network_name_, default_network_id_, result, response_code); 495 default_network_name_, default_network_id_, result, response_code);
496 if (!attempt_completed_report_.Equals(attempt_completed_report)) { 496 if (!attempt_completed_report_.Equals(attempt_completed_report)) {
497 attempt_completed_report_ = attempt_completed_report; 497 attempt_completed_report_ = attempt_completed_report;
498 attempt_completed_report_.Report(); 498 attempt_completed_report_.Report();
499 } 499 }
500 500
501 state_ = STATE_IDLE; 501 // If we are successfully behind captive portal, mark the state so that it
502 // won't schedule detection actively by self.
503 if (result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL &&
504 response_code == 200) {
505 // This can happen when portal provider disconnects us, in which case shill
506 // remains online state.
507 if (network && network->connection_state() == shill::kStateOnline)
508 state_ = STATE_IDLE;
509 else
510 state_ = STATE_BEHIND_PORTAL_IDLE;
stevenjb 2017/06/07 23:00:23 Combine the logic so that this is: if (result ==
Qiang(Joe) Xu 2017/06/07 23:19:13 Done.
511 } else {
512 state_ = STATE_IDLE;
513 }
502 attempt_timeout_.Cancel(); 514 attempt_timeout_.Cancel();
503 515
504 CaptivePortalState state; 516 CaptivePortalState state;
505 state.response_code = response_code; 517 state.response_code = response_code;
506 state.time = NowTicks(); 518 state.time = NowTicks();
507 switch (result) { 519 switch (result) {
508 case captive_portal::RESULT_NO_RESPONSE: 520 case captive_portal::RESULT_NO_RESPONSE:
509 if (state.response_code == net::HTTP_PROXY_AUTHENTICATION_REQUIRED) { 521 if (state.response_code == net::HTTP_PROXY_AUTHENTICATION_REQUIRED) {
510 state.status = CAPTIVE_PORTAL_STATUS_PROXY_AUTH_REQUIRED; 522 state.status = CAPTIVE_PORTAL_STATUS_PROXY_AUTH_REQUIRED;
511 } else if (network && network->is_captive_portal()) { 523 } else if (network && network->is_captive_portal()) {
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 } 659 }
648 660
649 void NetworkPortalDetectorImpl::ResetStrategyAndCounters() { 661 void NetworkPortalDetectorImpl::ResetStrategyAndCounters() {
650 last_detection_result_ = CAPTIVE_PORTAL_STATUS_UNKNOWN; 662 last_detection_result_ = CAPTIVE_PORTAL_STATUS_UNKNOWN;
651 same_detection_result_count_ = 0; 663 same_detection_result_count_ = 0;
652 no_response_result_count_ = 0; 664 no_response_result_count_ = 0;
653 strategy_->Reset(); 665 strategy_->Reset();
654 } 666 }
655 667
656 } // namespace chromeos 668 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698