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

Unified Diff: chrome/browser/chromeos/net/network_portal_detector_impl.cc

Issue 419463004: Increased delay before next portal detection attempt in the case of !ONLINE -> ONLINE transition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chromeos/network/portal_detector/network_portal_detector_strategy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/net/network_portal_detector_impl.cc
diff --git a/chrome/browser/chromeos/net/network_portal_detector_impl.cc b/chrome/browser/chromeos/net/network_portal_detector_impl.cc
index c2629417672556c365cf2633b2a8bcb72a69445c..e24efda67abb36db0c81e85bd0a09ee9a510b428 100644
--- a/chrome/browser/chromeos/net/network_portal_detector_impl.cc
+++ b/chrome/browser/chromeos/net/network_portal_detector_impl.cc
@@ -37,6 +37,14 @@ const int kProxyChangeDelaySec = 1;
// offline state in a row before notification is sent to observers.
const int kMaxOfflineResultsBeforeReport = 3;
+// Delay before portal detection attempt after ~ONLINE -> ~ONLINE
+// transition.
Denis Kuznetsov (DE-MUC) 2014/07/24 11:29:45 Long/Short, use ! instead of ~ for negation.
+const int kSmallInitialDelayBetweenAttemptsMs = 600;
+
+// Delay before portal detection attempt after ~ONLINE -> ONLINE
+// transition.
+const int kBigInitialDelayBetweenAttemptsMs = 3 * 1000;
+
const NetworkState* DefaultNetwork() {
return NetworkHandler::Get()->network_state_handler()->DefaultNetwork();
}
@@ -207,13 +215,12 @@ NetworkPortalDetectorImpl::NetworkPortalDetectorImpl(
test_url_(CaptivePortalDetector::kDefaultURL),
enabled_(false),
strategy_(PortalDetectorStrategy::CreateById(
- PortalDetectorStrategy::STRATEGY_ID_LOGIN_SCREEN)),
+ PortalDetectorStrategy::STRATEGY_ID_LOGIN_SCREEN, this)),
last_detection_result_(CAPTIVE_PORTAL_STATUS_UNKNOWN),
same_detection_result_count_(0),
no_response_result_count_(0),
weak_factory_(this) {
captive_portal_detector_.reset(new CaptivePortalDetector(request_context));
- strategy_->set_delegate(this);
registrar_.Add(this,
chrome::NOTIFICATION_LOGIN_PROXY_CHANGED,
@@ -309,8 +316,7 @@ void NetworkPortalDetectorImpl::SetStrategy(
PortalDetectorStrategy::StrategyId id) {
if (id == strategy_->Id())
return;
- strategy_.reset(PortalDetectorStrategy::CreateById(id).release());
- strategy_->set_delegate(this);
+ strategy_ = PortalDetectorStrategy::CreateById(id, this).Pass();
StopDetection();
StartDetectionIfIdle();
}
@@ -504,7 +510,10 @@ void NetworkPortalDetectorImpl::OnAttemptCompleted(
if (last_detection_result_ != state.status) {
last_detection_result_ = state.status;
same_detection_result_count_ = 1;
- strategy_->Reset();
+ if (state.status == CAPTIVE_PORTAL_STATUS_ONLINE)
+ strategy_->SetInitialDelayAndReset(kBigInitialDelayBetweenAttemptsMs);
+ else
+ strategy_->SetInitialDelayAndReset(kSmallInitialDelayBetweenAttemptsMs);
} else {
++same_detection_result_count_;
}
« no previous file with comments | « no previous file | chromeos/network/portal_detector/network_portal_detector_strategy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698