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 // Provides wifi scan API binding for suitable for typical linux distributions. | 5 // Provides wifi scan API binding for suitable for typical linux distributions. |
6 // Currently, only the NetworkManager API is used, accessed via D-Bus (in turn | 6 // Currently, only the NetworkManager API is used, accessed via D-Bus (in turn |
7 // accessed via the GLib wrapper). | 7 // accessed via the GLib wrapper). |
8 | 8 |
9 #include "content/browser/geolocation/wifi_data_provider_linux.h" | 9 #include "content/browser/geolocation/wifi_data_provider_linux.h" |
10 | 10 |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 if (!response) | 239 if (!response) |
240 continue; | 240 continue; |
241 // The response should contain a variant that contains an array of bytes. | 241 // The response should contain a variant that contains an array of bytes. |
242 dbus::MessageReader reader(response.get()); | 242 dbus::MessageReader reader(response.get()); |
243 dbus::MessageReader variant_reader(response.get()); | 243 dbus::MessageReader variant_reader(response.get()); |
244 if (!reader.PopVariant(&variant_reader)) { | 244 if (!reader.PopVariant(&variant_reader)) { |
245 LOG(WARNING) << "Unexpected response for " << access_point_path.value() | 245 LOG(WARNING) << "Unexpected response for " << access_point_path.value() |
246 << ": " << response->ToString(); | 246 << ": " << response->ToString(); |
247 continue; | 247 continue; |
248 } | 248 } |
249 uint8* ssid_bytes = NULL; | 249 const uint8* ssid_bytes = NULL; |
250 size_t ssid_length = 0; | 250 size_t ssid_length = 0; |
251 if (!variant_reader.PopArrayOfBytes(&ssid_bytes, &ssid_length)) { | 251 if (!variant_reader.PopArrayOfBytes(&ssid_bytes, &ssid_length)) { |
252 LOG(WARNING) << "Unexpected response for " << access_point_path.value() | 252 LOG(WARNING) << "Unexpected response for " << access_point_path.value() |
253 << ": " << response->ToString(); | 253 << ": " << response->ToString(); |
254 continue; | 254 continue; |
255 } | 255 } |
256 std::string ssid(ssid_bytes, ssid_bytes + ssid_length); | 256 std::string ssid(ssid_bytes, ssid_bytes + ssid_length); |
257 access_point_data.ssid = base::UTF8ToUTF16(ssid); | 257 access_point_data.ssid = base::UTF8ToUTF16(ssid); |
258 } | 258 } |
259 | 259 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 | 371 |
372 WifiDataProviderCommon::WlanApiInterface* | 372 WifiDataProviderCommon::WlanApiInterface* |
373 WifiDataProviderLinux::NewWlanApiForTesting(dbus::Bus* bus) { | 373 WifiDataProviderLinux::NewWlanApiForTesting(dbus::Bus* bus) { |
374 scoped_ptr<NetworkManagerWlanApi> wlan_api(new NetworkManagerWlanApi); | 374 scoped_ptr<NetworkManagerWlanApi> wlan_api(new NetworkManagerWlanApi); |
375 if (wlan_api->InitWithBus(bus)) | 375 if (wlan_api->InitWithBus(bus)) |
376 return wlan_api.release(); | 376 return wlan_api.release(); |
377 return NULL; | 377 return NULL; |
378 } | 378 } |
379 | 379 |
380 } // namespace content | 380 } // namespace content |
OLD | NEW |