| Index: device/bluetooth/dbus/bluetooth_device_client.cc
|
| diff --git a/chromeos/dbus/bluetooth_device_client.cc b/device/bluetooth/dbus/bluetooth_device_client.cc
|
| similarity index 86%
|
| rename from chromeos/dbus/bluetooth_device_client.cc
|
| rename to device/bluetooth/dbus/bluetooth_device_client.cc
|
| index 02a5c6b7baced51ceb8e9bde6f4b822c86471782..65059c67f75e25583500d74b2da3923481bd5f0c 100644
|
| --- a/chromeos/dbus/bluetooth_device_client.cc
|
| +++ b/device/bluetooth/dbus/bluetooth_device_client.cc
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "chromeos/dbus/bluetooth_device_client.h"
|
| +#include "device/bluetooth/dbus/bluetooth_device_client.h"
|
|
|
| #include "base/bind.h"
|
| #include "base/logging.h"
|
| @@ -13,7 +13,7 @@
|
| #include "dbus/object_proxy.h"
|
| #include "third_party/cros_system_api/dbus/service_constants.h"
|
|
|
| -namespace chromeos {
|
| +namespace bluez {
|
|
|
| namespace {
|
|
|
| @@ -50,14 +50,11 @@ BluetoothDeviceClient::Properties::Properties(
|
| RegisterProperty(bluetooth_device::kTxPowerProperty, &tx_power);
|
| }
|
|
|
| -BluetoothDeviceClient::Properties::~Properties() {
|
| -}
|
| -
|
| +BluetoothDeviceClient::Properties::~Properties() {}
|
|
|
| // The BluetoothDeviceClient implementation used in production.
|
| -class BluetoothDeviceClientImpl
|
| - : public BluetoothDeviceClient,
|
| - public dbus::ObjectManager::Interface {
|
| +class BluetoothDeviceClientImpl : public BluetoothDeviceClient,
|
| + public dbus::ObjectManager::Interface {
|
| public:
|
| BluetoothDeviceClientImpl()
|
| : object_manager_(NULL), weak_ptr_factory_(this) {}
|
| @@ -84,12 +81,10 @@ class BluetoothDeviceClientImpl
|
| dbus::ObjectProxy* object_proxy,
|
| const dbus::ObjectPath& object_path,
|
| const std::string& interface_name) override {
|
| - Properties* properties = new Properties(
|
| - object_proxy,
|
| - interface_name,
|
| - base::Bind(&BluetoothDeviceClientImpl::OnPropertyChanged,
|
| - weak_ptr_factory_.GetWeakPtr(),
|
| - object_path));
|
| + Properties* properties =
|
| + new Properties(object_proxy, interface_name,
|
| + base::Bind(&BluetoothDeviceClientImpl::OnPropertyChanged,
|
| + weak_ptr_factory_.GetWeakPtr(), object_path));
|
| return static_cast<dbus::PropertySet*>(properties);
|
| }
|
|
|
| @@ -110,19 +105,16 @@ class BluetoothDeviceClientImpl
|
|
|
| // BluetoothDeviceClient override.
|
| Properties* GetProperties(const dbus::ObjectPath& object_path) override {
|
| - return static_cast<Properties*>(
|
| - object_manager_->GetProperties(
|
| - object_path,
|
| - bluetooth_device::kBluetoothDeviceInterface));
|
| + return static_cast<Properties*>(object_manager_->GetProperties(
|
| + object_path, bluetooth_device::kBluetoothDeviceInterface));
|
| }
|
|
|
| // BluetoothDeviceClient override.
|
| void Connect(const dbus::ObjectPath& object_path,
|
| const base::Closure& callback,
|
| const ErrorCallback& error_callback) override {
|
| - dbus::MethodCall method_call(
|
| - bluetooth_device::kBluetoothDeviceInterface,
|
| - bluetooth_device::kConnect);
|
| + dbus::MethodCall method_call(bluetooth_device::kBluetoothDeviceInterface,
|
| + bluetooth_device::kConnect);
|
|
|
| dbus::ObjectProxy* object_proxy =
|
| object_manager_->GetObjectProxy(object_path);
|
| @@ -133,8 +125,7 @@ class BluetoothDeviceClientImpl
|
|
|
| // Connect may take an arbitrary length of time, so use no timeout.
|
| object_proxy->CallMethodWithErrorCallback(
|
| - &method_call,
|
| - dbus::ObjectProxy::TIMEOUT_INFINITE,
|
| + &method_call, dbus::ObjectProxy::TIMEOUT_INFINITE,
|
| base::Bind(&BluetoothDeviceClientImpl::OnSuccess,
|
| weak_ptr_factory_.GetWeakPtr(), callback),
|
| base::Bind(&BluetoothDeviceClientImpl::OnError,
|
| @@ -145,9 +136,8 @@ class BluetoothDeviceClientImpl
|
| void Disconnect(const dbus::ObjectPath& object_path,
|
| const base::Closure& callback,
|
| const ErrorCallback& error_callback) override {
|
| - dbus::MethodCall method_call(
|
| - bluetooth_device::kBluetoothDeviceInterface,
|
| - bluetooth_device::kDisconnect);
|
| + dbus::MethodCall method_call(bluetooth_device::kBluetoothDeviceInterface,
|
| + bluetooth_device::kDisconnect);
|
|
|
| dbus::ObjectProxy* object_proxy =
|
| object_manager_->GetObjectProxy(object_path);
|
| @@ -157,8 +147,7 @@ class BluetoothDeviceClientImpl
|
| }
|
|
|
| object_proxy->CallMethodWithErrorCallback(
|
| - &method_call,
|
| - dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
|
| + &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
|
| base::Bind(&BluetoothDeviceClientImpl::OnSuccess,
|
| weak_ptr_factory_.GetWeakPtr(), callback),
|
| base::Bind(&BluetoothDeviceClientImpl::OnError,
|
| @@ -170,9 +159,8 @@ class BluetoothDeviceClientImpl
|
| const std::string& uuid,
|
| const base::Closure& callback,
|
| const ErrorCallback& error_callback) override {
|
| - dbus::MethodCall method_call(
|
| - bluetooth_device::kBluetoothDeviceInterface,
|
| - bluetooth_device::kConnectProfile);
|
| + dbus::MethodCall method_call(bluetooth_device::kBluetoothDeviceInterface,
|
| + bluetooth_device::kConnectProfile);
|
|
|
| dbus::MessageWriter writer(&method_call);
|
| writer.AppendString(uuid);
|
| @@ -186,8 +174,7 @@ class BluetoothDeviceClientImpl
|
|
|
| // Connect may take an arbitrary length of time, so use no timeout.
|
| object_proxy->CallMethodWithErrorCallback(
|
| - &method_call,
|
| - dbus::ObjectProxy::TIMEOUT_INFINITE,
|
| + &method_call, dbus::ObjectProxy::TIMEOUT_INFINITE,
|
| base::Bind(&BluetoothDeviceClientImpl::OnSuccess,
|
| weak_ptr_factory_.GetWeakPtr(), callback),
|
| base::Bind(&BluetoothDeviceClientImpl::OnError,
|
| @@ -199,9 +186,8 @@ class BluetoothDeviceClientImpl
|
| const std::string& uuid,
|
| const base::Closure& callback,
|
| const ErrorCallback& error_callback) override {
|
| - dbus::MethodCall method_call(
|
| - bluetooth_device::kBluetoothDeviceInterface,
|
| - bluetooth_device::kDisconnectProfile);
|
| + dbus::MethodCall method_call(bluetooth_device::kBluetoothDeviceInterface,
|
| + bluetooth_device::kDisconnectProfile);
|
|
|
| dbus::MessageWriter writer(&method_call);
|
| writer.AppendString(uuid);
|
| @@ -214,8 +200,7 @@ class BluetoothDeviceClientImpl
|
| }
|
|
|
| object_proxy->CallMethodWithErrorCallback(
|
| - &method_call,
|
| - dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
|
| + &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
|
| base::Bind(&BluetoothDeviceClientImpl::OnSuccess,
|
| weak_ptr_factory_.GetWeakPtr(), callback),
|
| base::Bind(&BluetoothDeviceClientImpl::OnError,
|
| @@ -226,9 +211,8 @@ class BluetoothDeviceClientImpl
|
| void Pair(const dbus::ObjectPath& object_path,
|
| const base::Closure& callback,
|
| const ErrorCallback& error_callback) override {
|
| - dbus::MethodCall method_call(
|
| - bluetooth_device::kBluetoothDeviceInterface,
|
| - bluetooth_device::kPair);
|
| + dbus::MethodCall method_call(bluetooth_device::kBluetoothDeviceInterface,
|
| + bluetooth_device::kPair);
|
|
|
| dbus::ObjectProxy* object_proxy =
|
| object_manager_->GetObjectProxy(object_path);
|
| @@ -239,8 +223,7 @@ class BluetoothDeviceClientImpl
|
|
|
| // Pairing may take an arbitrary length of time, so use no timeout.
|
| object_proxy->CallMethodWithErrorCallback(
|
| - &method_call,
|
| - dbus::ObjectProxy::TIMEOUT_INFINITE,
|
| + &method_call, dbus::ObjectProxy::TIMEOUT_INFINITE,
|
| base::Bind(&BluetoothDeviceClientImpl::OnSuccess,
|
| weak_ptr_factory_.GetWeakPtr(), callback),
|
| base::Bind(&BluetoothDeviceClientImpl::OnError,
|
| @@ -251,9 +234,8 @@ class BluetoothDeviceClientImpl
|
| void CancelPairing(const dbus::ObjectPath& object_path,
|
| const base::Closure& callback,
|
| const ErrorCallback& error_callback) override {
|
| - dbus::MethodCall method_call(
|
| - bluetooth_device::kBluetoothDeviceInterface,
|
| - bluetooth_device::kCancelPairing);
|
| + dbus::MethodCall method_call(bluetooth_device::kBluetoothDeviceInterface,
|
| + bluetooth_device::kCancelPairing);
|
|
|
| dbus::ObjectProxy* object_proxy =
|
| object_manager_->GetObjectProxy(object_path);
|
| @@ -262,8 +244,7 @@ class BluetoothDeviceClientImpl
|
| return;
|
| }
|
| object_proxy->CallMethodWithErrorCallback(
|
| - &method_call,
|
| - dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
|
| + &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
|
| base::Bind(&BluetoothDeviceClientImpl::OnSuccess,
|
| weak_ptr_factory_.GetWeakPtr(), callback),
|
| base::Bind(&BluetoothDeviceClientImpl::OnError,
|
| @@ -329,8 +310,7 @@ class BluetoothDeviceClientImpl
|
| }
|
|
|
| // Called when a response for successful method call is received.
|
| - void OnSuccess(const base::Closure& callback,
|
| - dbus::Response* response) {
|
| + void OnSuccess(const base::Closure& callback, dbus::Response* response) {
|
| DCHECK(response);
|
| callback.Run();
|
| }
|
| @@ -387,14 +367,12 @@ class BluetoothDeviceClientImpl
|
| DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceClientImpl);
|
| };
|
|
|
| -BluetoothDeviceClient::BluetoothDeviceClient() {
|
| -}
|
| +BluetoothDeviceClient::BluetoothDeviceClient() {}
|
|
|
| -BluetoothDeviceClient::~BluetoothDeviceClient() {
|
| -}
|
| +BluetoothDeviceClient::~BluetoothDeviceClient() {}
|
|
|
| BluetoothDeviceClient* BluetoothDeviceClient::Create() {
|
| return new BluetoothDeviceClientImpl();
|
| }
|
|
|
| -} // namespace chromeos
|
| +} // namespace bluez
|
|
|