| Index: content/browser/geolocation/wifi_data_provider_common.h
|
| diff --git a/content/browser/geolocation/wifi_data_provider_common.h b/content/browser/geolocation/wifi_data_provider_common.h
|
| index 5f15e0919bf3e0c558ae970f965fc01ff68aee44..bf891e9236f0bb35d60aba0e8c3f88f56907fcd8 100644
|
| --- a/content/browser/geolocation/wifi_data_provider_common.h
|
| +++ b/content/browser/geolocation/wifi_data_provider_common.h
|
| @@ -12,6 +12,7 @@
|
| #include "base/memory/weak_ptr.h"
|
| #include "base/strings/string16.h"
|
| #include "content/browser/geolocation/wifi_data_provider.h"
|
| +#include "content/browser/geolocation/wifi_polling_policy.h"
|
| #include "content/common/content_export.h"
|
|
|
| namespace content {
|
| @@ -19,45 +20,6 @@ namespace content {
|
| // Converts a MAC address stored as an array of uint8 to a string.
|
| string16 MacAddressAsString16(const uint8 mac_as_int[6]);
|
|
|
| -// Allows sharing and mocking of the update polling policy function.
|
| -class PollingPolicyInterface {
|
| - public:
|
| - virtual ~PollingPolicyInterface() {}
|
| - // Calculates the new polling interval for wiFi scans, given the previous
|
| - // interval and whether the last scan produced new results.
|
| - virtual void UpdatePollingInterval(bool scan_results_differ) = 0;
|
| - virtual int PollingInterval() = 0;
|
| - virtual int NoWifiInterval() = 0;
|
| -};
|
| -
|
| -// Generic polling policy, constants are compile-time parameterized to allow
|
| -// tuning on a per-platform basis.
|
| -template<int DEFAULT_INTERVAL,
|
| - int NO_CHANGE_INTERVAL,
|
| - int TWO_NO_CHANGE_INTERVAL,
|
| - int NO_WIFI_INTERVAL>
|
| -class GenericPollingPolicy : public PollingPolicyInterface {
|
| - public:
|
| - GenericPollingPolicy() : polling_interval_(DEFAULT_INTERVAL) {}
|
| - // PollingPolicyInterface
|
| - virtual void UpdatePollingInterval(bool scan_results_differ) {
|
| - if (scan_results_differ) {
|
| - polling_interval_ = DEFAULT_INTERVAL;
|
| - } else if (polling_interval_ == DEFAULT_INTERVAL) {
|
| - polling_interval_ = NO_CHANGE_INTERVAL;
|
| - } else {
|
| - DCHECK(polling_interval_ == NO_CHANGE_INTERVAL ||
|
| - polling_interval_ == TWO_NO_CHANGE_INTERVAL);
|
| - polling_interval_ = TWO_NO_CHANGE_INTERVAL;
|
| - }
|
| - }
|
| - virtual int PollingInterval() { return polling_interval_; }
|
| - virtual int NoWifiInterval() { return NO_WIFI_INTERVAL; }
|
| -
|
| - private:
|
| - int polling_interval_;
|
| -};
|
| -
|
| // Base class to promote code sharing between platform specific wifi data
|
| // providers. It's optional for specific platforms to derive this, but if they
|
| // do polling behavior is taken care of by this base class, and all the platform
|
|
|