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

Unified Diff: device/bluetooth/dbus/fake_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/fake_bluetooth_media_transport_client.cc
diff --git a/chromeos/dbus/fake_bluetooth_media_transport_client.cc b/device/bluetooth/dbus/fake_bluetooth_media_transport_client.cc
similarity index 85%
rename from chromeos/dbus/fake_bluetooth_media_transport_client.cc
rename to device/bluetooth/dbus/fake_bluetooth_media_transport_client.cc
index 441a66bca4af4148620ddfe03bb4d02b018829b4..b71aa105fa5aab36a34dc0a33de0b1fdb3695fe5 100644
--- a/chromeos/dbus/fake_bluetooth_media_transport_client.cc
+++ b/device/bluetooth/dbus/fake_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/fake_bluetooth_media_transport_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_media_transport_client.h"
#include <unistd.h>
#include <sys/socket.h>
@@ -11,12 +11,12 @@
#include "base/bind.h"
#include "base/stl_util.h"
-#include "chromeos/dbus/bluetooth_media_client.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/fake_bluetooth_adapter_client.h"
-#include "chromeos/dbus/fake_bluetooth_media_client.h"
-#include "chromeos/dbus/fake_bluetooth_media_endpoint_service_provider.h"
#include "dbus/file_descriptor.h"
+#include "device/bluetooth/dbus/bluetooth_media_client.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
+#include "device/bluetooth/dbus/fake_bluetooth_adapter_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_media_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_media_endpoint_service_provider.h"
using dbus::ObjectPath;
@@ -35,23 +35,23 @@ ObjectPath GenerateTransportPath() {
static unsigned int sequence_number = 0;
++sequence_number;
std::stringstream path;
- path << chromeos::FakeBluetoothAdapterClient::kAdapterPath
- << chromeos::FakeBluetoothMediaTransportClient::kTransportDevicePath
+ path << bluez::FakeBluetoothAdapterClient::kAdapterPath
+ << bluez::FakeBluetoothMediaTransportClient::kTransportDevicePath
<< "/fd" << sequence_number;
return ObjectPath(path.str());
}
} // namespace
-namespace chromeos {
+namespace bluez {
// static
const char FakeBluetoothMediaTransportClient::kTransportDevicePath[] =
"/fake_audio_source";
const uint8_t FakeBluetoothMediaTransportClient::kTransportCodec = 0x00;
const std::vector<uint8_t>
- FakeBluetoothMediaTransportClient::kTransportConfiguration = {
- 0x21, 0x15, 0x33, 0x2C};
+ FakeBluetoothMediaTransportClient::kTransportConfiguration = {0x21, 0x15,
+ 0x33, 0x2C};
const uint16_t FakeBluetoothMediaTransportClient::kTransportDelay = 5;
const uint16_t FakeBluetoothMediaTransportClient::kTransportVolume = 50;
const uint16_t FakeBluetoothMediaTransportClient::kDefaultReadMtu = 20;
@@ -60,13 +60,11 @@ const uint16_t FakeBluetoothMediaTransportClient::kDefaultWriteMtu = 25;
FakeBluetoothMediaTransportClient::Properties::Properties(
const PropertyChangedCallback& callback)
: BluetoothMediaTransportClient::Properties(
- nullptr,
- kBluetoothMediaTransportInterface,
- callback) {
-}
+ nullptr,
+ kBluetoothMediaTransportInterface,
+ callback) {}
-FakeBluetoothMediaTransportClient::Properties::~Properties() {
-}
+FakeBluetoothMediaTransportClient::Properties::~Properties() {}
void FakeBluetoothMediaTransportClient::Properties::Get(
dbus::PropertyBase* property,
@@ -93,19 +91,16 @@ FakeBluetoothMediaTransportClient::Transport::Transport(
properties.reset(transport_properties);
}
-FakeBluetoothMediaTransportClient::Transport::~Transport() {
-}
+FakeBluetoothMediaTransportClient::Transport::~Transport() {}
-FakeBluetoothMediaTransportClient::FakeBluetoothMediaTransportClient() {
-}
+FakeBluetoothMediaTransportClient::FakeBluetoothMediaTransportClient() {}
FakeBluetoothMediaTransportClient::~FakeBluetoothMediaTransportClient() {
STLDeleteValues(&endpoint_to_transport_map_);
}
// DBusClient override.
-void FakeBluetoothMediaTransportClient::Init(dbus::Bus* bus) {
-}
+void FakeBluetoothMediaTransportClient::Init(dbus::Bus* bus) {}
void FakeBluetoothMediaTransportClient::AddObserver(
BluetoothMediaTransportClient::Observer* observer) {
@@ -154,7 +149,7 @@ void FakeBluetoothMediaTransportClient::SetValid(
FakeBluetoothMediaEndpointServiceProvider* endpoint,
bool valid) {
FakeBluetoothMediaClient* media = static_cast<FakeBluetoothMediaClient*>(
- DBusThreadManager::Get()->GetBluetoothMediaClient());
+ bluez::BluezDBusManager::Get()->GetBluetoothMediaClient());
DCHECK(media);
ObjectPath endpoint_path(endpoint->object_path());
@@ -210,10 +205,10 @@ void FakeBluetoothMediaTransportClient::SetState(
return;
transport->properties->state.ReplaceValue(state);
- FOR_EACH_OBSERVER(BluetoothMediaTransportClient::Observer, observers_,
- MediaTransportPropertyChanged(
- transport->path,
- BluetoothMediaTransportClient::kStateProperty));
+ FOR_EACH_OBSERVER(
+ BluetoothMediaTransportClient::Observer, observers_,
+ MediaTransportPropertyChanged(
+ transport->path, BluetoothMediaTransportClient::kStateProperty));
}
void FakeBluetoothMediaTransportClient::SetVolume(
@@ -224,21 +219,23 @@ void FakeBluetoothMediaTransportClient::SetVolume(
return;
transport->properties->volume.ReplaceValue(volume);
- FOR_EACH_OBSERVER(BluetoothMediaTransportClient::Observer, observers_,
- MediaTransportPropertyChanged(
- transport->path,
- BluetoothMediaTransportClient::kVolumeProperty));
+ FOR_EACH_OBSERVER(
+ BluetoothMediaTransportClient::Observer, observers_,
+ MediaTransportPropertyChanged(
+ transport->path, BluetoothMediaTransportClient::kVolumeProperty));
}
void FakeBluetoothMediaTransportClient::WriteData(
- const ObjectPath& endpoint_path, const std::vector<char>& bytes) {
+ const ObjectPath& endpoint_path,
+ const std::vector<char>& bytes) {
VLOG(1) << "WriteData - write " << bytes.size() << " bytes";
Transport* transport = GetTransport(endpoint_path);
if (!transport || transport->properties->state.value() != "active") {
VLOG(1) << "WriteData - write operation rejected, since the state isn't "
- "active for endpoint: " << endpoint_path.value();
+ "active for endpoint: "
+ << endpoint_path.value();
return;
}
@@ -323,4 +320,4 @@ void FakeBluetoothMediaTransportClient::AcquireInternal(
SetState(endpoint_path, "active");
}
-} // namespace chromeos
+} // namespace bluez

Powered by Google App Engine
This is Rietveld 408576698