| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_BROWSER_GEOLOCATION_WIFI_DATA_PROVIDER_COMMON_H_ | 5 #ifndef DEVICE_GEOLOCATION_WIFI_DATA_PROVIDER_COMMON_H_ |
| 6 #define CONTENT_BROWSER_GEOLOCATION_WIFI_DATA_PROVIDER_COMMON_H_ | 6 #define DEVICE_GEOLOCATION_WIFI_DATA_PROVIDER_COMMON_H_ |
| 7 | 7 |
| 8 #include <assert.h> | 8 #include <assert.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <memory> | 11 #include <memory> |
| 12 | 12 |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/strings/string16.h" | 16 #include "base/strings/string16.h" |
| 17 #include "content/browser/geolocation/wifi_data_provider.h" | 17 #include "device/geolocation/geolocation_export.h" |
| 18 #include "content/browser/geolocation/wifi_polling_policy.h" | 18 #include "device/geolocation/wifi_data_provider.h" |
| 19 #include "content/common/content_export.h" | 19 #include "device/geolocation/wifi_polling_policy.h" |
| 20 | 20 |
| 21 namespace content { | 21 namespace device { |
| 22 | 22 |
| 23 // Converts a MAC address stored as an array of uint8_t to a string. | 23 // Converts a MAC address stored as an array of uint8_t to a string. |
| 24 base::string16 MacAddressAsString16(const uint8_t mac_as_int[6]); | 24 base::string16 MacAddressAsString16(const uint8_t mac_as_int[6]); |
| 25 | 25 |
| 26 // Base class to promote code sharing between platform specific wifi data | 26 // Base class to promote code sharing between platform specific wifi data |
| 27 // providers. It's optional for specific platforms to derive this, but if they | 27 // providers. It's optional for specific platforms to derive this, but if they |
| 28 // do polling behavior is taken care of by this base class, and all the platform | 28 // do polling behavior is taken care of by this base class, and all the platform |
| 29 // need do is provide the underlying WLAN access API and polling policy. | 29 // need do is provide the underlying WLAN access API and polling policy. |
| 30 // Also designed this way for ease of testing the cross-platform behavior. | 30 // Also designed this way for ease of testing the cross-platform behavior. |
| 31 class CONTENT_EXPORT WifiDataProviderCommon : public WifiDataProvider { | 31 class DEVICE_GEOLOCATION_EXPORT WifiDataProviderCommon |
| 32 : public WifiDataProvider { |
| 32 public: | 33 public: |
| 33 // Interface to abstract the low level data OS library call, and to allow | 34 // Interface to abstract the low level data OS library call, and to allow |
| 34 // mocking (hence public). | 35 // mocking (hence public). |
| 35 class WlanApiInterface { | 36 class WlanApiInterface { |
| 36 public: | 37 public: |
| 37 virtual ~WlanApiInterface() {} | 38 virtual ~WlanApiInterface() {} |
| 38 // Gets wifi data for all visible access points. | 39 // Gets wifi data for all visible access points. |
| 39 virtual bool GetAccessPointData(WifiData::AccessPointDataSet* data) = 0; | 40 virtual bool GetAccessPointData(WifiData::AccessPointDataSet* data) = 0; |
| 40 }; | 41 }; |
| 41 | 42 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 72 | 73 |
| 73 // Controls the polling update interval. | 74 // Controls the polling update interval. |
| 74 std::unique_ptr<WifiPollingPolicy> polling_policy_; | 75 std::unique_ptr<WifiPollingPolicy> polling_policy_; |
| 75 | 76 |
| 76 // Holder for delayed tasks; takes care of cleanup. | 77 // Holder for delayed tasks; takes care of cleanup. |
| 77 base::WeakPtrFactory<WifiDataProviderCommon> weak_factory_; | 78 base::WeakPtrFactory<WifiDataProviderCommon> weak_factory_; |
| 78 | 79 |
| 79 DISALLOW_COPY_AND_ASSIGN(WifiDataProviderCommon); | 80 DISALLOW_COPY_AND_ASSIGN(WifiDataProviderCommon); |
| 80 }; | 81 }; |
| 81 | 82 |
| 82 } // namespace content | 83 } // namespace device |
| 83 | 84 |
| 84 #endif // CONTENT_BROWSER_GEOLOCATION_WIFI_DATA_PROVIDER_COMMON_H_ | 85 #endif // DEVICE_GEOLOCATION_WIFI_DATA_PROVIDER_COMMON_H_ |
| OLD | NEW |