| Index: content/browser/geolocation/wifi_data_provider_linux.cc
|
| ===================================================================
|
| --- content/browser/geolocation/wifi_data_provider_linux.cc (revision 121922)
|
| +++ content/browser/geolocation/wifi_data_provider_linux.cc (working copy)
|
| @@ -1,4 +1,4 @@
|
| -// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| @@ -13,7 +13,6 @@
|
| #include "base/utf_string_conversions.h"
|
| #include "dbus/bus.h"
|
| #include "dbus/message.h"
|
| -#include "dbus/object_path.h"
|
| #include "dbus/object_proxy.h"
|
|
|
| namespace {
|
| @@ -57,12 +56,12 @@
|
| private:
|
| // Enumerates the list of available network adapter devices known to
|
| // NetworkManager. Return true on success.
|
| - bool GetAdapterDeviceList(std::vector<dbus::ObjectPath>* device_paths);
|
| + bool GetAdapterDeviceList(std::vector<std::string>* device_paths);
|
|
|
| // Given the NetworkManager path to a wireless adapater, dumps the wifi scan
|
| // results and appends them to |data|. Returns false if a fatal error is
|
| // encountered such that the data set could not be populated.
|
| - bool GetAccessPointsForAdapter(const dbus::ObjectPath& adapter_path,
|
| + bool GetAccessPointsForAdapter(const std::string& adapter_path,
|
| WifiData::AccessPointDataSet* data);
|
|
|
| // Internal method used by |GetAccessPointsForAdapter|, given a wifi access
|
| @@ -111,9 +110,9 @@
|
| // system_bus_ will own all object proxies created from the bus.
|
| network_manager_proxy_ =
|
| system_bus_->GetObjectProxy(kNetworkManagerServiceName,
|
| - dbus::ObjectPath(kNetworkManagerPath));
|
| + kNetworkManagerPath);
|
| // Validate the proxy object by checking we can enumerate devices.
|
| - std::vector<dbus::ObjectPath> adapter_paths;
|
| + std::vector<std::string> adapter_paths;
|
| const bool success = GetAdapterDeviceList(&adapter_paths);
|
| VLOG(1) << "Init() result: " << success;
|
| return success;
|
| @@ -121,7 +120,7 @@
|
|
|
| bool NetworkManagerWlanApi::GetAccessPointData(
|
| WifiData::AccessPointDataSet* data) {
|
| - std::vector<dbus::ObjectPath> device_paths;
|
| + std::vector<std::string> device_paths;
|
| if (!GetAdapterDeviceList(&device_paths)) {
|
| LOG(WARNING) << "Could not enumerate access points";
|
| return false;
|
| @@ -131,8 +130,8 @@
|
|
|
| // Iterate the devices, getting APs for each wireless adapter found
|
| for (size_t i = 0; i < device_paths.size(); ++i) {
|
| - const dbus::ObjectPath& device_path = device_paths[i];
|
| - VLOG(1) << "Checking device: " << device_path.value();
|
| + const std::string& device_path = device_paths[i];
|
| + VLOG(1) << "Checking device: " << device_path;
|
|
|
| dbus::ObjectProxy* device_proxy =
|
| system_bus_->GetObjectProxy(kNetworkManagerServiceName,
|
| @@ -147,8 +146,7 @@
|
| &method_call,
|
| dbus::ObjectProxy::TIMEOUT_USE_DEFAULT));
|
| if (!response.get()) {
|
| - LOG(WARNING) << "Failed to get the device type for "
|
| - << device_path.value();
|
| + LOG(WARNING) << "Failed to get the device type for " << device_path;
|
| continue; // Check the next device.
|
| }
|
| dbus::MessageReader reader(response.get());
|
| @@ -172,7 +170,7 @@
|
| }
|
|
|
| bool NetworkManagerWlanApi::GetAdapterDeviceList(
|
| - std::vector<dbus::ObjectPath>* device_paths) {
|
| + std::vector<std::string>* device_paths) {
|
| dbus::MethodCall method_call(kNetworkManagerInterface, "GetDevices");
|
| scoped_ptr<dbus::Response> response(
|
| network_manager_proxy_->CallMethodAndBlock(
|
| @@ -193,7 +191,7 @@
|
|
|
|
|
| bool NetworkManagerWlanApi::GetAccessPointsForAdapter(
|
| - const dbus::ObjectPath& adapter_path, WifiData::AccessPointDataSet* data) {
|
| + const std::string& adapter_path, WifiData::AccessPointDataSet* data) {
|
| // Create a proxy object for this wifi adapter, and ask it to do a scan
|
| // (or at least, dump its scan results).
|
| dbus::ObjectProxy* device_proxy =
|
| @@ -207,24 +205,23 @@
|
| &method_call,
|
| dbus::ObjectProxy::TIMEOUT_USE_DEFAULT));
|
| if (!response.get()) {
|
| - LOG(WARNING) << "Failed to get access points data for "
|
| - << adapter_path.value();
|
| + LOG(WARNING) << "Failed to get access points data for " << adapter_path;
|
| return false;
|
| }
|
| dbus::MessageReader reader(response.get());
|
| - std::vector<dbus::ObjectPath> access_point_paths;
|
| + std::vector<std::string> access_point_paths;
|
| if (!reader.PopArrayOfObjectPaths(&access_point_paths)) {
|
| - LOG(WARNING) << "Unexpected response for " << adapter_path.value() << ": "
|
| + LOG(WARNING) << "Unexpected response for " << adapter_path << ": "
|
| << response->ToString();
|
| return false;
|
| }
|
|
|
| - VLOG(1) << "Wireless adapter " << adapter_path.value() << " found "
|
| + VLOG(1) << "Wireless adapter " << adapter_path << " found "
|
| << access_point_paths.size() << " access points.";
|
|
|
| for (size_t i = 0; i < access_point_paths.size(); ++i) {
|
| - const dbus::ObjectPath& access_point_path = access_point_paths[i];
|
| - VLOG(1) << "Checking access point: " << access_point_path.value();
|
| + const std::string& access_point_path = access_point_paths[i];
|
| + VLOG(1) << "Checking access point: " << access_point_path;
|
|
|
| dbus::ObjectProxy* access_point_proxy =
|
| system_bus_->GetObjectProxy(kNetworkManagerServiceName,
|
| @@ -240,15 +237,15 @@
|
| dbus::MessageReader reader(response.get());
|
| dbus::MessageReader variant_reader(response.get());
|
| if (!reader.PopVariant(&variant_reader)) {
|
| - LOG(WARNING) << "Unexpected response for " << access_point_path.value()
|
| - << ": " << response->ToString();
|
| + LOG(WARNING) << "Unexpected response for " << access_point_path << ": "
|
| + << response->ToString();
|
| continue;
|
| }
|
| uint8* ssid_bytes = NULL;
|
| size_t ssid_length = 0;
|
| if (!variant_reader.PopArrayOfBytes(&ssid_bytes, &ssid_length)) {
|
| - LOG(WARNING) << "Unexpected response for " << access_point_path.value()
|
| - << ": " << response->ToString();
|
| + LOG(WARNING) << "Unexpected response for " << access_point_path << ": "
|
| + << response->ToString();
|
| continue;
|
| }
|
| std::string ssid(ssid_bytes, ssid_bytes + ssid_length);
|
| @@ -263,8 +260,8 @@
|
| dbus::MessageReader reader(response.get());
|
| std::string mac;
|
| if (!reader.PopVariantOfString(&mac)) {
|
| - LOG(WARNING) << "Unexpected response for " << access_point_path.value()
|
| - << ": " << response->ToString();
|
| + LOG(WARNING) << "Unexpected response for " << access_point_path << ": "
|
| + << response->ToString();
|
| continue;
|
| }
|
|
|
| @@ -287,8 +284,8 @@
|
| dbus::MessageReader reader(response.get());
|
| uint8 strength = 0;
|
| if (!reader.PopVariantOfByte(&strength)) {
|
| - LOG(WARNING) << "Unexpected response for " << access_point_path.value()
|
| - << ": " << response->ToString();
|
| + LOG(WARNING) << "Unexpected response for " << access_point_path << ": "
|
| + << response->ToString();
|
| continue;
|
| }
|
| // Convert strength as a percentage into dBs.
|
| @@ -303,8 +300,8 @@
|
| dbus::MessageReader reader(response.get());
|
| uint32 frequency = 0;
|
| if (!reader.PopVariantOfUint32(&frequency)) {
|
| - LOG(WARNING) << "Unexpected response for " << access_point_path.value()
|
| - << ": " << response->ToString();
|
| + LOG(WARNING) << "Unexpected response for " << access_point_path << ": "
|
| + << response->ToString();
|
| continue;
|
| }
|
|
|
| @@ -312,7 +309,7 @@
|
| access_point_data.channel =
|
| frquency_in_khz_to_channel(frequency * 1000);
|
| }
|
| - VLOG(1) << "Access point data of " << access_point_path.value() << ": "
|
| + VLOG(1) << "Access point data of " << access_point_path << ": "
|
| << "SSID: " << access_point_data.ssid << ", "
|
| << "MAC: " << access_point_data.mac_address << ", "
|
| << "Strength: " << access_point_data.radio_signal_strength << ", "
|
|
|