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 #include "device/geolocation/network_location_request.h" | 5 #include "device/geolocation/network_location_request.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <limits> | 9 #include <limits> |
10 #include <set> | 10 #include <set> |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 return; | 243 return; |
244 | 244 |
245 typedef std::multiset<const AccessPointData*, AccessPointLess> AccessPointSet; | 245 typedef std::multiset<const AccessPointData*, AccessPointLess> AccessPointSet; |
246 AccessPointSet access_points_by_signal_strength; | 246 AccessPointSet access_points_by_signal_strength; |
247 | 247 |
248 for (const auto& ap_data : wifi_data.access_point_data) | 248 for (const auto& ap_data : wifi_data.access_point_data) |
249 access_points_by_signal_strength.insert(&ap_data); | 249 access_points_by_signal_strength.insert(&ap_data); |
250 | 250 |
251 base::ListValue* wifi_access_point_list = new base::ListValue(); | 251 base::ListValue* wifi_access_point_list = new base::ListValue(); |
252 for (auto* ap_data : access_points_by_signal_strength) { | 252 for (auto* ap_data : access_points_by_signal_strength) { |
253 base::DictionaryValue* wifi_dict = new base::DictionaryValue(); | 253 std::unique_ptr<base::DictionaryValue> wifi_dict( |
254 AddString("macAddress", base::UTF16ToUTF8(ap_data->mac_address), wifi_dict); | 254 new base::DictionaryValue()); |
255 AddInteger("signalStrength", ap_data->radio_signal_strength, wifi_dict); | 255 AddString("macAddress", base::UTF16ToUTF8(ap_data->mac_address), |
256 AddInteger("age", age_milliseconds, wifi_dict); | 256 wifi_dict.get()); |
257 AddInteger("channel", ap_data->channel, wifi_dict); | 257 AddInteger("signalStrength", ap_data->radio_signal_strength, |
258 AddInteger("signalToNoiseRatio", ap_data->signal_to_noise, wifi_dict); | 258 wifi_dict.get()); |
259 wifi_access_point_list->Append(wifi_dict); | 259 AddInteger("age", age_milliseconds, wifi_dict.get()); |
| 260 AddInteger("channel", ap_data->channel, wifi_dict.get()); |
| 261 AddInteger("signalToNoiseRatio", ap_data->signal_to_noise, wifi_dict.get()); |
| 262 wifi_access_point_list->Append(std::move(wifi_dict)); |
260 } | 263 } |
261 request->Set("wifiAccessPoints", wifi_access_point_list); | 264 request->Set("wifiAccessPoints", wifi_access_point_list); |
262 } | 265 } |
263 | 266 |
264 void FormatPositionError(const GURL& server_url, | 267 void FormatPositionError(const GURL& server_url, |
265 const std::string& message, | 268 const std::string& message, |
266 Geoposition* position) { | 269 Geoposition* position) { |
267 position->error_code = Geoposition::ERROR_CODE_POSITION_UNAVAILABLE; | 270 position->error_code = Geoposition::ERROR_CODE_POSITION_UNAVAILABLE; |
268 position->error_message = "Network location provider at '"; | 271 position->error_message = "Network location provider at '"; |
269 position->error_message += server_url.GetOrigin().spec(); | 272 position->error_message += server_url.GetOrigin().spec(); |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 | 416 |
414 // Other fields are optional. | 417 // Other fields are optional. |
415 GetAsDouble(*response_object, kAccuracyString, &position->accuracy); | 418 GetAsDouble(*response_object, kAccuracyString, &position->accuracy); |
416 | 419 |
417 return true; | 420 return true; |
418 } | 421 } |
419 | 422 |
420 } // namespace | 423 } // namespace |
421 | 424 |
422 } // namespace device | 425 } // namespace device |
OLD | NEW |