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 DEVICE_GEOLOCATION_WIFI_DATA_PROVIDER_COMMON_H_ | 5 #ifndef CONTENT_BROWSER_GEOLOCATION_WIFI_DATA_PROVIDER_COMMON_H_ |
6 #define DEVICE_GEOLOCATION_WIFI_DATA_PROVIDER_COMMON_H_ | 6 #define CONTENT_BROWSER_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 "device/geolocation/geolocation_export.h" | 17 #include "content/browser/geolocation/wifi_data_provider.h" |
18 #include "device/geolocation/wifi_data_provider.h" | 18 #include "content/browser/geolocation/wifi_polling_policy.h" |
19 #include "device/geolocation/wifi_polling_policy.h" | 19 #include "content/common/content_export.h" |
20 | 20 |
21 namespace device { | 21 namespace content { |
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 DEVICE_GEOLOCATION_EXPORT WifiDataProviderCommon | 31 class CONTENT_EXPORT WifiDataProviderCommon : public WifiDataProvider { |
32 : public WifiDataProvider { | |
33 public: | 32 public: |
34 // Interface to abstract the low level data OS library call, and to allow | 33 // Interface to abstract the low level data OS library call, and to allow |
35 // mocking (hence public). | 34 // mocking (hence public). |
36 class WlanApiInterface { | 35 class WlanApiInterface { |
37 public: | 36 public: |
38 virtual ~WlanApiInterface() {} | 37 virtual ~WlanApiInterface() {} |
39 // Gets wifi data for all visible access points. | 38 // Gets wifi data for all visible access points. |
40 virtual bool GetAccessPointData(WifiData::AccessPointDataSet* data) = 0; | 39 virtual bool GetAccessPointData(WifiData::AccessPointDataSet* data) = 0; |
41 }; | 40 }; |
42 | 41 |
(...skipping 30 matching lines...) Expand all Loading... |
73 | 72 |
74 // Controls the polling update interval. | 73 // Controls the polling update interval. |
75 std::unique_ptr<WifiPollingPolicy> polling_policy_; | 74 std::unique_ptr<WifiPollingPolicy> polling_policy_; |
76 | 75 |
77 // Holder for delayed tasks; takes care of cleanup. | 76 // Holder for delayed tasks; takes care of cleanup. |
78 base::WeakPtrFactory<WifiDataProviderCommon> weak_factory_; | 77 base::WeakPtrFactory<WifiDataProviderCommon> weak_factory_; |
79 | 78 |
80 DISALLOW_COPY_AND_ASSIGN(WifiDataProviderCommon); | 79 DISALLOW_COPY_AND_ASSIGN(WifiDataProviderCommon); |
81 }; | 80 }; |
82 | 81 |
83 } // namespace device | 82 } // namespace content |
84 | 83 |
85 #endif // DEVICE_GEOLOCATION_WIFI_DATA_PROVIDER_COMMON_H_ | 84 #endif // CONTENT_BROWSER_GEOLOCATION_WIFI_DATA_PROVIDER_COMMON_H_ |
OLD | NEW |