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

Unified Diff: device/bluetooth/dbus/bluetooth_media_transport_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_media_transport_client.cc
diff --git a/chromeos/dbus/bluetooth_media_transport_client.cc b/device/bluetooth/dbus/bluetooth_media_transport_client.cc
similarity index 89%
rename from chromeos/dbus/bluetooth_media_transport_client.cc
rename to device/bluetooth/dbus/bluetooth_media_transport_client.cc
index 5639930e6679340dd3a460a8a2f49cc9ebcd468d..7fc47d7bd6e37bbb15d56f74c06702be0879ed0a 100644
--- a/chromeos/dbus/bluetooth_media_transport_client.cc
+++ b/device/bluetooth/dbus/bluetooth_media_transport_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_media_transport_client.h"
+#include "device/bluetooth/dbus/bluetooth_media_transport_client.h"
#include "base/bind.h"
#include "base/logging.h"
@@ -31,7 +31,7 @@ const char kRelease[] = "Release";
} // namespace
-namespace chromeos {
+namespace bluez {
// static
const char BluetoothMediaTransportClient::kDeviceProperty[] = "Device";
@@ -62,8 +62,7 @@ BluetoothMediaTransportClient::Properties::Properties(
RegisterProperty(kVolumeProperty, &volume);
}
-BluetoothMediaTransportClient::Properties::~Properties() {
-}
+BluetoothMediaTransportClient::Properties::~Properties() {}
class BluetoothMediaTransportClientImpl
: public BluetoothMediaTransportClient,
@@ -83,8 +82,7 @@ class BluetoothMediaTransportClientImpl
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(&BluetoothMediaTransportClientImpl::OnPropertyChanged,
weak_ptr_factory_.GetWeakPtr(), object_path));
return properties;
@@ -93,16 +91,14 @@ class BluetoothMediaTransportClientImpl
void ObjectAdded(const dbus::ObjectPath& object_path,
const std::string& interface_name) override {
VLOG(1) << "Remote Media Transport added: " << object_path.value();
- FOR_EACH_OBSERVER(BluetoothMediaTransportClient::Observer,
- observers_,
+ FOR_EACH_OBSERVER(BluetoothMediaTransportClient::Observer, observers_,
MediaTransportAdded(object_path));
}
void ObjectRemoved(const dbus::ObjectPath& object_path,
const std::string& interface_name) override {
VLOG(1) << "Remote Media Transport removed: " << object_path.value();
- FOR_EACH_OBSERVER(BluetoothMediaTransportClient::Observer,
- observers_,
+ FOR_EACH_OBSERVER(BluetoothMediaTransportClient::Observer, observers_,
MediaTransportRemoved(object_path));
}
@@ -121,9 +117,8 @@ class BluetoothMediaTransportClientImpl
Properties* GetProperties(const dbus::ObjectPath& object_path) override {
DCHECK(object_manager_);
- return static_cast<Properties*>(
- object_manager_->GetProperties(object_path,
- kBluetoothMediaTransportInterface));
+ return static_cast<Properties*>(object_manager_->GetProperties(
+ object_path, kBluetoothMediaTransportInterface));
}
void Acquire(const dbus::ObjectPath& object_path,
@@ -141,8 +136,7 @@ class BluetoothMediaTransportClientImpl
// Call Acquire method of Media Transport interface.
object_proxy->CallMethodWithErrorCallback(
- &method_call,
- dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
+ &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
base::Bind(&BluetoothMediaTransportClientImpl::OnAcquireSuccess,
weak_ptr_factory_.GetWeakPtr(), callback, error_callback),
base::Bind(&BluetoothMediaTransportClientImpl::OnError,
@@ -165,8 +159,7 @@ class BluetoothMediaTransportClientImpl
// Call TryAcquire method of Media Transport interface.
object_proxy->CallMethodWithErrorCallback(
- &method_call,
- dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
+ &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
base::Bind(&BluetoothMediaTransportClientImpl::OnAcquireSuccess,
weak_ptr_factory_.GetWeakPtr(), callback, error_callback),
base::Bind(&BluetoothMediaTransportClientImpl::OnError,
@@ -188,8 +181,7 @@ class BluetoothMediaTransportClientImpl
// Call TryAcquire method of Media Transport interface.
object_proxy->CallMethodWithErrorCallback(
- &method_call,
- dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
+ &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
base::Bind(&BluetoothMediaTransportClientImpl::OnSuccess,
weak_ptr_factory_.GetWeakPtr(), callback),
base::Bind(&BluetoothMediaTransportClientImpl::OnError,
@@ -203,8 +195,7 @@ class BluetoothMediaTransportClientImpl
bluetooth_object_manager::kBluetoothObjectManagerServiceName,
dbus::ObjectPath(
bluetooth_object_manager::kBluetoothObjectManagerServicePath));
- object_manager_->RegisterInterface(kBluetoothMediaTransportInterface,
- this);
+ object_manager_->RegisterInterface(kBluetoothMediaTransportInterface, this);
}
private:
@@ -220,8 +211,7 @@ class BluetoothMediaTransportClientImpl
}
// 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();
}
@@ -238,15 +228,13 @@ class BluetoothMediaTransportClientImpl
// Parse the response.
dbus::MessageReader reader(response);
- if (reader.PopFileDescriptor(&fd) &&
- reader.PopUint16(&read_mtu) &&
+ if (reader.PopFileDescriptor(&fd) && reader.PopUint16(&read_mtu) &&
reader.PopUint16(&write_mtu)) {
fd.CheckValidity();
DCHECK(fd.is_valid());
- VLOG(1) << "OnAcquireSuccess - fd: "<< fd.value()
- <<", read MTU: " << read_mtu
- <<", write MTU: " << write_mtu;
+ VLOG(1) << "OnAcquireSuccess - fd: " << fd.value()
+ << ", read MTU: " << read_mtu << ", write MTU: " << write_mtu;
// The ownership of the file descriptor is transferred to the user
// application.
@@ -287,14 +275,12 @@ class BluetoothMediaTransportClientImpl
DISALLOW_COPY_AND_ASSIGN(BluetoothMediaTransportClientImpl);
};
-BluetoothMediaTransportClient::BluetoothMediaTransportClient() {
-}
+BluetoothMediaTransportClient::BluetoothMediaTransportClient() {}
-BluetoothMediaTransportClient::~BluetoothMediaTransportClient() {
-}
+BluetoothMediaTransportClient::~BluetoothMediaTransportClient() {}
BluetoothMediaTransportClient* BluetoothMediaTransportClient::Create() {
return new BluetoothMediaTransportClientImpl();
}
-} // namespace chromeos
+} // namespace bluez
« no previous file with comments | « device/bluetooth/dbus/bluetooth_media_transport_client.h ('k') | device/bluetooth/dbus/bluetooth_profile_manager_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698