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

Unified Diff: device/bluetooth/dbus/bluetooth_gatt_descriptor_client.cc

Issue 1347193004: Refactor DBusThreadManager to split away BT clients. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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: device/bluetooth/dbus/bluetooth_gatt_descriptor_client.cc
diff --git a/chromeos/dbus/bluetooth_gatt_descriptor_client.cc b/device/bluetooth/dbus/bluetooth_gatt_descriptor_client.cc
similarity index 86%
rename from chromeos/dbus/bluetooth_gatt_descriptor_client.cc
rename to device/bluetooth/dbus/bluetooth_gatt_descriptor_client.cc
index 86d38ffea85fa014849e90d4e8f47bcafa8ec050..f3ba343ce83683eb119d1af39278d91a3120119b 100644
--- a/chromeos/dbus/bluetooth_gatt_descriptor_client.cc
+++ b/device/bluetooth/dbus/bluetooth_gatt_descriptor_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_gatt_descriptor_client.h"
+#include "device/bluetooth/dbus/bluetooth_gatt_descriptor_client.h"
#include "base/bind.h"
#include "base/memory/weak_ptr.h"
@@ -11,7 +11,7 @@
#include "dbus/object_manager.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
-namespace chromeos {
+namespace bluez {
namespace {
@@ -30,7 +30,7 @@ const char BluetoothGattDescriptorClient::kUnknownDescriptorError[] =
BluetoothGattDescriptorClient::Properties::Properties(
dbus::ObjectProxy* object_proxy,
const std::string& interface_name,
- const PropertyChangedCallback&callback)
+ const PropertyChangedCallback& callback)
: dbus::PropertySet(object_proxy, interface_name, callback) {
RegisterProperty(bluetooth_gatt_descriptor::kUUIDProperty, &uuid);
RegisterProperty(bluetooth_gatt_descriptor::kCharacteristicProperty,
@@ -38,8 +38,7 @@ BluetoothGattDescriptorClient::Properties::Properties(
RegisterProperty(kValueProperty, &value);
}
-BluetoothGattDescriptorClient::Properties::~Properties() {
-}
+BluetoothGattDescriptorClient::Properties::~Properties() {}
// The BluetoothGattDescriptorClient implementation used in production.
class BluetoothGattDescriptorClientImpl
@@ -47,9 +46,7 @@ class BluetoothGattDescriptorClientImpl
public dbus::ObjectManager::Interface {
public:
BluetoothGattDescriptorClientImpl()
- : object_manager_(NULL),
- weak_ptr_factory_(this) {
- }
+ : object_manager_(NULL), weak_ptr_factory_(this) {}
~BluetoothGattDescriptorClientImpl() override {
object_manager_->UnregisterInterface(
@@ -79,10 +76,9 @@ class BluetoothGattDescriptorClientImpl
// BluetoothGattDescriptorClientImpl override.
Properties* GetProperties(const dbus::ObjectPath& object_path) override {
DCHECK(object_manager_);
- return static_cast<Properties*>(
- object_manager_->GetProperties(
- object_path,
- bluetooth_gatt_descriptor::kBluetoothGattDescriptorInterface));
+ return static_cast<Properties*>(object_manager_->GetProperties(
+ object_path,
+ bluetooth_gatt_descriptor::kBluetoothGattDescriptorInterface));
}
// BluetoothGattDescriptorClientImpl override.
@@ -101,14 +97,11 @@ class BluetoothGattDescriptorClientImpl
bluetooth_gatt_descriptor::kReadValue);
object_proxy->CallMethodWithErrorCallback(
- &method_call,
- dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
+ &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
base::Bind(&BluetoothGattDescriptorClientImpl::OnValueSuccess,
- weak_ptr_factory_.GetWeakPtr(),
- callback),
+ weak_ptr_factory_.GetWeakPtr(), callback),
base::Bind(&BluetoothGattDescriptorClientImpl::OnError,
- weak_ptr_factory_.GetWeakPtr(),
- error_callback));
+ weak_ptr_factory_.GetWeakPtr(), error_callback));
}
// BluetoothGattDescriptorClientImpl override.
@@ -130,14 +123,11 @@ class BluetoothGattDescriptorClientImpl
writer.AppendArrayOfBytes(value.data(), value.size());
object_proxy->CallMethodWithErrorCallback(
- &method_call,
- dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
+ &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
base::Bind(&BluetoothGattDescriptorClientImpl::OnSuccess,
- weak_ptr_factory_.GetWeakPtr(),
- callback),
+ weak_ptr_factory_.GetWeakPtr(), callback),
base::Bind(&BluetoothGattDescriptorClientImpl::OnError,
- weak_ptr_factory_.GetWeakPtr(),
- error_callback));
+ weak_ptr_factory_.GetWeakPtr(), error_callback));
}
// dbus::ObjectManager::Interface override.
@@ -146,11 +136,9 @@ class BluetoothGattDescriptorClientImpl
const dbus::ObjectPath& object_path,
const std::string& interface_name) override {
Properties* properties = new Properties(
- object_proxy,
- interface_name,
+ object_proxy, interface_name,
base::Bind(&BluetoothGattDescriptorClientImpl::OnPropertyChanged,
- weak_ptr_factory_.GetWeakPtr(),
- object_path));
+ weak_ptr_factory_.GetWeakPtr(), object_path));
return static_cast<dbus::PropertySet*>(properties);
}
@@ -178,8 +166,7 @@ class BluetoothGattDescriptorClientImpl
dbus::ObjectPath(
bluetooth_object_manager::kBluetoothObjectManagerServicePath));
object_manager_->RegisterInterface(
- bluetooth_gatt_descriptor::kBluetoothGattDescriptorInterface,
- this);
+ bluetooth_gatt_descriptor::kBluetoothGattDescriptorInterface, this);
}
private:
@@ -190,9 +177,9 @@ class BluetoothGattDescriptorClientImpl
const std::string& property_name) {
VLOG(2) << "Remote GATT descriptor property changed: "
<< object_path.value() << ": " << property_name;
- FOR_EACH_OBSERVER(BluetoothGattDescriptorClient::Observer, observers_,
- GattDescriptorPropertyChanged(object_path,
- property_name));
+ FOR_EACH_OBSERVER(
+ BluetoothGattDescriptorClient::Observer, observers_,
+ GattDescriptorPropertyChanged(object_path, property_name));
}
// Called when a response for a successful method call is received.
@@ -252,15 +239,13 @@ class BluetoothGattDescriptorClientImpl
DISALLOW_COPY_AND_ASSIGN(BluetoothGattDescriptorClientImpl);
};
-BluetoothGattDescriptorClient::BluetoothGattDescriptorClient() {
-}
+BluetoothGattDescriptorClient::BluetoothGattDescriptorClient() {}
-BluetoothGattDescriptorClient::~BluetoothGattDescriptorClient() {
-}
+BluetoothGattDescriptorClient::~BluetoothGattDescriptorClient() {}
// static
BluetoothGattDescriptorClient* BluetoothGattDescriptorClient::Create() {
return new BluetoothGattDescriptorClientImpl();
}
-} // namespace chromeos
+} // namespace bluez

Powered by Google App Engine
This is Rietveld 408576698