| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef CHROME_BROWSER_GEOLOCATION_WIFI_DATA_PROVIDER_COMMON_H_ | 5 #ifndef CHROME_BROWSER_GEOLOCATION_WIFI_DATA_PROVIDER_COMMON_H_ |
| 6 #define CHROME_BROWSER_GEOLOCATION_WIFI_DATA_PROVIDER_COMMON_H_ | 6 #define CHROME_BROWSER_GEOLOCATION_WIFI_DATA_PROVIDER_COMMON_H_ |
| 7 | 7 |
| 8 #include <assert.h> | 8 #include <assert.h> |
| 9 | 9 |
| 10 #include "base/logging.h" | |
| 11 #include "base/string16.h" | 10 #include "base/string16.h" |
| 12 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 13 | 12 |
| 14 // Converts a MAC address stored as an array of uint8 to a string. | 13 // Converts a MAC address stored as an array of uint8 to a string. |
| 15 string16 MacAddressAsString16(const uint8 mac_as_int[6]); | 14 string16 MacAddressAsString16(const uint8 mac_as_int[6]); |
| 16 | 15 |
| 17 // Allows sharing and mocking of the update polling policy function. | 16 // Allows sharing and mocking of the update polling policy function. |
| 18 class PollingPolicyInterface { | 17 class PollingPolicyInterface { |
| 19 public: | 18 public: |
| 20 virtual ~PollingPolicyInterface() {} | 19 virtual ~PollingPolicyInterface() {} |
| (...skipping 11 matching lines...) Expand all Loading... |
| 32 class GenericPollingPolicy : public PollingPolicyInterface { | 31 class GenericPollingPolicy : public PollingPolicyInterface { |
| 33 public: | 32 public: |
| 34 GenericPollingPolicy() : polling_interval_(DEFAULT_INTERVAL) {} | 33 GenericPollingPolicy() : polling_interval_(DEFAULT_INTERVAL) {} |
| 35 // PollingPolicyInterface | 34 // PollingPolicyInterface |
| 36 virtual void UpdatePollingInterval(bool scan_results_differ) { | 35 virtual void UpdatePollingInterval(bool scan_results_differ) { |
| 37 if (scan_results_differ) { | 36 if (scan_results_differ) { |
| 38 polling_interval_ = DEFAULT_INTERVAL; | 37 polling_interval_ = DEFAULT_INTERVAL; |
| 39 } else if (polling_interval_ == DEFAULT_INTERVAL) { | 38 } else if (polling_interval_ == DEFAULT_INTERVAL) { |
| 40 polling_interval_ = NO_CHANGE_INTERVAL; | 39 polling_interval_ = NO_CHANGE_INTERVAL; |
| 41 } else { | 40 } else { |
| 42 DCHECK(polling_interval_ == NO_CHANGE_INTERVAL || | 41 assert(polling_interval_ == NO_CHANGE_INTERVAL || |
| 43 polling_interval_ == TWO_NO_CHANGE_INTERVAL); | 42 polling_interval_ == TWO_NO_CHANGE_INTERVAL); |
| 44 polling_interval_ = TWO_NO_CHANGE_INTERVAL; | 43 polling_interval_ = TWO_NO_CHANGE_INTERVAL; |
| 45 } | 44 } |
| 46 } | 45 } |
| 47 virtual int PollingInterval() { return polling_interval_; } | 46 virtual int PollingInterval() { return polling_interval_; } |
| 48 | 47 |
| 49 private: | 48 private: |
| 50 int polling_interval_; | 49 int polling_interval_; |
| 51 }; | 50 }; |
| 52 | 51 |
| 53 #endif // CHROME_BROWSER_GEOLOCATION_WIFI_DATA_PROVIDER_COMMON_H_ | 52 #endif // CHROME_BROWSER_GEOLOCATION_WIFI_DATA_PROVIDER_COMMON_H_ |
| OLD | NEW |