Index: chrome/browser/chromeos/net/network_portal_detector.h |
diff --git a/chrome/browser/chromeos/net/network_portal_detector.h b/chrome/browser/chromeos/net/network_portal_detector.h |
index 1c68a0ad83ad5a1b7c225c4568a24df741b61518..d052128750f0645b46c4b804f9ca35ec88a0c02a 100644 |
--- a/chrome/browser/chromeos/net/network_portal_detector.h |
+++ b/chrome/browser/chromeos/net/network_portal_detector.h |
@@ -86,6 +86,13 @@ class NetworkPortalDetector |
virtual void OnNetworkChanged(chromeos::NetworkLibrary* cros, |
const chromeos::Network* network) OVERRIDE; |
+ // Enables lazy detection mode. In this mode portal detection after |
+ // first 3 consecutive attemps will be performed once in 30 seconds. |
+ void EnableLazyDetection(); |
+ |
+ // Dizables lazy detection mode. |
+ void DisableLazyDetection(); |
+ |
// Creates an instance of the NetworkPortalDetector. |
static NetworkPortalDetector* CreateInstance(); |
@@ -129,6 +136,10 @@ class NetworkPortalDetector |
void OnPortalDetectionCompleted( |
const captive_portal::CaptivePortalDetector::Results& results); |
+ // Tries to perform portal detection in "lazy" mode. Does nothing in |
+ // the case of already pending/processing detection request. |
+ void TryLazyDetection(); |
+ |
// content::NotificationObserver implementation: |
virtual void Observe(int type, |
const content::NotificationSource& source, |
@@ -163,6 +174,12 @@ class NetworkPortalDetector |
min_time_between_attempts_ = delta; |
} |
+ // Sets default interval between consecutive portal checks for a |
+ // network in portal state. Used by unit tests. |
+ void set_lazy_check_interval_for_testing(const base::TimeDelta& delta) { |
+ lazy_check_interval_ = delta; |
+ } |
+ |
// Sets portal detection timeout. Used by unit tests. |
void set_request_timeout_for_testing(const base::TimeDelta& timeout) { |
request_timeout_ = timeout; |
@@ -210,6 +227,13 @@ class NetworkPortalDetector |
// Number of portal detection attemps for an active network. |
int attempt_count_; |
+ // True if lazy detection is enabled. |
+ bool lazy_detection_enabled_; |
+ |
+ // Time between consecutive portal checks for a network in lazy |
+ // mode. |
+ base::TimeDelta lazy_check_interval_; |
+ |
// Minimum time between consecutive portal checks for the same |
// active network. |
base::TimeDelta min_time_between_attempts_; |