Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(392)

Side by Side Diff: content/browser/geolocation/wifi_data_provider_linux.cc

Issue 121033002: Update uses of UTF conversions in content/ to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 continue; 247 continue;
248 } 248 }
249 uint8* ssid_bytes = NULL; 249 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 = UTF8ToUTF16(ssid); 257 access_point_data.ssid = base::UTF8ToUTF16(ssid);
258 } 258 }
259 259
260 { // Read the mac address 260 { // Read the mac address
261 scoped_ptr<dbus::Response> response( 261 scoped_ptr<dbus::Response> response(
262 GetAccessPointProperty(access_point_proxy, "HwAddress")); 262 GetAccessPointProperty(access_point_proxy, "HwAddress"));
263 if (!response) 263 if (!response)
264 continue; 264 continue;
265 dbus::MessageReader reader(response.get()); 265 dbus::MessageReader reader(response.get());
266 std::string mac; 266 std::string mac;
267 if (!reader.PopVariantOfString(&mac)) { 267 if (!reader.PopVariantOfString(&mac)) {
268 LOG(WARNING) << "Unexpected response for " << access_point_path.value() 268 LOG(WARNING) << "Unexpected response for " << access_point_path.value()
269 << ": " << response->ToString(); 269 << ": " << response->ToString();
270 continue; 270 continue;
271 } 271 }
272 272
273 ReplaceSubstringsAfterOffset(&mac, 0U, ":", std::string()); 273 ReplaceSubstringsAfterOffset(&mac, 0U, ":", std::string());
274 std::vector<uint8> mac_bytes; 274 std::vector<uint8> mac_bytes;
275 if (!base::HexStringToBytes(mac, &mac_bytes) || mac_bytes.size() != 6) { 275 if (!base::HexStringToBytes(mac, &mac_bytes) || mac_bytes.size() != 6) {
276 LOG(WARNING) << "Can't parse mac address (found " << mac_bytes.size() 276 LOG(WARNING) << "Can't parse mac address (found " << mac_bytes.size()
277 << " bytes) so using raw string: " << mac; 277 << " bytes) so using raw string: " << mac;
278 access_point_data.mac_address = UTF8ToUTF16(mac); 278 access_point_data.mac_address = base::UTF8ToUTF16(mac);
279 } else { 279 } else {
280 access_point_data.mac_address = MacAddressAsString16(&mac_bytes[0]); 280 access_point_data.mac_address = MacAddressAsString16(&mac_bytes[0]);
281 } 281 }
282 } 282 }
283 283
284 { // Read signal strength. 284 { // Read signal strength.
285 scoped_ptr<dbus::Response> response( 285 scoped_ptr<dbus::Response> response(
286 GetAccessPointProperty(access_point_proxy, "Strength")); 286 GetAccessPointProperty(access_point_proxy, "Strength"));
287 if (!response) 287 if (!response)
288 continue; 288 continue;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698