Index: chromeos/network/portal_detector/network_portal_detector_strategy.cc |
diff --git a/chromeos/network/portal_detector/network_portal_detector_strategy.cc b/chromeos/network/portal_detector/network_portal_detector_strategy.cc |
index 3ff54e58d12ca4f500199e250ad1788a2dd498af..6a860c958bf6689cac82f7e9932bf792f234f020 100644 |
--- a/chromeos/network/portal_detector/network_portal_detector_strategy.cc |
+++ b/chromeos/network/portal_detector/network_portal_detector_strategy.cc |
@@ -75,10 +75,14 @@ class ErrorScreenStrategy : public PortalDetectorStrategy { |
class SessionStrategy : public PortalDetectorStrategy { |
public: |
static const int kFastDelayBetweenAttemptsSec = 1; |
- static const int kMaxFastAttempts = 3; |
static const int kFastAttemptTimeoutSec = 3; |
+ static const int kMaxFastAttempts = 3; |
- static const int kSlowDelayBetweenAttemptsSec = 10; |
+ static const int kNormalDelayBetweenAttemptsSec = 10; |
+ static const int kNormalAttemptTimeoutSec = 5; |
+ static const int kMaxNormalAttempts = 3; |
+ |
+ static const int kSlowDelayBetweenAttemptsSec = 2 * 60; |
static const int kSlowAttemptTimeoutSec = 5; |
SessionStrategy() {} |
@@ -90,22 +94,34 @@ class SessionStrategy : public PortalDetectorStrategy { |
virtual bool CanPerformAttemptAfterDetectionImpl() OVERRIDE { return true; } |
virtual base::TimeDelta GetDelayTillNextAttemptImpl() OVERRIDE { |
int delay; |
- if (delegate_->AttemptCount() < kMaxFastAttempts) |
+ if (IsFastAttempt()) |
delay = kFastDelayBetweenAttemptsSec; |
+ else if (IsNormalAttempt()) |
+ delay = kNormalDelayBetweenAttemptsSec; |
else |
delay = kSlowDelayBetweenAttemptsSec; |
return AdjustDelay(base::TimeDelta::FromSeconds(delay)); |
} |
virtual base::TimeDelta GetNextAttemptTimeoutImpl() OVERRIDE { |
int timeout; |
- if (delegate_->AttemptCount() < kMaxFastAttempts) |
+ if (IsFastAttempt()) |
timeout = kFastAttemptTimeoutSec; |
+ else if (IsNormalAttempt()) |
+ timeout = kNormalAttemptTimeoutSec; |
else |
timeout = kSlowAttemptTimeoutSec; |
return base::TimeDelta::FromSeconds(timeout); |
} |
private: |
+ bool IsFastAttempt() { |
+ return delegate_->AttemptCount() < kMaxFastAttempts; |
+ } |
+ |
+ bool IsNormalAttempt() { |
+ return delegate_->AttemptCount() < kMaxFastAttempts + kMaxNormalAttempts; |
+ } |
+ |
DISALLOW_COPY_AND_ASSIGN(SessionStrategy); |
}; |