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

Unified Diff: device/bluetooth/dbus/bluetooth_adapter_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_adapter_client.cc
diff --git a/chromeos/dbus/bluetooth_adapter_client.cc b/device/bluetooth/dbus/bluetooth_adapter_client.cc
similarity index 88%
rename from chromeos/dbus/bluetooth_adapter_client.cc
rename to device/bluetooth/dbus/bluetooth_adapter_client.cc
index 741dc03e29804ca3b200630f4a8918b09b88b4cd..26081ea334684ea80d952bd97ca9864861570d22 100644
--- a/chromeos/dbus/bluetooth_adapter_client.cc
+++ b/device/bluetooth/dbus/bluetooth_adapter_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_adapter_client.h"
+#include "device/bluetooth/dbus/bluetooth_adapter_client.h"
#include "base/bind.h"
#include "base/logging.h"
@@ -12,13 +12,11 @@
#include "dbus/object_proxy.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
-namespace chromeos {
+namespace bluez {
-BluetoothAdapterClient::DiscoveryFilter::DiscoveryFilter() {
-}
+BluetoothAdapterClient::DiscoveryFilter::DiscoveryFilter() {}
-BluetoothAdapterClient::DiscoveryFilter::~DiscoveryFilter() {
-}
+BluetoothAdapterClient::DiscoveryFilter::~DiscoveryFilter() {}
void BluetoothAdapterClient::DiscoveryFilter::CopyFrom(
const DiscoveryFilter& filter) {
@@ -69,14 +67,11 @@ BluetoothAdapterClient::Properties::Properties(
RegisterProperty(bluetooth_adapter::kModaliasProperty, &modalias);
}
-BluetoothAdapterClient::Properties::~Properties() {
-}
-
+BluetoothAdapterClient::Properties::~Properties() {}
// The BluetoothAdapterClient implementation used in production.
-class BluetoothAdapterClientImpl
- : public BluetoothAdapterClient,
- public dbus::ObjectManager::Interface {
+class BluetoothAdapterClientImpl : public BluetoothAdapterClient,
+ public dbus::ObjectManager::Interface {
public:
BluetoothAdapterClientImpl()
: object_manager_(NULL), weak_ptr_factory_(this) {}
@@ -110,29 +105,24 @@ class BluetoothAdapterClientImpl
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(&BluetoothAdapterClientImpl::OnPropertyChanged,
- weak_ptr_factory_.GetWeakPtr(),
- object_path));
+ weak_ptr_factory_.GetWeakPtr(), object_path));
return static_cast<dbus::PropertySet*>(properties);
}
// BluetoothAdapterClient override.
Properties* GetProperties(const dbus::ObjectPath& object_path) override {
- return static_cast<Properties*>(
- object_manager_->GetProperties(
- object_path,
- bluetooth_adapter::kBluetoothAdapterInterface));
+ return static_cast<Properties*>(object_manager_->GetProperties(
+ object_path, bluetooth_adapter::kBluetoothAdapterInterface));
}
// BluetoothAdapterClient override.
void StartDiscovery(const dbus::ObjectPath& object_path,
const base::Closure& callback,
const ErrorCallback& error_callback) override {
- dbus::MethodCall method_call(
- bluetooth_adapter::kBluetoothAdapterInterface,
- bluetooth_adapter::kStartDiscovery);
+ dbus::MethodCall method_call(bluetooth_adapter::kBluetoothAdapterInterface,
+ bluetooth_adapter::kStartDiscovery);
dbus::ObjectProxy* object_proxy =
object_manager_->GetObjectProxy(object_path);
@@ -142,8 +132,7 @@ class BluetoothAdapterClientImpl
}
object_proxy->CallMethodWithErrorCallback(
- &method_call,
- dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
+ &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
base::Bind(&BluetoothAdapterClientImpl::OnSuccess,
weak_ptr_factory_.GetWeakPtr(), callback),
base::Bind(&BluetoothAdapterClientImpl::OnError,
@@ -154,9 +143,8 @@ class BluetoothAdapterClientImpl
void StopDiscovery(const dbus::ObjectPath& object_path,
const base::Closure& callback,
const ErrorCallback& error_callback) override {
- dbus::MethodCall method_call(
- bluetooth_adapter::kBluetoothAdapterInterface,
- bluetooth_adapter::kStopDiscovery);
+ dbus::MethodCall method_call(bluetooth_adapter::kBluetoothAdapterInterface,
+ bluetooth_adapter::kStopDiscovery);
dbus::ObjectProxy* object_proxy =
object_manager_->GetObjectProxy(object_path);
@@ -166,8 +154,7 @@ class BluetoothAdapterClientImpl
}
object_proxy->CallMethodWithErrorCallback(
- &method_call,
- dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
+ &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
base::Bind(&BluetoothAdapterClientImpl::OnSuccess,
weak_ptr_factory_.GetWeakPtr(), callback),
base::Bind(&BluetoothAdapterClientImpl::OnError,
@@ -179,9 +166,8 @@ class BluetoothAdapterClientImpl
const dbus::ObjectPath& device_path,
const base::Closure& callback,
const ErrorCallback& error_callback) override {
- dbus::MethodCall method_call(
- bluetooth_adapter::kBluetoothAdapterInterface,
- bluetooth_adapter::kRemoveDevice);
+ dbus::MethodCall method_call(bluetooth_adapter::kBluetoothAdapterInterface,
+ bluetooth_adapter::kRemoveDevice);
dbus::MessageWriter writer(&method_call);
writer.AppendObjectPath(device_path);
@@ -194,8 +180,7 @@ class BluetoothAdapterClientImpl
}
object_proxy->CallMethodWithErrorCallback(
- &method_call,
- dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
+ &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
base::Bind(&BluetoothAdapterClientImpl::OnSuccess,
weak_ptr_factory_.GetWeakPtr(), callback),
base::Bind(&BluetoothAdapterClientImpl::OnError,
@@ -318,8 +303,7 @@ class BluetoothAdapterClientImpl
}
// 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();
}
@@ -350,20 +334,17 @@ class BluetoothAdapterClientImpl
// than we do.
// Note: This should remain the last member so it'll be destroyed and
// invalidate its weak pointers before any other members are destroyed.
- base::WeakPtrFactory<BluetoothAdapterClientImpl>
- weak_ptr_factory_;
+ base::WeakPtrFactory<BluetoothAdapterClientImpl> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterClientImpl);
};
-BluetoothAdapterClient::BluetoothAdapterClient() {
-}
+BluetoothAdapterClient::BluetoothAdapterClient() {}
-BluetoothAdapterClient::~BluetoothAdapterClient() {
-}
+BluetoothAdapterClient::~BluetoothAdapterClient() {}
BluetoothAdapterClient* BluetoothAdapterClient::Create() {
return new BluetoothAdapterClientImpl;
}
-} // namespace chromeos
+} // namespace bluez
« no previous file with comments | « device/bluetooth/dbus/bluetooth_adapter_client.h ('k') | device/bluetooth/dbus/bluetooth_agent_manager_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698