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

Unified Diff: chrome/browser/chromeos/dbus/bluetooth_adapter_client.cc

Issue 9378039: dbus: add ObjectPath type (Closed) Base URL: http://git.chromium.org/git/chromium/src@master
Patch Set: added inequality operator Created 8 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/dbus/bluetooth_adapter_client.cc
diff --git a/chrome/browser/chromeos/dbus/bluetooth_adapter_client.cc b/chrome/browser/chromeos/dbus/bluetooth_adapter_client.cc
index 54b772de92e5b296f7855c87925ee57d16378793..f7d203a21787eb5ad3f2390cd1ab5c0519ded183 100644
--- a/chrome/browser/chromeos/dbus/bluetooth_adapter_client.cc
+++ b/chrome/browser/chromeos/dbus/bluetooth_adapter_client.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/chromeos/system/runtime_environment.h"
#include "dbus/bus.h"
#include "dbus/message.h"
+#include "dbus/object_path.h"
#include "dbus/object_proxy.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
@@ -142,11 +143,11 @@ bool PopArrayOfDictEntries(dbus::MessageReader* reader,
break;
}
case dbus::Message::OBJECT_PATH: {
- std::string value;
+ dbus::ObjectPath value;
if (!variant_reader.PopObjectPath(&value)) {
return false;
}
- dictionary->SetString(key, value);
+ dictionary->SetString(key, value.value());
break;
}
case dbus::Message::ARRAY: {
@@ -208,7 +209,7 @@ class BluetoothAdapterClientImpl: public BluetoothAdapterClient,
}
// BluetoothAdapterClient override.
- virtual void StartDiscovery(const std::string& object_path) {
+ virtual void StartDiscovery(const dbus::ObjectPath& object_path) {
VLOG(1) << "StartDiscovery: " << object_path;
dbus::MethodCall method_call(
@@ -225,7 +226,7 @@ class BluetoothAdapterClientImpl: public BluetoothAdapterClient,
}
// BluetoothAdapterClient override.
- virtual void StopDiscovery(const std::string& object_path) {
+ virtual void StopDiscovery(const dbus::ObjectPath& object_path) {
VLOG(1) << "StopDiscovery: " << object_path;
dbus::MethodCall method_call(
@@ -243,12 +244,12 @@ class BluetoothAdapterClientImpl: public BluetoothAdapterClient,
private:
// BluetoothManagerClient::Observer override.
- virtual void AdapterAdded(const std::string& object_path) OVERRIDE {
+ virtual void AdapterAdded(const dbus::ObjectPath& object_path) OVERRIDE {
VLOG(1) << "AdapterAdded: " << object_path;
}
// BluetoothManagerClient::Observer override.
- virtual void AdapterRemoved(const std::string& object_path) OVERRIDE {
+ virtual void AdapterRemoved(const dbus::ObjectPath& object_path) OVERRIDE {
VLOG(1) << "AdapterRemoved: " << object_path;
RemoveObjectProxyForPath(object_path);
}
@@ -256,7 +257,8 @@ class BluetoothAdapterClientImpl: public BluetoothAdapterClient,
// Ensures that we have a dbus object proxy for an adapter with dbus
// object path |object_path|, and if not, creates it and stores it in
// our |proxy_map_| map.
- dbus::ObjectProxy* GetObjectProxyForPath(const std::string& object_path) {
+ dbus::ObjectProxy* GetObjectProxyForPath(
+ const dbus::ObjectPath& object_path) {
VLOG(1) << "GetObjectProxyForPath: " << object_path;
ProxyMap::iterator it = proxy_map_.find(object_path);
@@ -314,17 +316,17 @@ class BluetoothAdapterClientImpl: public BluetoothAdapterClient,
// Removes the dbus object proxy for the adapter with dbus object path
// |object_path| from our |proxy_map_| map.
- void RemoveObjectProxyForPath(const std::string& object_path) {
+ void RemoveObjectProxyForPath(const dbus::ObjectPath& object_path) {
VLOG(1) << "RemoveObjectProxyForPath: " << object_path;
proxy_map_.erase(object_path);
}
// Called by dbus:: when a DeviceCreated signal is received.
- void DeviceCreatedReceived(const std::string& object_path,
+ void DeviceCreatedReceived(const dbus::ObjectPath& object_path,
dbus::Signal* signal) {
DCHECK(signal);
dbus::MessageReader reader(signal);
- std::string device_path;
+ dbus::ObjectPath device_path;
if (!reader.PopObjectPath(&device_path)) {
LOG(ERROR) << object_path
<< ": DeviceCreated signal has incorrect parameters: "
@@ -338,7 +340,7 @@ class BluetoothAdapterClientImpl: public BluetoothAdapterClient,
}
// Called by dbus:: when the DeviceCreated signal is initially connected.
- void DeviceCreatedConnected(const std::string& object_path,
+ void DeviceCreatedConnected(const dbus::ObjectPath& object_path,
const std::string& interface_name,
const std::string& signal_name,
bool success) {
@@ -347,11 +349,11 @@ class BluetoothAdapterClientImpl: public BluetoothAdapterClient,
}
// Called by dbus:: when a DeviceRemoved signal is received.
- void DeviceRemovedReceived(const std::string& object_path,
+ void DeviceRemovedReceived(const dbus::ObjectPath& object_path,
dbus::Signal* signal) {
DCHECK(signal);
dbus::MessageReader reader(signal);
- std::string device_path;
+ dbus::ObjectPath device_path;
if (!reader.PopObjectPath(&device_path)) {
LOG(ERROR) << object_path
<< ": DeviceRemoved signal has incorrect parameters: "
@@ -365,7 +367,7 @@ class BluetoothAdapterClientImpl: public BluetoothAdapterClient,
}
// Called by dbus:: when the DeviceRemoved signal is initially connected.
- void DeviceRemovedConnected(const std::string& object_path,
+ void DeviceRemovedConnected(const dbus::ObjectPath& object_path,
const std::string& interface_name,
const std::string& signal_name,
bool success) {
@@ -374,7 +376,7 @@ class BluetoothAdapterClientImpl: public BluetoothAdapterClient,
}
// Called by dbus:: when a PropertyChanged signal is received.
- void PropertyChangedReceived(const std::string& object_path,
+ void PropertyChangedReceived(const dbus::ObjectPath& object_path,
dbus::Signal* signal) {
DCHECK(signal);
dbus::MessageReader reader(signal);
@@ -407,7 +409,7 @@ class BluetoothAdapterClientImpl: public BluetoothAdapterClient,
}
// Called by dbus:: when the PropertyChanged signal is initially connected.
- void PropertyChangedConnected(const std::string& object_path,
+ void PropertyChangedConnected(const dbus::ObjectPath& object_path,
const std::string& interface_name,
const std::string& signal_name,
bool success) {
@@ -416,7 +418,7 @@ class BluetoothAdapterClientImpl: public BluetoothAdapterClient,
}
// Called by dbus:: when a DeviceFound signal is received.
- void DeviceFoundReceived(const std::string& object_path,
+ void DeviceFoundReceived(const dbus::ObjectPath& object_path,
dbus::Signal* signal) {
DCHECK(signal);
dbus::MessageReader reader(signal);
@@ -442,7 +444,7 @@ class BluetoothAdapterClientImpl: public BluetoothAdapterClient,
}
// Called by dbus:: when the DeviceFound signal is initially connected.
- void DeviceFoundConnected(const std::string& object_path,
+ void DeviceFoundConnected(const dbus::ObjectPath& object_path,
const std::string& interface_name,
const std::string& signal_name,
bool success) {
@@ -451,7 +453,7 @@ class BluetoothAdapterClientImpl: public BluetoothAdapterClient,
}
// Called by dbus:: when a DeviceDisappeared signal is received.
- void DeviceDisappearedReceived(const std::string& object_path,
+ void DeviceDisappearedReceived(const dbus::ObjectPath& object_path,
dbus::Signal* signal) {
DCHECK(signal);
dbus::MessageReader reader(signal);
@@ -468,7 +470,7 @@ class BluetoothAdapterClientImpl: public BluetoothAdapterClient,
}
// Called by dbus:: when the DeviceDisappeared signal is initially connected.
- void DeviceDisappearedConnected(const std::string& object_path,
+ void DeviceDisappearedConnected(const dbus::ObjectPath& object_path,
const std::string& interface_name,
const std::string& signal_name,
bool success) {
@@ -477,14 +479,14 @@ class BluetoothAdapterClientImpl: public BluetoothAdapterClient,
}
// Called when a response for StartDiscovery() is received.
- void OnStartDiscovery(const std::string& object_path,
+ void OnStartDiscovery(const dbus::ObjectPath& object_path,
dbus::Response* response) {
VLOG(1) << "OnStartDiscovery: " << object_path;
LOG_IF(WARNING, !response) << object_path << ": OnStartDiscovery: failed.";
}
// Called when a response for StopDiscovery() is received.
- void OnStopDiscovery(const std::string& object_path,
+ void OnStopDiscovery(const dbus::ObjectPath& object_path,
dbus::Response* response) {
VLOG(1) << "OnStopDiscovery: " << object_path;
LOG_IF(WARNING, !response) << object_path << ": OnStopDiscovery: failed.";
@@ -497,7 +499,7 @@ class BluetoothAdapterClientImpl: public BluetoothAdapterClient,
dbus::Bus* bus_;
// We maintain a collection of dbus object proxies, one for each adapter.
- typedef std::map<const std::string, dbus::ObjectProxy*> ProxyMap;
+ typedef std::map<const dbus::ObjectPath, dbus::ObjectProxy*> ProxyMap;
ProxyMap proxy_map_;
// List of observers interested in event notifications from us.
@@ -521,12 +523,12 @@ class BluetoothAdapterClientStubImpl : public BluetoothAdapterClient {
}
// BluetoothAdapterClient override.
- virtual void StartDiscovery(const std::string& object_path) {
+ virtual void StartDiscovery(const dbus::ObjectPath& object_path) {
VLOG(1) << "StartDiscovery: " << object_path;
}
// BluetoothAdapterClient override.
- virtual void StopDiscovery(const std::string& object_path) {
+ virtual void StopDiscovery(const dbus::ObjectPath& object_path) {
VLOG(1) << "StopDiscovery: " << object_path;
}
};

Powered by Google App Engine
This is Rietveld 408576698