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