OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_H_ | 5 #ifndef DEVICE_GEOLOCATION_WIFI_DATA_H_ |
6 #define CONTENT_BROWSER_GEOLOCATION_WIFI_DATA_H_ | 6 #define DEVICE_GEOLOCATION_WIFI_DATA_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
11 #include "content/common/content_export.h" | 11 #include "device/geolocation/geolocation_export.h" |
12 | 12 |
13 namespace content { | 13 namespace device { |
14 | 14 |
15 // Wifi data relating to a single access point. | 15 // Wifi data relating to a single access point. |
16 struct CONTENT_EXPORT AccessPointData { | 16 struct DEVICE_GEOLOCATION_EXPORT AccessPointData { |
17 AccessPointData(); | 17 AccessPointData(); |
18 ~AccessPointData(); | 18 ~AccessPointData(); |
19 | 19 |
20 // MAC address, formatted as per MacAddressAsString16. | 20 // MAC address, formatted as per MacAddressAsString16. |
21 base::string16 mac_address; | 21 base::string16 mac_address; |
22 int radio_signal_strength; // Measured in dBm | 22 int radio_signal_strength; // Measured in dBm |
23 int channel; | 23 int channel; |
24 int signal_to_noise; // Ratio in dB | 24 int signal_to_noise; // Ratio in dB |
25 base::string16 ssid; // Network identifier | 25 base::string16 ssid; // Network identifier |
26 }; | 26 }; |
27 | 27 |
28 // This is to allow AccessPointData to be used in std::set. We order | 28 // This is to allow AccessPointData to be used in std::set. We order |
29 // lexicographically by MAC address. | 29 // lexicographically by MAC address. |
30 struct AccessPointDataLess { | 30 struct AccessPointDataLess { |
31 bool operator()(const AccessPointData& data1, | 31 bool operator()(const AccessPointData& data1, |
32 const AccessPointData& data2) const { | 32 const AccessPointData& data2) const { |
33 return data1.mac_address < data2.mac_address; | 33 return data1.mac_address < data2.mac_address; |
34 } | 34 } |
35 }; | 35 }; |
36 | 36 |
37 // All data for wifi. | 37 // All data for wifi. |
38 struct CONTENT_EXPORT WifiData { | 38 struct DEVICE_GEOLOCATION_EXPORT WifiData { |
39 WifiData(); | 39 WifiData(); |
40 WifiData(const WifiData& other); | 40 WifiData(const WifiData& other); |
41 ~WifiData(); | 41 ~WifiData(); |
42 | 42 |
43 // Determines whether a new set of WiFi data differs significantly from this. | 43 // Determines whether a new set of WiFi data differs significantly from this. |
44 bool DiffersSignificantly(const WifiData& other) const; | 44 bool DiffersSignificantly(const WifiData& other) const; |
45 | 45 |
46 // Store access points as a set, sorted by MAC address. This allows quick | 46 // Store access points as a set, sorted by MAC address. This allows quick |
47 // comparison of sets for detecting changes and for caching. | 47 // comparison of sets for detecting changes and for caching. |
48 typedef std::set<AccessPointData, AccessPointDataLess> AccessPointDataSet; | 48 typedef std::set<AccessPointData, AccessPointDataLess> AccessPointDataSet; |
49 AccessPointDataSet access_point_data; | 49 AccessPointDataSet access_point_data; |
50 }; | 50 }; |
51 | 51 |
52 } // namespace content | 52 } // namespace device |
53 | 53 |
54 #endif // CONTENT_BROWSER_GEOLOCATION_WIFI_DATA_H_ | 54 #endif // DEVICE_GEOLOCATION_WIFI_DATA_H_ |
OLD | NEW |