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

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: steven's feedback 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 Chrome portal detection successfully returns portal state, mark the
502 // state so that Chrome won't schedule detection actively by self.
503 // The exception is when portal side session expires, shill doesn't report
504 // network connection state changed from online to portal. Thus we enable
505 // Chrome's detection by still marking |state_| to STATE_IDLE.
506 if (result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL &&
507 response_code == 200 &&
508 (!network || network->connection_state() != shill::kStateOnline)) {
509 state_ = STATE_BEHIND_PORTAL_IDLE;
510 } else {
511 state_ = STATE_IDLE;
512 }
502 attempt_timeout_.Cancel(); 513 attempt_timeout_.Cancel();
503 514
504 CaptivePortalState state; 515 CaptivePortalState state;
505 state.response_code = response_code; 516 state.response_code = response_code;
506 state.time = NowTicks(); 517 state.time = NowTicks();
507 switch (result) { 518 switch (result) {
508 case captive_portal::RESULT_NO_RESPONSE: 519 case captive_portal::RESULT_NO_RESPONSE:
509 if (state.response_code == net::HTTP_PROXY_AUTHENTICATION_REQUIRED) { 520 if (state.response_code == net::HTTP_PROXY_AUTHENTICATION_REQUIRED) {
510 state.status = CAPTIVE_PORTAL_STATUS_PROXY_AUTH_REQUIRED; 521 state.status = CAPTIVE_PORTAL_STATUS_PROXY_AUTH_REQUIRED;
511 } else if (network && network->is_captive_portal()) { 522 } else if (network && network->is_captive_portal()) {
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 } 658 }
648 659
649 void NetworkPortalDetectorImpl::ResetStrategyAndCounters() { 660 void NetworkPortalDetectorImpl::ResetStrategyAndCounters() {
650 last_detection_result_ = CAPTIVE_PORTAL_STATUS_UNKNOWN; 661 last_detection_result_ = CAPTIVE_PORTAL_STATUS_UNKNOWN;
651 same_detection_result_count_ = 0; 662 same_detection_result_count_ = 0;
652 no_response_result_count_ = 0; 663 no_response_result_count_ = 0;
653 strategy_->Reset(); 664 strategy_->Reset();
654 } 665 }
655 666
656 } // namespace chromeos 667 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698