summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrkc <rkc@chromium.org>2015-09-28 16:15:40 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-28 23:16:34 +0000
commit5d3c8959a7aee861b6750fd734cad96bd24e1f9f (patch)
tree20e59e629ef2adead10bbd7933c2313f5c8af693
parent6bdfb7dfb3ce2e571697629895089cffc42b48e6 (diff)
downloadchromium_src-5d3c8959a7aee861b6750fd734cad96bd24e1f9f.zip
chromium_src-5d3c8959a7aee861b6750fd734cad96bd24e1f9f.tar.gz
chromium_src-5d3c8959a7aee861b6750fd734cad96bd24e1f9f.tar.bz2
Refactor DBusThreadManager to split away BT clients.
To be able to reuse the bluetooth DBus clients on linux, we need to be able to separate them out from DBusThreadManager and move them out of //chromeos. This CL introduces no functional change but instead only refactors the code so we now have a BluezDbusManager that handles a Bluetooth specific DBus client bundle to create all the bluetooth related DBus clients. We will be able to extend this code to add a Linux specific BluezDbusManager implementation, allowing us to reuse all these DBus clients on Linux instead of copy/pasting the code. R=armansito@chromium.org, stevenjb@chromium.org BUG=522663 Review URL: https://codereview.chromium.org/1347193004 Cr-Commit-Position: refs/heads/master@{#351197}
-rw-r--r--ash/test/ash_test_helper.cc7
-rw-r--r--chrome/browser/chromeos/chrome_browser_main_chromeos.cc8
-rw-r--r--chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api_chromeos_unittest.cc6
-rw-r--r--chrome/browser/metrics/chromeos_metrics_provider_unittest.cc69
-rw-r--r--chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.cc40
-rw-r--r--chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.h7
-rw-r--r--chrome/test/DEPS1
-rw-r--r--chrome/test/base/testing_io_thread_state.cc6
-rw-r--r--chrome/test/base/view_event_test_platform_part_chromeos.cc6
-rw-r--r--chromeos/chromeos.gyp76
-rw-r--r--chromeos/dbus/dbus_client_bundle.cc65
-rw-r--r--chromeos/dbus/dbus_client_bundle.h75
-rw-r--r--chromeos/dbus/dbus_thread_manager.cc152
-rw-r--r--chromeos/dbus/dbus_thread_manager.h44
-rw-r--r--device/bluetooth/BUILD.gn89
-rw-r--r--device/bluetooth/bluetooth.gyp90
-rw-r--r--device/bluetooth/bluetooth_adapter_chromeos.cc224
-rw-r--r--device/bluetooth/bluetooth_adapter_chromeos.h45
-rw-r--r--device/bluetooth/bluetooth_adapter_profile_chromeos.cc33
-rw-r--r--device/bluetooth/bluetooth_adapter_profile_chromeos.h22
-rw-r--r--device/bluetooth/bluetooth_adapter_profile_chromeos_unittest.cc91
-rw-r--r--device/bluetooth/bluetooth_advertisement_chromeos.cc22
-rw-r--r--device/bluetooth/bluetooth_advertisement_chromeos.h15
-rw-r--r--device/bluetooth/bluetooth_advertisement_chromeos_unittest.cc12
-rw-r--r--device/bluetooth/bluetooth_audio_sink_chromeos.cc60
-rw-r--r--device/bluetooth/bluetooth_audio_sink_chromeos.h22
-rw-r--r--device/bluetooth/bluetooth_audio_sink_chromeos_unittest.cc72
-rw-r--r--device/bluetooth/bluetooth_chromeos_unittest.cc458
-rw-r--r--device/bluetooth/bluetooth_device_chromeos.cc159
-rw-r--r--device/bluetooth/bluetooth_device_chromeos.h8
-rw-r--r--device/bluetooth/bluetooth_gatt_chromeos_unittest.cc226
-rw-r--r--device/bluetooth/bluetooth_gatt_connection_chromeos.cc19
-rw-r--r--device/bluetooth/bluetooth_gatt_connection_chromeos.h7
-rw-r--r--device/bluetooth/bluetooth_gatt_notify_session_chromeos.cc20
-rw-r--r--device/bluetooth/bluetooth_gatt_notify_session_chromeos.h6
-rw-r--r--device/bluetooth/bluetooth_pairing_chromeos.cc29
-rw-r--r--device/bluetooth/bluetooth_pairing_chromeos.h32
-rw-r--r--device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.cc111
-rw-r--r--device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h6
-rw-r--r--device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.cc29
-rw-r--r--device/bluetooth/bluetooth_remote_gatt_service_chromeos.cc62
-rw-r--r--device/bluetooth/bluetooth_remote_gatt_service_chromeos.h12
-rw-r--r--device/bluetooth/bluetooth_socket_chromeos.cc20
-rw-r--r--device/bluetooth/bluetooth_socket_chromeos.h20
-rw-r--r--device/bluetooth/bluetooth_socket_chromeos_unittest.cc121
-rw-r--r--device/bluetooth/dbus/bluetooth_adapter_client.cc (renamed from chromeos/dbus/bluetooth_adapter_client.cc)69
-rw-r--r--device/bluetooth/dbus/bluetooth_adapter_client.h (renamed from chromeos/dbus/bluetooth_adapter_client.h)18
-rw-r--r--device/bluetooth/dbus/bluetooth_agent_manager_client.cc (renamed from chromeos/dbus/bluetooth_agent_manager_client.cc)35
-rw-r--r--device/bluetooth/dbus/bluetooth_agent_manager_client.h (renamed from chromeos/dbus/bluetooth_agent_manager_client.h)17
-rw-r--r--device/bluetooth/dbus/bluetooth_agent_service_provider.cc (renamed from chromeos/dbus/bluetooth_agent_service_provider.cc)68
-rw-r--r--device/bluetooth/dbus/bluetooth_agent_service_provider.h (renamed from chromeos/dbus/bluetooth_agent_service_provider.h)23
-rw-r--r--device/bluetooth/dbus/bluetooth_dbus_client_bundle.cc84
-rw-r--r--device/bluetooth/dbus/bluetooth_dbus_client_bundle.h113
-rw-r--r--device/bluetooth/dbus/bluetooth_device_client.cc (renamed from chromeos/dbus/bluetooth_device_client.cc)88
-rw-r--r--device/bluetooth/dbus/bluetooth_device_client.h (renamed from chromeos/dbus/bluetooth_device_client.h)18
-rw-r--r--device/bluetooth/dbus/bluetooth_gatt_characteristic_client.cc (renamed from chromeos/dbus/bluetooth_gatt_characteristic_client.cc)78
-rw-r--r--device/bluetooth/dbus/bluetooth_gatt_characteristic_client.h (renamed from chromeos/dbus/bluetooth_gatt_characteristic_client.h)17
-rw-r--r--device/bluetooth/dbus/bluetooth_gatt_characteristic_service_provider.cc (renamed from chromeos/dbus/bluetooth_gatt_characteristic_service_provider.cc)108
-rw-r--r--device/bluetooth/dbus/bluetooth_gatt_characteristic_service_provider.h (renamed from chromeos/dbus/bluetooth_gatt_characteristic_service_provider.h)14
-rw-r--r--device/bluetooth/dbus/bluetooth_gatt_descriptor_client.cc (renamed from chromeos/dbus/bluetooth_gatt_descriptor_client.cc)61
-rw-r--r--device/bluetooth/dbus/bluetooth_gatt_descriptor_client.h (renamed from chromeos/dbus/bluetooth_gatt_descriptor_client.h)17
-rw-r--r--device/bluetooth/dbus/bluetooth_gatt_descriptor_service_provider.cc (renamed from chromeos/dbus/bluetooth_gatt_descriptor_service_provider.cc)103
-rw-r--r--device/bluetooth/dbus/bluetooth_gatt_descriptor_service_provider.h (renamed from chromeos/dbus/bluetooth_gatt_descriptor_service_provider.h)14
-rw-r--r--device/bluetooth/dbus/bluetooth_gatt_manager_client.cc (renamed from chromeos/dbus/bluetooth_gatt_manager_client.cc)22
-rw-r--r--device/bluetooth/dbus/bluetooth_gatt_manager_client.h (renamed from chromeos/dbus/bluetooth_gatt_manager_client.h)19
-rw-r--r--device/bluetooth/dbus/bluetooth_gatt_service_client.cc (renamed from chromeos/dbus/bluetooth_gatt_service_client.cc)33
-rw-r--r--device/bluetooth/dbus/bluetooth_gatt_service_client.h (renamed from chromeos/dbus/bluetooth_gatt_service_client.h)21
-rw-r--r--device/bluetooth/dbus/bluetooth_gatt_service_service_provider.cc (renamed from chromeos/dbus/bluetooth_gatt_service_service_provider.cc)58
-rw-r--r--device/bluetooth/dbus/bluetooth_gatt_service_service_provider.h (renamed from chromeos/dbus/bluetooth_gatt_service_service_provider.h)14
-rw-r--r--device/bluetooth/dbus/bluetooth_input_client.cc (renamed from chromeos/dbus/bluetooth_input_client.cc)37
-rw-r--r--device/bluetooth/dbus/bluetooth_input_client.h (renamed from chromeos/dbus/bluetooth_input_client.h)16
-rw-r--r--device/bluetooth/dbus/bluetooth_le_advertisement_service_provider.cc (renamed from chromeos/dbus/bluetooth_le_advertisement_service_provider.cc)18
-rw-r--r--device/bluetooth/dbus/bluetooth_le_advertisement_service_provider.h (renamed from chromeos/dbus/bluetooth_le_advertisement_service_provider.h)14
-rw-r--r--device/bluetooth/dbus/bluetooth_le_advertising_manager_client.cc (renamed from chromeos/dbus/bluetooth_le_advertising_manager_client.cc)12
-rw-r--r--device/bluetooth/dbus/bluetooth_le_advertising_manager_client.h (renamed from chromeos/dbus/bluetooth_le_advertising_manager_client.h)17
-rw-r--r--device/bluetooth/dbus/bluetooth_media_client.cc (renamed from chromeos/dbus/bluetooth_media_client.cc)34
-rw-r--r--device/bluetooth/dbus/bluetooth_media_client.h (renamed from chromeos/dbus/bluetooth_media_client.h)18
-rw-r--r--device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.cc (renamed from chromeos/dbus/bluetooth_media_endpoint_service_provider.cc)56
-rw-r--r--device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.h (renamed from chromeos/dbus/bluetooth_media_endpoint_service_provider.h)16
-rw-r--r--device/bluetooth/dbus/bluetooth_media_transport_client.cc (renamed from chromeos/dbus/bluetooth_media_transport_client.cc)52
-rw-r--r--device/bluetooth/dbus/bluetooth_media_transport_client.h (renamed from chromeos/dbus/bluetooth_media_transport_client.h)17
-rw-r--r--device/bluetooth/dbus/bluetooth_profile_manager_client.cc (renamed from chromeos/dbus/bluetooth_profile_manager_client.cc)42
-rw-r--r--device/bluetooth/dbus/bluetooth_profile_manager_client.h (renamed from chromeos/dbus/bluetooth_profile_manager_client.h)26
-rw-r--r--device/bluetooth/dbus/bluetooth_profile_service_provider.cc (renamed from chromeos/dbus/bluetooth_profile_service_provider.cc)31
-rw-r--r--device/bluetooth/dbus/bluetooth_profile_service_provider.h (renamed from chromeos/dbus/bluetooth_profile_service_provider.h)22
-rw-r--r--device/bluetooth/dbus/bluez_dbus_client.h37
-rw-r--r--device/bluetooth/dbus/bluez_dbus_manager.cc250
-rw-r--r--device/bluetooth/dbus/bluez_dbus_manager.h157
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_adapter_client.cc (renamed from chromeos/dbus/fake_bluetooth_adapter_client.cc)65
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_adapter_client.h (renamed from chromeos/dbus/fake_bluetooth_adapter_client.h)10
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_agent_manager_client.cc (renamed from chromeos/dbus/fake_bluetooth_agent_manager_client.cc)17
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_agent_manager_client.h (renamed from chromeos/dbus/fake_bluetooth_agent_manager_client.h)10
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_agent_service_provider.cc (renamed from chromeos/dbus/fake_bluetooth_agent_service_provider.cc)26
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_agent_service_provider.h (renamed from chromeos/dbus/fake_bluetooth_agent_service_provider.h)22
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_device_client.cc (renamed from chromeos/dbus/fake_bluetooth_device_client.cc)149
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_device_client.h (renamed from chromeos/dbus/fake_bluetooth_device_client.h)79
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.cc (renamed from chromeos/dbus/fake_bluetooth_gatt_characteristic_client.cc)82
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.h (renamed from chromeos/dbus/fake_bluetooth_gatt_characteristic_client.h)13
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.cc (renamed from chromeos/dbus/fake_bluetooth_gatt_characteristic_service_provider.cc)37
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.h (renamed from chromeos/dbus/fake_bluetooth_gatt_characteristic_service_provider.h)10
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_client.cc (renamed from chromeos/dbus/fake_bluetooth_gatt_descriptor_client.cc)50
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_client.h (renamed from chromeos/dbus/fake_bluetooth_gatt_descriptor_client.h)13
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_service_provider.cc (renamed from chromeos/dbus/fake_bluetooth_gatt_descriptor_service_provider.cc)37
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_service_provider.h (renamed from chromeos/dbus/fake_bluetooth_gatt_descriptor_service_provider.h)12
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.cc (renamed from chromeos/dbus/fake_bluetooth_gatt_manager_client.cc)34
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.h (renamed from chromeos/dbus/fake_bluetooth_gatt_manager_client.h)30
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_gatt_service_client.cc (renamed from chromeos/dbus/fake_bluetooth_gatt_service_client.cc)52
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_gatt_service_client.h (renamed from chromeos/dbus/fake_bluetooth_gatt_service_client.h)10
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_gatt_service_service_provider.cc (renamed from chromeos/dbus/fake_bluetooth_gatt_service_service_provider.cc)18
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_gatt_service_service_provider.h (renamed from chromeos/dbus/fake_bluetooth_gatt_service_service_provider.h)10
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_input_client.cc (renamed from chromeos/dbus/fake_bluetooth_input_client.cc)34
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_input_client.h (renamed from chromeos/dbus/fake_bluetooth_input_client.h)14
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_le_advertisement_service_provider.cc (renamed from chromeos/dbus/fake_bluetooth_le_advertisement_service_provider.cc)14
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_le_advertisement_service_provider.h (renamed from chromeos/dbus/fake_bluetooth_le_advertisement_service_provider.h)10
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_le_advertising_manager_client.cc (renamed from chromeos/dbus/fake_bluetooth_le_advertising_manager_client.cc)19
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_le_advertising_manager_client.h (renamed from chromeos/dbus/fake_bluetooth_le_advertising_manager_client.h)10
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_media_client.cc (renamed from chromeos/dbus/fake_bluetooth_media_client.cc)25
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_media_client.h (renamed from chromeos/dbus/fake_bluetooth_media_client.h)11
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_media_endpoint_service_provider.cc (renamed from chromeos/dbus/fake_bluetooth_media_endpoint_service_provider.cc)14
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_media_endpoint_service_provider.h (renamed from chromeos/dbus/fake_bluetooth_media_endpoint_service_provider.h)10
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_media_transport_client.cc (renamed from chromeos/dbus/fake_bluetooth_media_transport_client.cc)67
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_media_transport_client.h (renamed from chromeos/dbus/fake_bluetooth_media_transport_client.h)13
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_profile_manager_client.cc (renamed from chromeos/dbus/fake_bluetooth_profile_manager_client.cc)17
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_profile_manager_client.h (renamed from chromeos/dbus/fake_bluetooth_profile_manager_client.h)10
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_profile_service_provider.cc (renamed from chromeos/dbus/fake_bluetooth_profile_service_provider.cc)17
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_profile_service_provider.h (renamed from chromeos/dbus/fake_bluetooth_profile_service_provider.h)10
126 files changed, 2973 insertions, 2796 deletions
diff --git a/ash/test/ash_test_helper.cc b/ash/test/ash_test_helper.cc
index d884547..1c07267 100644
--- a/ash/test/ash_test_helper.cc
+++ b/ash/test/ash_test_helper.cc
@@ -31,6 +31,7 @@
#if defined(OS_CHROMEOS)
#include "chromeos/audio/cras_audio_handler.h"
#include "chromeos/dbus/dbus_thread_manager.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
#endif
#if defined(OS_WIN)
@@ -86,8 +87,13 @@ void AshTestHelper::SetUp(bool start_session) {
// Create DBusThreadManager for testing.
if (!chromeos::DBusThreadManager::IsInitialized()) {
chromeos::DBusThreadManager::Initialize();
+ bluez::BluezDBusManager::Initialize(
+ chromeos::DBusThreadManager::Get()->GetSystemBus(),
+ chromeos::DBusThreadManager::Get()->IsUsingStub(
+ chromeos::DBusClientBundle::BLUETOOTH));
dbus_thread_manager_initialized_ = true;
}
+
// Create CrasAudioHandler for testing since g_browser_process is not
// created in AshTestBase tests.
chromeos::CrasAudioHandler::InitializeForTesting();
@@ -125,6 +131,7 @@ void AshTestHelper::TearDown() {
#if defined(OS_CHROMEOS)
chromeos::CrasAudioHandler::Shutdown();
if (dbus_thread_manager_initialized_) {
+ bluez::BluezDBusManager::Shutdown();
chromeos::DBusThreadManager::Shutdown();
dbus_thread_manager_initialized_ = false;
}
diff --git a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
index efe91c5..91005c4 100644
--- a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
+++ b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
@@ -119,6 +119,7 @@
#include "content/public/browser/notification_service.h"
#include "content/public/common/main_function_params.h"
#include "device/bluetooth/bluetooth_adapter_factory.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
#include "media/audio/sounds/sounds_manager.h"
#include "net/base/network_change_notifier.h"
#include "net/socket/ssl_server_socket.h"
@@ -184,6 +185,12 @@ class DBusServices {
// Initialize DBusThreadManager for the browser. This must be done after
// the main message loop is started, as it uses the message loop.
DBusThreadManager::Initialize();
+
+ bluez::BluezDBusManager::Initialize(
+ DBusThreadManager::Get()->GetSystemBus(),
+ chromeos::DBusThreadManager::Get()->IsUsingStub(
+ chromeos::DBusClientBundle::BLUETOOTH));
+
PowerPolicyController::Initialize(
DBusThreadManager::Get()->GetPowerManagerClient());
@@ -250,6 +257,7 @@ class DBusServices {
PowerDataCollector::Shutdown();
PowerPolicyController::Shutdown();
device::BluetoothAdapterFactory::Shutdown();
+ bluez::BluezDBusManager::Shutdown();
// NOTE: This must only be called if Initialize() was called.
DBusThreadManager::Shutdown();
diff --git a/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api_chromeos_unittest.cc b/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api_chromeos_unittest.cc
index 912bd70..fc1c8c8 100644
--- a/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api_chromeos_unittest.cc
+++ b/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api_chromeos_unittest.cc
@@ -26,6 +26,7 @@
#include "chromeos/dbus/fake_easy_unlock_client.h"
#include "components/proximity_auth/cryptauth/proto/cryptauth_api.pb.h"
#include "components/proximity_auth/switches.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
#include "extensions/browser/api_test_utils.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/event_router_factory.h"
@@ -127,6 +128,10 @@ class EasyUnlockPrivateApiTest : public extensions::ExtensionApiUnittest {
protected:
void SetUp() override {
chromeos::DBusThreadManager::Initialize();
+ bluez::BluezDBusManager::Initialize(
+ chromeos::DBusThreadManager::Get()->GetSystemBus(),
+ chromeos::DBusThreadManager::Get()->IsUsingStub(
+ chromeos::DBusClientBundle::BLUETOOTH));
client_ = chromeos::DBusThreadManager::Get()->GetEasyUnlockClient();
extensions::ExtensionApiUnittest::SetUp();
@@ -135,6 +140,7 @@ class EasyUnlockPrivateApiTest : public extensions::ExtensionApiUnittest {
void TearDown() override {
extensions::ExtensionApiUnittest::TearDown();
+ bluez::BluezDBusManager::Shutdown();
chromeos::DBusThreadManager::Shutdown();
}
diff --git a/chrome/browser/metrics/chromeos_metrics_provider_unittest.cc b/chrome/browser/metrics/chromeos_metrics_provider_unittest.cc
index f47b5d9..1eeb373 100644
--- a/chrome/browser/metrics/chromeos_metrics_provider_unittest.cc
+++ b/chrome/browser/metrics/chromeos_metrics_provider_unittest.cc
@@ -11,41 +11,44 @@
#include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
#include "chrome/browser/metrics/chromeos_metrics_provider.h"
#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/fake_bluetooth_adapter_client.h"
-#include "chromeos/dbus/fake_bluetooth_agent_manager_client.h"
-#include "chromeos/dbus/fake_bluetooth_device_client.h"
-#include "chromeos/dbus/fake_bluetooth_gatt_characteristic_client.h"
-#include "chromeos/dbus/fake_bluetooth_gatt_descriptor_client.h"
-#include "chromeos/dbus/fake_bluetooth_gatt_service_client.h"
-#include "chromeos/dbus/fake_bluetooth_input_client.h"
#include "chromeos/dbus/power_manager_client.h"
#include "chromeos/login/login_state.h"
#include "components/metrics/proto/system_profile.pb.h"
#include "components/user_manager/user_manager.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "content/public/test/test_utils.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
+#include "device/bluetooth/dbus/fake_bluetooth_adapter_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_agent_manager_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_device_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_gatt_service_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_input_client.h"
#include "testing/gtest/include/gtest/gtest.h"
#if defined(USE_X11)
#include "ui/events/devices/x11/device_data_manager_x11.h"
#endif
+using bluez::BluetoothAdapterClient;
+using bluez::BluetoothAgentManagerClient;
+using bluez::BluetoothDeviceClient;
+using bluez::BluetoothGattCharacteristicClient;
+using bluez::BluetoothGattDescriptorClient;
+using bluez::BluetoothGattServiceClient;
+using bluez::BluetoothInputClient;
+using bluez::BluezDBusManager;
+using bluez::BluezDBusManagerSetter;
+using bluez::FakeBluetoothAdapterClient;
+using bluez::FakeBluetoothAgentManagerClient;
+using bluez::FakeBluetoothDeviceClient;
+using bluez::FakeBluetoothGattCharacteristicClient;
+using bluez::FakeBluetoothGattDescriptorClient;
+using bluez::FakeBluetoothGattServiceClient;
+using bluez::FakeBluetoothInputClient;
using chromeos::DBusThreadManager;
using chromeos::DBusThreadManagerSetter;
-using chromeos::BluetoothAdapterClient;
-using chromeos::BluetoothAgentManagerClient;
-using chromeos::BluetoothDeviceClient;
-using chromeos::BluetoothGattCharacteristicClient;
-using chromeos::BluetoothGattDescriptorClient;
-using chromeos::BluetoothGattServiceClient;
-using chromeos::BluetoothInputClient;
-using chromeos::FakeBluetoothAdapterClient;
-using chromeos::FakeBluetoothAgentManagerClient;
-using chromeos::FakeBluetoothDeviceClient;
-using chromeos::FakeBluetoothGattCharacteristicClient;
-using chromeos::FakeBluetoothGattDescriptorClient;
-using chromeos::FakeBluetoothGattServiceClient;
-using chromeos::FakeBluetoothInputClient;
using chromeos::PowerManagerClient;
using chromeos::STUB_DBUS_CLIENT_IMPLEMENTATION;
@@ -60,37 +63,39 @@ class ChromeOSMetricsProviderTest : public testing::Test {
#endif
// Set up the fake Bluetooth environment,
- scoped_ptr<DBusThreadManagerSetter> dbus_setter =
- DBusThreadManager::GetSetterForTesting();
- dbus_setter->SetBluetoothAdapterClient(
+ scoped_ptr<BluezDBusManagerSetter> bluez_dbus_setter =
+ BluezDBusManager::GetSetterForTesting();
+ bluez_dbus_setter->SetBluetoothAdapterClient(
scoped_ptr<BluetoothAdapterClient>(new FakeBluetoothAdapterClient));
- dbus_setter->SetBluetoothDeviceClient(
+ bluez_dbus_setter->SetBluetoothDeviceClient(
scoped_ptr<BluetoothDeviceClient>(new FakeBluetoothDeviceClient));
- dbus_setter->SetBluetoothGattCharacteristicClient(
+ bluez_dbus_setter->SetBluetoothGattCharacteristicClient(
scoped_ptr<BluetoothGattCharacteristicClient>(
new FakeBluetoothGattCharacteristicClient));
- dbus_setter->SetBluetoothGattDescriptorClient(
+ bluez_dbus_setter->SetBluetoothGattDescriptorClient(
scoped_ptr<BluetoothGattDescriptorClient>(
new FakeBluetoothGattDescriptorClient));
- dbus_setter->SetBluetoothGattServiceClient(
+ bluez_dbus_setter->SetBluetoothGattServiceClient(
scoped_ptr<BluetoothGattServiceClient>(
new FakeBluetoothGattServiceClient));
- dbus_setter->SetBluetoothInputClient(
+ bluez_dbus_setter->SetBluetoothInputClient(
scoped_ptr<BluetoothInputClient>(new FakeBluetoothInputClient));
- dbus_setter->SetBluetoothAgentManagerClient(
+ bluez_dbus_setter->SetBluetoothAgentManagerClient(
scoped_ptr<BluetoothAgentManagerClient>(
new FakeBluetoothAgentManagerClient));
// Set up a PowerManagerClient instance for PerfProvider.
+ scoped_ptr<DBusThreadManagerSetter> dbus_setter =
+ DBusThreadManager::GetSetterForTesting();
dbus_setter->SetPowerManagerClient(
scoped_ptr<PowerManagerClient>(
PowerManagerClient::Create(STUB_DBUS_CLIENT_IMPLEMENTATION)));
// Grab pointers to members of the thread manager for easier testing.
fake_bluetooth_adapter_client_ = static_cast<FakeBluetoothAdapterClient*>(
- DBusThreadManager::Get()->GetBluetoothAdapterClient());
+ BluezDBusManager::Get()->GetBluetoothAdapterClient());
fake_bluetooth_device_client_ = static_cast<FakeBluetoothDeviceClient*>(
- DBusThreadManager::Get()->GetBluetoothDeviceClient());
+ BluezDBusManager::Get()->GetBluetoothDeviceClient());
// Initialize the login state trackers.
if (!chromeos::LoginState::IsInitialized())
diff --git a/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.cc b/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.cc
index 260b2f6..932d7a9 100644
--- a/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.cc
@@ -10,12 +10,13 @@
#include "base/strings/string_number_conversions.h"
#include "base/values.h"
#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/fake_bluetooth_adapter_client.h"
-#include "chromeos/dbus/fake_bluetooth_device_client.h"
#include "chromeos/dbus/fake_cras_audio_client.h"
#include "chromeos/dbus/fake_power_manager_client.h"
#include "content/public/browser/web_ui.h"
#include "device/bluetooth/bluetooth_device_chromeos.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
+#include "device/bluetooth/dbus/fake_bluetooth_adapter_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_device_client.h"
namespace {
@@ -63,7 +64,7 @@ const char kPairedPropertyName[] = "Paired";
namespace chromeos {
class DeviceEmulatorMessageHandler::BluetoothObserver
- : public BluetoothDeviceClient::Observer {
+ : public bluez::BluetoothDeviceClient::Observer {
public:
explicit BluetoothObserver(DeviceEmulatorMessageHandler* owner)
: owner_(owner) {
@@ -179,8 +180,8 @@ void DeviceEmulatorMessageHandler::PowerObserver::PowerChanged(
DeviceEmulatorMessageHandler::DeviceEmulatorMessageHandler()
: fake_bluetooth_device_client_(
- static_cast<chromeos::FakeBluetoothDeviceClient*>(
- chromeos::DBusThreadManager::Get()
+ static_cast<bluez::FakeBluetoothDeviceClient*>(
+ bluez::BluezDBusManager::Get()
->GetBluetoothDeviceClient())),
fake_cras_audio_client_(static_cast<chromeos::FakeCrasAudioClient*>(
chromeos::DBusThreadManager::Get()
@@ -208,7 +209,7 @@ void DeviceEmulatorMessageHandler::HandleRemoveBluetoothDevice(
std::string path;
CHECK(args->GetString(0, &path));
fake_bluetooth_device_client_->RemoveDevice(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
dbus::ObjectPath(path));
}
@@ -223,7 +224,7 @@ void DeviceEmulatorMessageHandler::HandleRequestBluetoothInfo(
// the main adapter.
std::vector<dbus::ObjectPath> paths =
fake_bluetooth_device_client_->GetDevicesForAdapter(
- dbus::ObjectPath(chromeos::FakeBluetoothAdapterClient::kAdapterPath));
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath));
base::ListValue devices;
// Get each device's properties.
@@ -237,21 +238,21 @@ void DeviceEmulatorMessageHandler::HandleRequestBluetoothInfo(
base::ListValue pairing_method_options;
pairing_method_options.AppendString(
- FakeBluetoothDeviceClient::kPairingMethodNone);
+ bluez::FakeBluetoothDeviceClient::kPairingMethodNone);
pairing_method_options.AppendString(
- FakeBluetoothDeviceClient::kPairingMethodPinCode);
+ bluez::FakeBluetoothDeviceClient::kPairingMethodPinCode);
pairing_method_options.AppendString(
- FakeBluetoothDeviceClient::kPairingMethodPassKey);
+ bluez::FakeBluetoothDeviceClient::kPairingMethodPassKey);
base::ListValue pairing_action_options;
pairing_action_options.AppendString(
- FakeBluetoothDeviceClient::kPairingActionDisplay);
+ bluez::FakeBluetoothDeviceClient::kPairingActionDisplay);
pairing_action_options.AppendString(
- FakeBluetoothDeviceClient::kPairingActionRequest);
+ bluez::FakeBluetoothDeviceClient::kPairingActionRequest);
pairing_action_options.AppendString(
- FakeBluetoothDeviceClient::kPairingActionConfirmation);
+ bluez::FakeBluetoothDeviceClient::kPairingActionConfirmation);
pairing_action_options.AppendString(
- FakeBluetoothDeviceClient::kPairingActionFail);
+ bluez::FakeBluetoothDeviceClient::kPairingActionFail);
// Send the list of devices to the view.
web_ui()->CallJavascriptFunction(kUpdateBluetoothInfoJSCallback,
@@ -263,7 +264,7 @@ void DeviceEmulatorMessageHandler::HandleRequestBluetoothPair(
const base::ListValue* args) {
// Create the device if it does not already exist.
std::string path = CreateBluetoothDeviceFromListValue(args);
- chromeos::FakeBluetoothDeviceClient::Properties* props =
+ bluez::FakeBluetoothDeviceClient::Properties* props =
fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(path));
// Try to pair the device with the main adapter. The device is identified
@@ -442,7 +443,7 @@ void DeviceEmulatorMessageHandler::RegisterMessages() {
std::string DeviceEmulatorMessageHandler::CreateBluetoothDeviceFromListValue(
const base::ListValue* args) {
const base::DictionaryValue* device_dict = nullptr;
- FakeBluetoothDeviceClient::IncomingDeviceProperties props;
+ bluez::FakeBluetoothDeviceClient::IncomingDeviceProperties props;
CHECK(args->GetDictionary(0, &device_dict));
CHECK(device_dict->GetString("path", &props.device_path));
@@ -459,8 +460,7 @@ std::string DeviceEmulatorMessageHandler::CreateBluetoothDeviceFromListValue(
// Create the device and store it in the FakeBluetoothDeviceClient's observed
// list of devices.
fake_bluetooth_device_client_->CreateDeviceWithProperties(
- dbus::ObjectPath(chromeos::FakeBluetoothAdapterClient::kAdapterPath),
- props);
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath), props);
return props.device_path;
}
@@ -468,11 +468,11 @@ std::string DeviceEmulatorMessageHandler::CreateBluetoothDeviceFromListValue(
scoped_ptr<base::DictionaryValue> DeviceEmulatorMessageHandler::GetDeviceInfo(
const dbus::ObjectPath& object_path) {
// Get the device's properties.
- chromeos::FakeBluetoothDeviceClient::Properties* props =
+ bluez::FakeBluetoothDeviceClient::Properties* props =
fake_bluetooth_device_client_->GetProperties(object_path);
scoped_ptr<base::DictionaryValue> device(new base::DictionaryValue());
scoped_ptr<base::ListValue> uuids(new base::ListValue);
- chromeos::FakeBluetoothDeviceClient::SimulatedPairingOptions* options =
+ bluez::FakeBluetoothDeviceClient::SimulatedPairingOptions* options =
fake_bluetooth_device_client_->GetPairingOptions(object_path);
device->SetString("path", object_path.value());
diff --git a/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.h b/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.h
index 840111b..882af77 100644
--- a/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.h
+++ b/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.h
@@ -17,9 +17,12 @@ namespace dbus {
class ObjectPath;
} // namespace dbus
+namespace bluez {
+class FakeBluetoothDeviceClient;
+}
+
namespace chromeos {
-class FakeBluetoothDeviceClient;
class FakeCrasAudioClient;
class FakePowerManagerClient;
@@ -99,7 +102,7 @@ class DeviceEmulatorMessageHandler
scoped_ptr<base::DictionaryValue> GetDeviceInfo(
const dbus::ObjectPath& object_path);
- FakeBluetoothDeviceClient* fake_bluetooth_device_client_;
+ bluez::FakeBluetoothDeviceClient* fake_bluetooth_device_client_;
scoped_ptr<BluetoothObserver> bluetooth_observer_;
FakeCrasAudioClient* fake_cras_audio_client_;
diff --git a/chrome/test/DEPS b/chrome/test/DEPS
index 2d596c8..2167a41 100644
--- a/chrome/test/DEPS
+++ b/chrome/test/DEPS
@@ -6,6 +6,7 @@ include_rules = [
"+chrome/grit", # For generated headers
"+chromeos",
"+components",
+ "+device/bluetooth/dbus",
"+extensions",
# Tests under chrome/ shouldn't need to access the internals of content/ and
diff --git a/chrome/test/base/testing_io_thread_state.cc b/chrome/test/base/testing_io_thread_state.cc
index 8ebd202..09b07f2 100644
--- a/chrome/test/base/testing_io_thread_state.cc
+++ b/chrome/test/base/testing_io_thread_state.cc
@@ -16,6 +16,7 @@
#if defined(OS_CHROMEOS)
#include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/network/network_handler.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
#endif
using content::BrowserThread;
@@ -42,6 +43,10 @@ TestingIOThreadState::TestingIOThreadState() {
#if defined(OS_CHROMEOS)
// Needed by IOThread constructor.
chromeos::DBusThreadManager::Initialize();
+ bluez::BluezDBusManager::Initialize(
+ chromeos::DBusThreadManager::Get()->GetSystemBus(),
+ chromeos::DBusThreadManager::Get()->IsUsingStub(
+ chromeos::DBusClientBundle::BLUETOOTH));
chromeos::NetworkHandler::Initialize();
#endif
@@ -75,6 +80,7 @@ TestingIOThreadState::~TestingIOThreadState() {
#if defined(OS_CHROMEOS)
chromeos::NetworkHandler::Shutdown();
+ bluez::BluezDBusManager::Shutdown();
chromeos::DBusThreadManager::Shutdown();
#endif
}
diff --git a/chrome/test/base/view_event_test_platform_part_chromeos.cc b/chrome/test/base/view_event_test_platform_part_chromeos.cc
index a73733f..37f48fb 100644
--- a/chrome/test/base/view_event_test_platform_part_chromeos.cc
+++ b/chrome/test/base/view_event_test_platform_part_chromeos.cc
@@ -13,6 +13,7 @@
#include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/network/network_handler.h"
#include "content/public/browser/browser_thread.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
#include "ui/aura/env.h"
#include "ui/aura/window_tree_host.h"
#include "ui/message_center/message_center.h"
@@ -44,6 +45,10 @@ ViewEventTestPlatformPartChromeOS::ViewEventTestPlatformPartChromeOS(
// also create the message center.
message_center::MessageCenter::Initialize();
chromeos::DBusThreadManager::Initialize();
+ bluez::BluezDBusManager::Initialize(
+ chromeos::DBusThreadManager::Get()->GetSystemBus(),
+ chromeos::DBusThreadManager::Get()->IsUsingStub(
+ chromeos::DBusClientBundle::BLUETOOTH));
chromeos::CrasAudioHandler::InitializeForTesting();
chromeos::NetworkHandler::Initialize();
@@ -66,6 +71,7 @@ ViewEventTestPlatformPartChromeOS::~ViewEventTestPlatformPartChromeOS() {
chromeos::NetworkHandler::Shutdown();
chromeos::CrasAudioHandler::Shutdown();
+ bluez::BluezDBusManager::Shutdown();
chromeos::DBusThreadManager::Shutdown();
// Ash Shell can't just live on its own without a browser process, we need to
// also shut down the message center.
diff --git a/chromeos/chromeos.gyp b/chromeos/chromeos.gyp
index 4ccdfca..abda945 100644
--- a/chromeos/chromeos.gyp
+++ b/chromeos/chromeos.gyp
@@ -59,44 +59,6 @@
'dbus/audio_node.h',
'dbus/blocking_method_caller.cc',
'dbus/blocking_method_caller.h',
- 'dbus/bluetooth_adapter_client.cc',
- 'dbus/bluetooth_adapter_client.h',
- 'dbus/bluetooth_le_advertising_manager_client.cc',
- 'dbus/bluetooth_le_advertising_manager_client.h',
- 'dbus/bluetooth_le_advertisement_service_provider.cc',
- 'dbus/bluetooth_le_advertisement_service_provider.h',
- 'dbus/bluetooth_agent_manager_client.cc',
- 'dbus/bluetooth_agent_manager_client.h',
- 'dbus/bluetooth_agent_service_provider.cc',
- 'dbus/bluetooth_agent_service_provider.h',
- 'dbus/bluetooth_device_client.cc',
- 'dbus/bluetooth_device_client.h',
- 'dbus/bluetooth_gatt_characteristic_client.cc',
- 'dbus/bluetooth_gatt_characteristic_client.h',
- 'dbus/bluetooth_gatt_characteristic_service_provider.cc',
- 'dbus/bluetooth_gatt_characteristic_service_provider.h',
- 'dbus/bluetooth_gatt_descriptor_client.cc',
- 'dbus/bluetooth_gatt_descriptor_client.h',
- 'dbus/bluetooth_gatt_descriptor_service_provider.cc',
- 'dbus/bluetooth_gatt_descriptor_service_provider.h',
- 'dbus/bluetooth_gatt_manager_client.cc',
- 'dbus/bluetooth_gatt_manager_client.h',
- 'dbus/bluetooth_gatt_service_client.cc',
- 'dbus/bluetooth_gatt_service_client.h',
- 'dbus/bluetooth_gatt_service_service_provider.cc',
- 'dbus/bluetooth_gatt_service_service_provider.h',
- 'dbus/bluetooth_input_client.cc',
- 'dbus/bluetooth_input_client.h',
- 'dbus/bluetooth_media_client.cc',
- 'dbus/bluetooth_media_client.h',
- 'dbus/bluetooth_media_endpoint_service_provider.cc',
- 'dbus/bluetooth_media_endpoint_service_provider.h',
- 'dbus/bluetooth_media_transport_client.cc',
- 'dbus/bluetooth_media_transport_client.h',
- 'dbus/bluetooth_profile_manager_client.cc',
- 'dbus/bluetooth_profile_manager_client.h',
- 'dbus/bluetooth_profile_service_provider.cc',
- 'dbus/bluetooth_profile_service_provider.h',
'dbus/cras_audio_client.cc',
'dbus/cras_audio_client.h',
'dbus/cros_disks_client.cc',
@@ -120,44 +82,6 @@
'dbus/fake_ap_manager_client.h',
'dbus/fake_audio_dsp_client.cc',
'dbus/fake_audio_dsp_client.h',
- 'dbus/fake_bluetooth_adapter_client.cc',
- 'dbus/fake_bluetooth_adapter_client.h',
- 'dbus/fake_bluetooth_le_advertising_manager_client.cc',
- 'dbus/fake_bluetooth_le_advertising_manager_client.h',
- 'dbus/fake_bluetooth_le_advertisement_service_provider.cc',
- 'dbus/fake_bluetooth_le_advertisement_service_provider.h',
- 'dbus/fake_bluetooth_agent_manager_client.cc',
- 'dbus/fake_bluetooth_agent_manager_client.h',
- 'dbus/fake_bluetooth_agent_service_provider.cc',
- 'dbus/fake_bluetooth_agent_service_provider.h',
- 'dbus/fake_bluetooth_device_client.cc',
- 'dbus/fake_bluetooth_device_client.h',
- 'dbus/fake_bluetooth_gatt_characteristic_client.cc',
- 'dbus/fake_bluetooth_gatt_characteristic_client.h',
- 'dbus/fake_bluetooth_gatt_characteristic_service_provider.cc',
- 'dbus/fake_bluetooth_gatt_characteristic_service_provider.h',
- 'dbus/fake_bluetooth_gatt_descriptor_client.cc',
- 'dbus/fake_bluetooth_gatt_descriptor_client.h',
- 'dbus/fake_bluetooth_gatt_descriptor_service_provider.cc',
- 'dbus/fake_bluetooth_gatt_descriptor_service_provider.h',
- 'dbus/fake_bluetooth_gatt_manager_client.cc',
- 'dbus/fake_bluetooth_gatt_manager_client.h',
- 'dbus/fake_bluetooth_gatt_service_client.cc',
- 'dbus/fake_bluetooth_gatt_service_client.h',
- 'dbus/fake_bluetooth_gatt_service_service_provider.cc',
- 'dbus/fake_bluetooth_gatt_service_service_provider.h',
- 'dbus/fake_bluetooth_input_client.cc',
- 'dbus/fake_bluetooth_input_client.h',
- 'dbus/fake_bluetooth_media_client.cc',
- 'dbus/fake_bluetooth_media_client.h',
- 'dbus/fake_bluetooth_media_endpoint_service_provider.cc',
- 'dbus/fake_bluetooth_media_endpoint_service_provider.h',
- 'dbus/fake_bluetooth_media_transport_client.cc',
- 'dbus/fake_bluetooth_media_transport_client.h',
- 'dbus/fake_bluetooth_profile_manager_client.cc',
- 'dbus/fake_bluetooth_profile_manager_client.h',
- 'dbus/fake_bluetooth_profile_service_provider.cc',
- 'dbus/fake_bluetooth_profile_service_provider.h',
'dbus/fake_cras_audio_client.cc',
'dbus/fake_cras_audio_client.h',
'dbus/fake_cros_disks_client.cc',
diff --git a/chromeos/dbus/dbus_client_bundle.cc b/chromeos/dbus/dbus_client_bundle.cc
index 20b0898..87e6598 100644
--- a/chromeos/dbus/dbus_client_bundle.cc
+++ b/chromeos/dbus/dbus_client_bundle.cc
@@ -13,18 +13,6 @@
#include "chromeos/dbus/amplifier_client.h"
#include "chromeos/dbus/ap_manager_client.h"
#include "chromeos/dbus/audio_dsp_client.h"
-#include "chromeos/dbus/bluetooth_adapter_client.h"
-#include "chromeos/dbus/bluetooth_agent_manager_client.h"
-#include "chromeos/dbus/bluetooth_device_client.h"
-#include "chromeos/dbus/bluetooth_gatt_characteristic_client.h"
-#include "chromeos/dbus/bluetooth_gatt_descriptor_client.h"
-#include "chromeos/dbus/bluetooth_gatt_manager_client.h"
-#include "chromeos/dbus/bluetooth_gatt_service_client.h"
-#include "chromeos/dbus/bluetooth_input_client.h"
-#include "chromeos/dbus/bluetooth_le_advertising_manager_client.h"
-#include "chromeos/dbus/bluetooth_media_client.h"
-#include "chromeos/dbus/bluetooth_media_transport_client.h"
-#include "chromeos/dbus/bluetooth_profile_manager_client.h"
#include "chromeos/dbus/cras_audio_client.h"
#include "chromeos/dbus/cros_disks_client.h"
#include "chromeos/dbus/cryptohome_client.h"
@@ -33,18 +21,6 @@
#include "chromeos/dbus/fake_amplifier_client.h"
#include "chromeos/dbus/fake_ap_manager_client.h"
#include "chromeos/dbus/fake_audio_dsp_client.h"
-#include "chromeos/dbus/fake_bluetooth_adapter_client.h"
-#include "chromeos/dbus/fake_bluetooth_agent_manager_client.h"
-#include "chromeos/dbus/fake_bluetooth_device_client.h"
-#include "chromeos/dbus/fake_bluetooth_gatt_characteristic_client.h"
-#include "chromeos/dbus/fake_bluetooth_gatt_descriptor_client.h"
-#include "chromeos/dbus/fake_bluetooth_gatt_manager_client.h"
-#include "chromeos/dbus/fake_bluetooth_gatt_service_client.h"
-#include "chromeos/dbus/fake_bluetooth_input_client.h"
-#include "chromeos/dbus/fake_bluetooth_le_advertising_manager_client.h"
-#include "chromeos/dbus/fake_bluetooth_media_client.h"
-#include "chromeos/dbus/fake_bluetooth_media_transport_client.h"
-#include "chromeos/dbus/fake_bluetooth_profile_manager_client.h"
#include "chromeos/dbus/fake_cras_audio_client.h"
#include "chromeos/dbus/fake_cryptohome_client.h"
#include "chromeos/dbus/fake_debug_daemon_client.h"
@@ -157,47 +133,6 @@ DBusClientBundle::DBusClientBundle(DBusClientTypeMask unstub_client_mask)
else
audio_dsp_client_.reset(new FakeAudioDspClient);
- if (!IsUsingStub(BLUETOOTH)) {
- bluetooth_adapter_client_.reset(BluetoothAdapterClient::Create());
- bluetooth_le_advertising_manager_client_.reset(
- BluetoothLEAdvertisingManagerClient::Create());
- bluetooth_agent_manager_client_.reset(
- BluetoothAgentManagerClient::Create());
- bluetooth_device_client_.reset(BluetoothDeviceClient::Create());
- bluetooth_input_client_.reset(BluetoothInputClient::Create());
- bluetooth_media_client_.reset(BluetoothMediaClient::Create());
- bluetooth_media_transport_client_.reset(
- BluetoothMediaTransportClient::Create());
- bluetooth_profile_manager_client_.reset(
- BluetoothProfileManagerClient::Create());
- bluetooth_gatt_characteristic_client_.reset(
- BluetoothGattCharacteristicClient::Create());
- bluetooth_gatt_descriptor_client_.reset(
- BluetoothGattDescriptorClient::Create());
- bluetooth_gatt_manager_client_.reset(
- BluetoothGattManagerClient::Create());
- bluetooth_gatt_service_client_.reset(
- BluetoothGattServiceClient::Create());
- } else {
- bluetooth_adapter_client_.reset(new FakeBluetoothAdapterClient);
- bluetooth_le_advertising_manager_client_.reset(
- new FakeBluetoothLEAdvertisingManagerClient);
- bluetooth_agent_manager_client_.reset(new FakeBluetoothAgentManagerClient);
- bluetooth_device_client_.reset(new FakeBluetoothDeviceClient);
- bluetooth_input_client_.reset(new FakeBluetoothInputClient);
- bluetooth_media_client_.reset(new FakeBluetoothMediaClient);
- bluetooth_media_transport_client_.reset(
- new FakeBluetoothMediaTransportClient);
- bluetooth_profile_manager_client_.reset(
- new FakeBluetoothProfileManagerClient);
- bluetooth_gatt_characteristic_client_.reset(
- new FakeBluetoothGattCharacteristicClient);
- bluetooth_gatt_descriptor_client_.reset(
- new FakeBluetoothGattDescriptorClient);
- bluetooth_gatt_manager_client_.reset(new FakeBluetoothGattManagerClient);
- bluetooth_gatt_service_client_.reset(new FakeBluetoothGattServiceClient);
- }
-
if (!IsUsingStub(CRAS))
cras_audio_client_.reset(CrasAudioClient::Create());
else
diff --git a/chromeos/dbus/dbus_client_bundle.h b/chromeos/dbus/dbus_client_bundle.h
index a9a115b..ea39ad9 100644
--- a/chromeos/dbus/dbus_client_bundle.h
+++ b/chromeos/dbus/dbus_client_bundle.h
@@ -15,18 +15,6 @@ namespace chromeos {
class AmplifierClient;
class ApManagerClient;
class AudioDspClient;
-class BluetoothAdapterClient;
-class BluetoothAgentManagerClient;
-class BluetoothDeviceClient;
-class BluetoothGattCharacteristicClient;
-class BluetoothGattDescriptorClient;
-class BluetoothGattManagerClient;
-class BluetoothGattServiceClient;
-class BluetoothInputClient;
-class BluetoothLEAdvertisingManagerClient;
-class BluetoothMediaClient;
-class BluetoothMediaTransportClient;
-class BluetoothProfileManagerClient;
class CrasAudioClient;
class CrosDisksClient;
class CryptohomeClient;
@@ -116,55 +104,6 @@ class CHROMEOS_EXPORT DBusClientBundle {
AudioDspClient* audio_dsp_client() { return audio_dsp_client_.get(); }
- BluetoothAdapterClient* bluetooth_adapter_client() {
- return bluetooth_adapter_client_.get();
- }
-
- BluetoothLEAdvertisingManagerClient*
- bluetooth_le_advertising_manager_client() {
- return bluetooth_le_advertising_manager_client_.get();
- }
-
- BluetoothAgentManagerClient* bluetooth_agent_manager_client() {
- return bluetooth_agent_manager_client_.get();
- }
-
- BluetoothDeviceClient* bluetooth_device_client() {
- return bluetooth_device_client_.get();
- }
-
- BluetoothGattCharacteristicClient* bluetooth_gatt_characteristic_client() {
- return bluetooth_gatt_characteristic_client_.get();
- }
-
- BluetoothGattDescriptorClient* bluetooth_gatt_descriptor_client() {
- return bluetooth_gatt_descriptor_client_.get();
- }
-
- BluetoothGattManagerClient* bluetooth_gatt_manager_client() {
- return bluetooth_gatt_manager_client_.get();
- }
-
- BluetoothGattServiceClient* bluetooth_gatt_service_client() {
- return bluetooth_gatt_service_client_.get();
- }
-
- BluetoothInputClient* bluetooth_input_client() {
- return bluetooth_input_client_.get();
- }
-
- BluetoothMediaClient* bluetooth_media_client() {
- return bluetooth_media_client_.get();
- }
-
- BluetoothMediaTransportClient* bluetooth_media_transport_client() {
- return bluetooth_media_transport_client_.get();
- }
-
- BluetoothProfileManagerClient* bluetooth_profile_manager_client() {
- return bluetooth_profile_manager_client_.get();
- }
-
CrasAudioClient* cras_audio_client() {
return cras_audio_client_.get();
}
@@ -291,20 +230,6 @@ class CHROMEOS_EXPORT DBusClientBundle {
scoped_ptr<AmplifierClient> amplifier_client_;
scoped_ptr<ApManagerClient> ap_manager_client_;
scoped_ptr<AudioDspClient> audio_dsp_client_;
- scoped_ptr<BluetoothAdapterClient> bluetooth_adapter_client_;
- scoped_ptr<BluetoothLEAdvertisingManagerClient>
- bluetooth_le_advertising_manager_client_;
- scoped_ptr<BluetoothAgentManagerClient> bluetooth_agent_manager_client_;
- scoped_ptr<BluetoothDeviceClient> bluetooth_device_client_;
- scoped_ptr<BluetoothGattCharacteristicClient>
- bluetooth_gatt_characteristic_client_;
- scoped_ptr<BluetoothGattDescriptorClient> bluetooth_gatt_descriptor_client_;
- scoped_ptr<BluetoothGattManagerClient> bluetooth_gatt_manager_client_;
- scoped_ptr<BluetoothGattServiceClient> bluetooth_gatt_service_client_;
- scoped_ptr<BluetoothInputClient> bluetooth_input_client_;
- scoped_ptr<BluetoothMediaClient> bluetooth_media_client_;
- scoped_ptr<BluetoothMediaTransportClient> bluetooth_media_transport_client_;
- scoped_ptr<BluetoothProfileManagerClient> bluetooth_profile_manager_client_;
scoped_ptr<CrasAudioClient> cras_audio_client_;
scoped_ptr<CrosDisksClient> cros_disks_client_;
scoped_ptr<CryptohomeClient> cryptohome_client_;
diff --git a/chromeos/dbus/dbus_thread_manager.cc b/chromeos/dbus/dbus_thread_manager.cc
index fb525b5..fe59021 100644
--- a/chromeos/dbus/dbus_thread_manager.cc
+++ b/chromeos/dbus/dbus_thread_manager.cc
@@ -11,18 +11,6 @@
#include "chromeos/dbus/amplifier_client.h"
#include "chromeos/dbus/ap_manager_client.h"
#include "chromeos/dbus/audio_dsp_client.h"
-#include "chromeos/dbus/bluetooth_adapter_client.h"
-#include "chromeos/dbus/bluetooth_agent_manager_client.h"
-#include "chromeos/dbus/bluetooth_device_client.h"
-#include "chromeos/dbus/bluetooth_gatt_characteristic_client.h"
-#include "chromeos/dbus/bluetooth_gatt_descriptor_client.h"
-#include "chromeos/dbus/bluetooth_gatt_manager_client.h"
-#include "chromeos/dbus/bluetooth_gatt_service_client.h"
-#include "chromeos/dbus/bluetooth_input_client.h"
-#include "chromeos/dbus/bluetooth_le_advertising_manager_client.h"
-#include "chromeos/dbus/bluetooth_media_client.h"
-#include "chromeos/dbus/bluetooth_media_transport_client.h"
-#include "chromeos/dbus/bluetooth_profile_manager_client.h"
#include "chromeos/dbus/cras_audio_client.h"
#include "chromeos/dbus/cros_disks_client.h"
#include "chromeos/dbus/cryptohome_client.h"
@@ -127,62 +115,6 @@ AudioDspClient* DBusThreadManager::GetAudioDspClient() {
return client_bundle_->audio_dsp_client();
}
-BluetoothAdapterClient* DBusThreadManager::GetBluetoothAdapterClient() {
- return client_bundle_->bluetooth_adapter_client();
-}
-
-BluetoothLEAdvertisingManagerClient*
-DBusThreadManager::GetBluetoothLEAdvertisingManagerClient() {
- return client_bundle_->bluetooth_le_advertising_manager_client();
-}
-
-BluetoothAgentManagerClient*
-DBusThreadManager::GetBluetoothAgentManagerClient() {
- return client_bundle_->bluetooth_agent_manager_client();
-}
-
-BluetoothDeviceClient* DBusThreadManager::GetBluetoothDeviceClient() {
- return client_bundle_->bluetooth_device_client();
-}
-
-BluetoothGattCharacteristicClient*
-DBusThreadManager::GetBluetoothGattCharacteristicClient() {
- return client_bundle_->bluetooth_gatt_characteristic_client();
-}
-
-BluetoothGattDescriptorClient*
-DBusThreadManager::GetBluetoothGattDescriptorClient() {
- return client_bundle_->bluetooth_gatt_descriptor_client();
-}
-
-BluetoothGattManagerClient*
-DBusThreadManager::GetBluetoothGattManagerClient() {
- return client_bundle_->bluetooth_gatt_manager_client();
-}
-
-BluetoothGattServiceClient*
-DBusThreadManager::GetBluetoothGattServiceClient() {
- return client_bundle_->bluetooth_gatt_service_client();
-}
-
-BluetoothInputClient* DBusThreadManager::GetBluetoothInputClient() {
- return client_bundle_->bluetooth_input_client();
-}
-
-BluetoothMediaClient* DBusThreadManager::GetBluetoothMediaClient() {
- return client_bundle_->bluetooth_media_client();
-}
-
-BluetoothMediaTransportClient*
-DBusThreadManager::GetBluetoothMediaTransportClient() {
- return client_bundle_->bluetooth_media_transport_client();
-}
-
-BluetoothProfileManagerClient*
-DBusThreadManager::GetBluetoothProfileManagerClient() {
- return client_bundle_->bluetooth_profile_manager_client();
-}
-
CrasAudioClient* DBusThreadManager::GetCrasAudioClient() {
return client_bundle_->cras_audio_client();
}
@@ -310,18 +242,6 @@ void DBusThreadManager::InitializeClients() {
GetAmplifierClient()->Init(GetSystemBus());
GetApManagerClient()->Init(GetSystemBus());
GetAudioDspClient()->Init(GetSystemBus());
- GetBluetoothAdapterClient()->Init(GetSystemBus());
- GetBluetoothAgentManagerClient()->Init(GetSystemBus());
- GetBluetoothDeviceClient()->Init(GetSystemBus());
- GetBluetoothGattCharacteristicClient()->Init(GetSystemBus());
- GetBluetoothGattDescriptorClient()->Init(GetSystemBus());
- GetBluetoothGattManagerClient()->Init(GetSystemBus());
- GetBluetoothGattServiceClient()->Init(GetSystemBus());
- GetBluetoothInputClient()->Init(GetSystemBus());
- GetBluetoothLEAdvertisingManagerClient()->Init(GetSystemBus());
- GetBluetoothMediaClient()->Init(GetSystemBus());
- GetBluetoothMediaTransportClient()->Init(GetSystemBus());
- GetBluetoothProfileManagerClient()->Init(GetSystemBus());
GetCrasAudioClient()->Init(GetSystemBus());
GetCrosDisksClient()->Init(GetSystemBus());
GetCryptohomeClient()->Init(GetSystemBus());
@@ -476,78 +396,6 @@ void DBusThreadManagerSetter::SetAudioDspClient(
DBusThreadManager::Get()->client_bundle_->audio_dsp_client_ = client.Pass();
}
-void DBusThreadManagerSetter::SetBluetoothAdapterClient(
- scoped_ptr<BluetoothAdapterClient> client) {
- DBusThreadManager::Get()->client_bundle_->bluetooth_adapter_client_ =
- client.Pass();
-}
-
-void DBusThreadManagerSetter::SetBluetoothLEAdvertisingManagerClient(
- scoped_ptr<BluetoothLEAdvertisingManagerClient> client) {
- DBusThreadManager::Get()->client_bundle_->
- bluetooth_le_advertising_manager_client_ = client.Pass();
-}
-
-void DBusThreadManagerSetter::SetBluetoothAgentManagerClient(
- scoped_ptr<BluetoothAgentManagerClient> client) {
- DBusThreadManager::Get()->client_bundle_->bluetooth_agent_manager_client_ =
- client.Pass();
-}
-
-void DBusThreadManagerSetter::SetBluetoothDeviceClient(
- scoped_ptr<BluetoothDeviceClient> client) {
- DBusThreadManager::Get()->client_bundle_->bluetooth_device_client_ =
- client.Pass();
-}
-
-void DBusThreadManagerSetter::SetBluetoothGattCharacteristicClient(
- scoped_ptr<BluetoothGattCharacteristicClient> client) {
- DBusThreadManager::Get()->client_bundle_->
- bluetooth_gatt_characteristic_client_ = client.Pass();
-}
-
-void DBusThreadManagerSetter::SetBluetoothGattDescriptorClient(
- scoped_ptr<BluetoothGattDescriptorClient> client) {
- DBusThreadManager::Get()->client_bundle_->bluetooth_gatt_descriptor_client_ =
- client.Pass();
-}
-
-void DBusThreadManagerSetter::SetBluetoothGattManagerClient(
- scoped_ptr<BluetoothGattManagerClient> client) {
- DBusThreadManager::Get()->client_bundle_->bluetooth_gatt_manager_client_ =
- client.Pass();
-}
-
-void DBusThreadManagerSetter::SetBluetoothGattServiceClient(
- scoped_ptr<BluetoothGattServiceClient> client) {
- DBusThreadManager::Get()->client_bundle_->bluetooth_gatt_service_client_ =
- client.Pass();
-}
-
-void DBusThreadManagerSetter::SetBluetoothInputClient(
- scoped_ptr<BluetoothInputClient> client) {
- DBusThreadManager::Get()->client_bundle_->bluetooth_input_client_ =
- client.Pass();
-}
-
-void DBusThreadManagerSetter::SetBluetoothMediaClient(
- scoped_ptr<BluetoothMediaClient> client) {
- DBusThreadManager::Get()->client_bundle_->bluetooth_media_client_ =
- client.Pass();
-}
-
-void DBusThreadManagerSetter::SetBluetoothMediaTransportClient(
- scoped_ptr<BluetoothMediaTransportClient> client) {
- DBusThreadManager::Get()->client_bundle_->bluetooth_media_transport_client_ =
- client.Pass();
-}
-
-void DBusThreadManagerSetter::SetBluetoothProfileManagerClient(
- scoped_ptr<BluetoothProfileManagerClient> client) {
- DBusThreadManager::Get()->client_bundle_->bluetooth_profile_manager_client_ =
- client.Pass();
-}
-
void DBusThreadManagerSetter::SetCrasAudioClient(
scoped_ptr<CrasAudioClient> client) {
DBusThreadManager::Get()->client_bundle_->cras_audio_client_ = client.Pass();
diff --git a/chromeos/dbus/dbus_thread_manager.h b/chromeos/dbus/dbus_thread_manager.h
index 322ab28..83f3c26 100644
--- a/chromeos/dbus/dbus_thread_manager.h
+++ b/chromeos/dbus/dbus_thread_manager.h
@@ -28,18 +28,6 @@ namespace chromeos {
class AmplifierClient;
class ApManagerClient;
class AudioDspClient;
-class BluetoothAdapterClient;
-class BluetoothLEAdvertisingManagerClient;
-class BluetoothAgentManagerClient;
-class BluetoothDeviceClient;
-class BluetoothGattCharacteristicClient;
-class BluetoothGattDescriptorClient;
-class BluetoothGattManagerClient;
-class BluetoothGattServiceClient;
-class BluetoothInputClient;
-class BluetoothMediaClient;
-class BluetoothMediaTransportClient;
-class BluetoothProfileManagerClient;
class CrasAudioClient;
class CrosDisksClient;
class CryptohomeClient;
@@ -124,18 +112,6 @@ class CHROMEOS_EXPORT DBusThreadManager {
AmplifierClient* GetAmplifierClient();
ApManagerClient* GetApManagerClient();
AudioDspClient* GetAudioDspClient();
- BluetoothAdapterClient* GetBluetoothAdapterClient();
- BluetoothLEAdvertisingManagerClient* GetBluetoothLEAdvertisingManagerClient();
- BluetoothAgentManagerClient* GetBluetoothAgentManagerClient();
- BluetoothDeviceClient* GetBluetoothDeviceClient();
- BluetoothGattCharacteristicClient* GetBluetoothGattCharacteristicClient();
- BluetoothGattDescriptorClient* GetBluetoothGattDescriptorClient();
- BluetoothGattManagerClient* GetBluetoothGattManagerClient();
- BluetoothGattServiceClient* GetBluetoothGattServiceClient();
- BluetoothInputClient* GetBluetoothInputClient();
- BluetoothMediaClient* GetBluetoothMediaClient();
- BluetoothMediaTransportClient* GetBluetoothMediaTransportClient();
- BluetoothProfileManagerClient* GetBluetoothProfileManagerClient();
CrasAudioClient* GetCrasAudioClient();
CrosDisksClient* GetCrosDisksClient();
CryptohomeClient* GetCryptohomeClient();
@@ -210,26 +186,6 @@ class CHROMEOS_EXPORT DBusThreadManagerSetter {
void SetAmplifierClient(scoped_ptr<AmplifierClient> client);
void SetAudioDspClient(scoped_ptr<AudioDspClient> client);
- void SetBluetoothAdapterClient(scoped_ptr<BluetoothAdapterClient> client);
- void SetBluetoothLEAdvertisingManagerClient(
- scoped_ptr<BluetoothLEAdvertisingManagerClient> client);
- void SetBluetoothAgentManagerClient(
- scoped_ptr<BluetoothAgentManagerClient> client);
- void SetBluetoothDeviceClient(scoped_ptr<BluetoothDeviceClient> client);
- void SetBluetoothGattCharacteristicClient(
- scoped_ptr<BluetoothGattCharacteristicClient> client);
- void SetBluetoothGattDescriptorClient(
- scoped_ptr<BluetoothGattDescriptorClient> client);
- void SetBluetoothGattManagerClient(
- scoped_ptr<BluetoothGattManagerClient> client);
- void SetBluetoothGattServiceClient(
- scoped_ptr<BluetoothGattServiceClient> client);
- void SetBluetoothInputClient(scoped_ptr<BluetoothInputClient> client);
- void SetBluetoothMediaClient(scoped_ptr<BluetoothMediaClient> client);
- void SetBluetoothMediaTransportClient(
- scoped_ptr<BluetoothMediaTransportClient> client);
- void SetBluetoothProfileManagerClient(
- scoped_ptr<BluetoothProfileManagerClient> client);
void SetCrasAudioClient(scoped_ptr<CrasAudioClient> client);
void SetCrosDisksClient(scoped_ptr<CrosDisksClient> client);
void SetCryptohomeClient(scoped_ptr<CryptohomeClient> client);
diff --git a/device/bluetooth/BUILD.gn b/device/bluetooth/BUILD.gn
index cb8f293..69da108 100644
--- a/device/bluetooth/BUILD.gn
+++ b/device/bluetooth/BUILD.gn
@@ -157,6 +157,95 @@ component("bluetooth") {
if (is_win) {
libs = [ "setupapi.lib" ]
}
+
+ # This block will also build for Linux once we write the linux
+ # implementation of BluezDbusManager.
+ if (is_chromeos) {
+ defines += [ "DEVICE_BLUETOOTH_IMPLEMENTATION" ]
+ sources += [
+ "dbus/bluetooth_adapter_client.cc",
+ "dbus/bluetooth_adapter_client.h",
+ "dbus/bluetooth_agent_manager_client.cc",
+ "dbus/bluetooth_agent_manager_client.h",
+ "dbus/bluetooth_agent_service_provider.cc",
+ "dbus/bluetooth_agent_service_provider.h",
+ "dbus/bluetooth_dbus_client_bundle.cc",
+ "dbus/bluetooth_dbus_client_bundle.h",
+ "dbus/bluetooth_device_client.cc",
+ "dbus/bluetooth_device_client.h",
+ "dbus/bluetooth_gatt_characteristic_client.cc",
+ "dbus/bluetooth_gatt_characteristic_client.h",
+ "dbus/bluetooth_gatt_characteristic_service_provider.cc",
+ "dbus/bluetooth_gatt_characteristic_service_provider.h",
+ "dbus/bluetooth_gatt_descriptor_client.cc",
+ "dbus/bluetooth_gatt_descriptor_client.h",
+ "dbus/bluetooth_gatt_descriptor_service_provider.cc",
+ "dbus/bluetooth_gatt_descriptor_service_provider.h",
+ "dbus/bluetooth_gatt_manager_client.cc",
+ "dbus/bluetooth_gatt_manager_client.h",
+ "dbus/bluetooth_gatt_service_client.cc",
+ "dbus/bluetooth_gatt_service_client.h",
+ "dbus/bluetooth_gatt_service_service_provider.cc",
+ "dbus/bluetooth_gatt_service_service_provider.h",
+ "dbus/bluetooth_input_client.cc",
+ "dbus/bluetooth_input_client.h",
+ "dbus/bluetooth_le_advertisement_service_provider.cc",
+ "dbus/bluetooth_le_advertisement_service_provider.h",
+ "dbus/bluetooth_le_advertising_manager_client.cc",
+ "dbus/bluetooth_le_advertising_manager_client.h",
+ "dbus/bluetooth_media_client.cc",
+ "dbus/bluetooth_media_client.h",
+ "dbus/bluetooth_media_endpoint_service_provider.cc",
+ "dbus/bluetooth_media_endpoint_service_provider.h",
+ "dbus/bluetooth_media_transport_client.cc",
+ "dbus/bluetooth_media_transport_client.h",
+ "dbus/bluetooth_profile_manager_client.cc",
+ "dbus/bluetooth_profile_manager_client.h",
+ "dbus/bluetooth_profile_service_provider.cc",
+ "dbus/bluetooth_profile_service_provider.h",
+ "dbus/bluez_dbus_client.h",
+ "dbus/bluez_dbus_manager.cc",
+ "dbus/bluez_dbus_manager.h",
+ "dbus/fake_bluetooth_adapter_client.cc",
+ "dbus/fake_bluetooth_adapter_client.h",
+ "dbus/fake_bluetooth_agent_manager_client.cc",
+ "dbus/fake_bluetooth_agent_manager_client.h",
+ "dbus/fake_bluetooth_agent_service_provider.cc",
+ "dbus/fake_bluetooth_agent_service_provider.h",
+ "dbus/fake_bluetooth_device_client.cc",
+ "dbus/fake_bluetooth_device_client.h",
+ "dbus/fake_bluetooth_gatt_characteristic_client.cc",
+ "dbus/fake_bluetooth_gatt_characteristic_client.h",
+ "dbus/fake_bluetooth_gatt_characteristic_service_provider.cc",
+ "dbus/fake_bluetooth_gatt_characteristic_service_provider.h",
+ "dbus/fake_bluetooth_gatt_descriptor_client.cc",
+ "dbus/fake_bluetooth_gatt_descriptor_client.h",
+ "dbus/fake_bluetooth_gatt_descriptor_service_provider.cc",
+ "dbus/fake_bluetooth_gatt_descriptor_service_provider.h",
+ "dbus/fake_bluetooth_gatt_manager_client.cc",
+ "dbus/fake_bluetooth_gatt_manager_client.h",
+ "dbus/fake_bluetooth_gatt_service_client.cc",
+ "dbus/fake_bluetooth_gatt_service_client.h",
+ "dbus/fake_bluetooth_gatt_service_service_provider.cc",
+ "dbus/fake_bluetooth_gatt_service_service_provider.h",
+ "dbus/fake_bluetooth_input_client.cc",
+ "dbus/fake_bluetooth_input_client.h",
+ "dbus/fake_bluetooth_le_advertisement_service_provider.cc",
+ "dbus/fake_bluetooth_le_advertisement_service_provider.h",
+ "dbus/fake_bluetooth_le_advertising_manager_client.cc",
+ "dbus/fake_bluetooth_le_advertising_manager_client.h",
+ "dbus/fake_bluetooth_media_client.cc",
+ "dbus/fake_bluetooth_media_client.h",
+ "dbus/fake_bluetooth_media_endpoint_service_provider.cc",
+ "dbus/fake_bluetooth_media_endpoint_service_provider.h",
+ "dbus/fake_bluetooth_media_transport_client.cc",
+ "dbus/fake_bluetooth_media_transport_client.h",
+ "dbus/fake_bluetooth_profile_manager_client.cc",
+ "dbus/fake_bluetooth_profile_manager_client.h",
+ "dbus/fake_bluetooth_profile_service_provider.cc",
+ "dbus/fake_bluetooth_profile_service_provider.h",
+ ]
+ }
}
static_library("mocks") {
diff --git a/device/bluetooth/bluetooth.gyp b/device/bluetooth/bluetooth.gyp
index 881a160..5e4e821 100644
--- a/device/bluetooth/bluetooth.gyp
+++ b/device/bluetooth/bluetooth.gyp
@@ -129,6 +129,96 @@
'bluetooth_uuid.h',
],
'conditions': [
+ # This block will also build for Linux once we write the linux
+ # implementation of BluezDbusManager.
+ ['chromeos==1', {
+ 'defines': [
+ 'DEVICE_BLUETOOTH_IMPLEMENTATION',
+ ],
+ 'sources': [
+ 'dbus/bluetooth_adapter_client.cc',
+ 'dbus/bluetooth_adapter_client.h',
+ 'dbus/bluetooth_le_advertising_manager_client.cc',
+ 'dbus/bluetooth_le_advertising_manager_client.h',
+ 'dbus/bluetooth_le_advertisement_service_provider.cc',
+ 'dbus/bluetooth_le_advertisement_service_provider.h',
+ 'dbus/bluetooth_agent_manager_client.cc',
+ 'dbus/bluetooth_agent_manager_client.h',
+ 'dbus/bluetooth_agent_service_provider.cc',
+ 'dbus/bluetooth_agent_service_provider.h',
+ 'dbus/bluetooth_dbus_client_bundle.cc',
+ 'dbus/bluetooth_dbus_client_bundle.h',
+ 'dbus/bluetooth_device_client.cc',
+ 'dbus/bluetooth_device_client.h',
+ 'dbus/bluetooth_gatt_characteristic_client.cc',
+ 'dbus/bluetooth_gatt_characteristic_client.h',
+ 'dbus/bluetooth_gatt_characteristic_service_provider.cc',
+ 'dbus/bluetooth_gatt_characteristic_service_provider.h',
+ 'dbus/bluetooth_gatt_descriptor_client.cc',
+ 'dbus/bluetooth_gatt_descriptor_client.h',
+ 'dbus/bluetooth_gatt_descriptor_service_provider.cc',
+ 'dbus/bluetooth_gatt_descriptor_service_provider.h',
+ 'dbus/bluetooth_gatt_manager_client.cc',
+ 'dbus/bluetooth_gatt_manager_client.h',
+ 'dbus/bluetooth_gatt_service_client.cc',
+ 'dbus/bluetooth_gatt_service_client.h',
+ 'dbus/bluetooth_gatt_service_service_provider.cc',
+ 'dbus/bluetooth_gatt_service_service_provider.h',
+ 'dbus/bluetooth_input_client.cc',
+ 'dbus/bluetooth_input_client.h',
+ 'dbus/bluetooth_media_client.cc',
+ 'dbus/bluetooth_media_client.h',
+ 'dbus/bluetooth_media_endpoint_service_provider.cc',
+ 'dbus/bluetooth_media_endpoint_service_provider.h',
+ 'dbus/bluetooth_media_transport_client.cc',
+ 'dbus/bluetooth_media_transport_client.h',
+ 'dbus/bluetooth_profile_manager_client.cc',
+ 'dbus/bluetooth_profile_manager_client.h',
+ 'dbus/bluetooth_profile_service_provider.cc',
+ 'dbus/bluetooth_profile_service_provider.h',
+ 'dbus/bluez_dbus_client.h',
+ 'dbus/bluez_dbus_manager.cc',
+ 'dbus/bluez_dbus_manager.h',
+ 'dbus/fake_bluetooth_adapter_client.cc',
+ 'dbus/fake_bluetooth_adapter_client.h',
+ 'dbus/fake_bluetooth_le_advertising_manager_client.cc',
+ 'dbus/fake_bluetooth_le_advertising_manager_client.h',
+ 'dbus/fake_bluetooth_le_advertisement_service_provider.cc',
+ 'dbus/fake_bluetooth_le_advertisement_service_provider.h',
+ 'dbus/fake_bluetooth_agent_manager_client.cc',
+ 'dbus/fake_bluetooth_agent_manager_client.h',
+ 'dbus/fake_bluetooth_agent_service_provider.cc',
+ 'dbus/fake_bluetooth_agent_service_provider.h',
+ 'dbus/fake_bluetooth_device_client.cc',
+ 'dbus/fake_bluetooth_device_client.h',
+ 'dbus/fake_bluetooth_gatt_characteristic_client.cc',
+ 'dbus/fake_bluetooth_gatt_characteristic_client.h',
+ 'dbus/fake_bluetooth_gatt_characteristic_service_provider.cc',
+ 'dbus/fake_bluetooth_gatt_characteristic_service_provider.h',
+ 'dbus/fake_bluetooth_gatt_descriptor_client.cc',
+ 'dbus/fake_bluetooth_gatt_descriptor_client.h',
+ 'dbus/fake_bluetooth_gatt_descriptor_service_provider.cc',
+ 'dbus/fake_bluetooth_gatt_descriptor_service_provider.h',
+ 'dbus/fake_bluetooth_gatt_manager_client.cc',
+ 'dbus/fake_bluetooth_gatt_manager_client.h',
+ 'dbus/fake_bluetooth_gatt_service_client.cc',
+ 'dbus/fake_bluetooth_gatt_service_client.h',
+ 'dbus/fake_bluetooth_gatt_service_service_provider.cc',
+ 'dbus/fake_bluetooth_gatt_service_service_provider.h',
+ 'dbus/fake_bluetooth_input_client.cc',
+ 'dbus/fake_bluetooth_input_client.h',
+ 'dbus/fake_bluetooth_media_client.cc',
+ 'dbus/fake_bluetooth_media_client.h',
+ 'dbus/fake_bluetooth_media_endpoint_service_provider.cc',
+ 'dbus/fake_bluetooth_media_endpoint_service_provider.h',
+ 'dbus/fake_bluetooth_media_transport_client.cc',
+ 'dbus/fake_bluetooth_media_transport_client.h',
+ 'dbus/fake_bluetooth_profile_manager_client.cc',
+ 'dbus/fake_bluetooth_profile_manager_client.h',
+ 'dbus/fake_bluetooth_profile_service_provider.cc',
+ 'dbus/fake_bluetooth_profile_service_provider.h',
+ ],
+ }],
['chromeos==1', {
'dependencies': [
'../../build/linux/system.gyp:dbus',
diff --git a/device/bluetooth/bluetooth_adapter_chromeos.cc b/device/bluetooth/bluetooth_adapter_chromeos.cc
index 1ba14a5..15f30bf 100644
--- a/device/bluetooth/bluetooth_adapter_chromeos.cc
+++ b/device/bluetooth/bluetooth_adapter_chromeos.cc
@@ -13,12 +13,6 @@
#include "base/sequenced_task_runner.h"
#include "base/single_thread_task_runner.h"
#include "base/thread_task_runner_handle.h"
-#include "chromeos/dbus/bluetooth_adapter_client.h"
-#include "chromeos/dbus/bluetooth_agent_manager_client.h"
-#include "chromeos/dbus/bluetooth_agent_service_provider.h"
-#include "chromeos/dbus/bluetooth_device_client.h"
-#include "chromeos/dbus/bluetooth_input_client.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/system/devicetype.h"
#include "device/bluetooth/bluetooth_adapter_profile_chromeos.h"
#include "device/bluetooth/bluetooth_advertisement_chromeos.h"
@@ -33,6 +27,12 @@
#include "device/bluetooth/bluetooth_socket_chromeos.h"
#include "device/bluetooth/bluetooth_socket_thread.h"
#include "device/bluetooth/bluetooth_uuid.h"
+#include "device/bluetooth/dbus/bluetooth_adapter_client.h"
+#include "device/bluetooth/dbus/bluetooth_agent_manager_client.h"
+#include "device/bluetooth/dbus/bluetooth_agent_service_provider.h"
+#include "device/bluetooth/dbus/bluetooth_device_client.h"
+#include "device/bluetooth/dbus/bluetooth_input_client.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
using device::BluetoothAdapter;
@@ -61,9 +61,9 @@ void OnUnregisterAgentError(const std::string& error_name,
UMABluetoothDiscoverySessionOutcome TranslateDiscoveryErrorToUMA(
const std::string& error_name) {
- if (error_name == chromeos::BluetoothAdapterClient::kUnknownAdapterError) {
+ if (error_name == bluez::BluetoothAdapterClient::kUnknownAdapterError) {
return UMABluetoothDiscoverySessionOutcome::CHROMEOS_DBUS_UNKNOWN_ADAPTER;
- } else if (error_name == chromeos::BluetoothAdapterClient::kNoResponseError) {
+ } else if (error_name == bluez::BluetoothAdapterClient::kNoResponseError) {
return UMABluetoothDiscoverySessionOutcome::CHROMEOS_DBUS_NO_RESPONSE;
} else if (error_name == bluetooth_device::kErrorInProgress) {
return UMABluetoothDiscoverySessionOutcome::CHROMEOS_DBUS_IN_PROGRESS;
@@ -100,9 +100,9 @@ base::WeakPtr<BluetoothAdapter> BluetoothAdapterChromeOS::CreateAdapter() {
void BluetoothAdapterChromeOS::Shutdown() {
if (dbus_is_shutdown_)
return;
- DCHECK(DBusThreadManager::IsInitialized())
+ DCHECK(bluez::BluezDBusManager::IsInitialized())
<< "Call BluetoothAdapterFactory::Shutdown() before "
- "DBusThreadManager::Shutdown().";
+ "BluezDBusManager::Shutdown().";
if (IsPresent())
RemoveAdapter(); // Also deletes devices_.
@@ -115,14 +115,19 @@ void BluetoothAdapterChromeOS::Shutdown() {
delete it.second;
profile_queues_.clear();
- DBusThreadManager::Get()->GetBluetoothAdapterClient()->RemoveObserver(this);
- DBusThreadManager::Get()->GetBluetoothDeviceClient()->RemoveObserver(this);
- DBusThreadManager::Get()->GetBluetoothInputClient()->RemoveObserver(this);
+ bluez::BluezDBusManager::Get()->GetBluetoothAdapterClient()->RemoveObserver(
+ this);
+ bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->RemoveObserver(
+ this);
+ bluez::BluezDBusManager::Get()->GetBluetoothInputClient()->RemoveObserver(
+ this);
VLOG(1) << "Unregistering pairing agent";
- DBusThreadManager::Get()->GetBluetoothAgentManagerClient()->UnregisterAgent(
- dbus::ObjectPath(kAgentPath), base::Bind(&base::DoNothing),
- base::Bind(&OnUnregisterAgentError));
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothAgentManagerClient()
+ ->UnregisterAgent(dbus::ObjectPath(kAgentPath),
+ base::Bind(&base::DoNothing),
+ base::Bind(&OnUnregisterAgentError));
agent_.reset();
dbus_is_shutdown_ = true;
@@ -136,18 +141,20 @@ BluetoothAdapterChromeOS::BluetoothAdapterChromeOS()
ui_task_runner_ = base::ThreadTaskRunnerHandle::Get();
socket_thread_ = device::BluetoothSocketThread::Get();
- DBusThreadManager::Get()->GetBluetoothAdapterClient()->AddObserver(this);
- DBusThreadManager::Get()->GetBluetoothDeviceClient()->AddObserver(this);
- DBusThreadManager::Get()->GetBluetoothInputClient()->AddObserver(this);
+ bluez::BluezDBusManager::Get()->GetBluetoothAdapterClient()->AddObserver(
+ this);
+ bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->AddObserver(this);
+ bluez::BluezDBusManager::Get()->GetBluetoothInputClient()->AddObserver(this);
// Register the pairing agent.
- dbus::Bus* system_bus = DBusThreadManager::Get()->GetSystemBus();
- agent_.reset(BluetoothAgentServiceProvider::Create(
+ dbus::Bus* system_bus = bluez::BluezDBusManager::Get()->GetSystemBus();
+ agent_.reset(bluez::BluetoothAgentServiceProvider::Create(
system_bus, dbus::ObjectPath(kAgentPath), this));
DCHECK(agent_.get());
- std::vector<dbus::ObjectPath> object_paths =
- DBusThreadManager::Get()->GetBluetoothAdapterClient()->GetAdapters();
+ std::vector<dbus::ObjectPath> object_paths = bluez::BluezDBusManager::Get()
+ ->GetBluetoothAdapterClient()
+ ->GetAdapters();
if (!object_paths.empty()) {
VLOG(1) << object_paths.size() << " Bluetooth adapter(s) available.";
@@ -163,9 +170,10 @@ std::string BluetoothAdapterChromeOS::GetAddress() const {
if (!IsPresent())
return std::string();
- BluetoothAdapterClient::Properties* properties =
- DBusThreadManager::Get()->GetBluetoothAdapterClient()->
- GetProperties(object_path_);
+ bluez::BluetoothAdapterClient::Properties* properties =
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothAdapterClient()
+ ->GetProperties(object_path_);
DCHECK(properties);
return BluetoothDevice::CanonicalizeAddress(properties->address.value());
@@ -175,9 +183,10 @@ std::string BluetoothAdapterChromeOS::GetName() const {
if (!IsPresent())
return std::string();
- BluetoothAdapterClient::Properties* properties =
- DBusThreadManager::Get()->GetBluetoothAdapterClient()->
- GetProperties(object_path_);
+ bluez::BluetoothAdapterClient::Properties* properties =
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothAdapterClient()
+ ->GetProperties(object_path_);
DCHECK(properties);
return properties->alias.value();
@@ -191,13 +200,13 @@ void BluetoothAdapterChromeOS::SetName(const std::string& name,
return;
}
- DBusThreadManager::Get()->GetBluetoothAdapterClient()->
- GetProperties(object_path_)->alias.Set(
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothAdapterClient()
+ ->GetProperties(object_path_)
+ ->alias.Set(
name,
base::Bind(&BluetoothAdapterChromeOS::OnPropertyChangeCompleted,
- weak_ptr_factory_.GetWeakPtr(),
- callback,
- error_callback));
+ weak_ptr_factory_.GetWeakPtr(), callback, error_callback));
}
bool BluetoothAdapterChromeOS::IsInitialized() const {
@@ -212,9 +221,10 @@ bool BluetoothAdapterChromeOS::IsPowered() const {
if (!IsPresent())
return false;
- BluetoothAdapterClient::Properties* properties =
- DBusThreadManager::Get()->GetBluetoothAdapterClient()->
- GetProperties(object_path_);
+ bluez::BluetoothAdapterClient::Properties* properties =
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothAdapterClient()
+ ->GetProperties(object_path_);
return properties->powered.value();
}
@@ -228,22 +238,23 @@ void BluetoothAdapterChromeOS::SetPowered(
return;
}
- DBusThreadManager::Get()->GetBluetoothAdapterClient()->
- GetProperties(object_path_)->powered.Set(
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothAdapterClient()
+ ->GetProperties(object_path_)
+ ->powered.Set(
powered,
base::Bind(&BluetoothAdapterChromeOS::OnPropertyChangeCompleted,
- weak_ptr_factory_.GetWeakPtr(),
- callback,
- error_callback));
+ weak_ptr_factory_.GetWeakPtr(), callback, error_callback));
}
bool BluetoothAdapterChromeOS::IsDiscoverable() const {
if (!IsPresent())
return false;
- BluetoothAdapterClient::Properties* properties =
- DBusThreadManager::Get()->GetBluetoothAdapterClient()->
- GetProperties(object_path_);
+ bluez::BluetoothAdapterClient::Properties* properties =
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothAdapterClient()
+ ->GetProperties(object_path_);
return properties->discoverable.value();
}
@@ -257,22 +268,23 @@ void BluetoothAdapterChromeOS::SetDiscoverable(
return;
}
- DBusThreadManager::Get()->GetBluetoothAdapterClient()->
- GetProperties(object_path_)->discoverable.Set(
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothAdapterClient()
+ ->GetProperties(object_path_)
+ ->discoverable.Set(
discoverable,
base::Bind(&BluetoothAdapterChromeOS::OnSetDiscoverable,
- weak_ptr_factory_.GetWeakPtr(),
- callback,
- error_callback));
+ weak_ptr_factory_.GetWeakPtr(), callback, error_callback));
}
bool BluetoothAdapterChromeOS::IsDiscovering() const {
if (!IsPresent())
return false;
- BluetoothAdapterClient::Properties* properties =
- DBusThreadManager::Get()->GetBluetoothAdapterClient()->
- GetProperties(object_path_);
+ bluez::BluetoothAdapterClient::Properties* properties =
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothAdapterClient()
+ ->GetProperties(object_path_);
return properties->discovering.value();
}
@@ -377,9 +389,10 @@ void BluetoothAdapterChromeOS::AdapterPropertyChanged(
return;
DCHECK(IsPresent());
- BluetoothAdapterClient::Properties* properties =
- DBusThreadManager::Get()->GetBluetoothAdapterClient()->
- GetProperties(object_path_);
+ bluez::BluetoothAdapterClient::Properties* properties =
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothAdapterClient()
+ ->GetProperties(object_path_);
if (property_name == properties->powered.name()) {
PoweredChanged(properties->powered.value());
@@ -392,10 +405,10 @@ void BluetoothAdapterChromeOS::AdapterPropertyChanged(
void BluetoothAdapterChromeOS::DeviceAdded(
const dbus::ObjectPath& object_path) {
- DCHECK(DBusThreadManager::Get());
- BluetoothDeviceClient::Properties* properties =
- DBusThreadManager::Get()->GetBluetoothDeviceClient()->
- GetProperties(object_path);
+ DCHECK(bluez::BluezDBusManager::Get());
+ bluez::BluetoothDeviceClient::Properties* properties =
+ bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
+ object_path);
if (!properties || properties->adapter.value() != object_path_)
return;
DCHECK(IsPresent());
@@ -437,9 +450,9 @@ void BluetoothAdapterChromeOS::DevicePropertyChanged(
if (!device_chromeos)
return;
- BluetoothDeviceClient::Properties* properties =
- DBusThreadManager::Get()->GetBluetoothDeviceClient()->
- GetProperties(object_path);
+ bluez::BluetoothDeviceClient::Properties* properties =
+ bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
+ object_path);
if (property_name == properties->address.name()) {
for (auto iter = devices_.begin(); iter != devices_.end(); ++iter) {
@@ -504,9 +517,9 @@ void BluetoothAdapterChromeOS::InputPropertyChanged(
if (!device_chromeos)
return;
- BluetoothInputClient::Properties* properties =
- DBusThreadManager::Get()->GetBluetoothInputClient()->
- GetProperties(object_path);
+ bluez::BluetoothInputClient::Properties* properties =
+ bluez::BluezDBusManager::Get()->GetBluetoothInputClient()->GetProperties(
+ object_path);
// Properties structure can be removed, which triggers a change in the
// BluetoothDevice::IsConnectable() property, as does a change in the
@@ -663,8 +676,9 @@ void BluetoothAdapterChromeOS::Cancel() {
void BluetoothAdapterChromeOS::OnRegisterAgent() {
VLOG(1) << "Pairing agent registered, requesting to be made default";
- DBusThreadManager::Get()->GetBluetoothAgentManagerClient()->
- RequestDefaultAgent(
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothAgentManagerClient()
+ ->RequestDefaultAgent(
dbus::ObjectPath(kAgentPath),
base::Bind(&BluetoothAdapterChromeOS::OnRequestDefaultAgent,
weak_ptr_factory_.GetWeakPtr()),
@@ -755,8 +769,9 @@ void BluetoothAdapterChromeOS::SetAdapter(const dbus::ObjectPath& object_path) {
VLOG(1) << object_path_.value() << ": using adapter.";
VLOG(1) << "Registering pairing agent";
- DBusThreadManager::Get()->GetBluetoothAgentManagerClient()->
- RegisterAgent(
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothAgentManagerClient()
+ ->RegisterAgent(
dbus::ObjectPath(kAgentPath),
bluetooth_agent_manager::kKeyboardDisplayCapability,
base::Bind(&BluetoothAdapterChromeOS::OnRegisterAgent,
@@ -766,9 +781,10 @@ void BluetoothAdapterChromeOS::SetAdapter(const dbus::ObjectPath& object_path) {
SetDefaultAdapterName();
- BluetoothAdapterClient::Properties* properties =
- DBusThreadManager::Get()->GetBluetoothAdapterClient()->
- GetProperties(object_path_);
+ bluez::BluetoothAdapterClient::Properties* properties =
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothAdapterClient()
+ ->GetProperties(object_path_);
PresentChanged(true);
@@ -780,8 +796,9 @@ void BluetoothAdapterChromeOS::SetAdapter(const dbus::ObjectPath& object_path) {
DiscoveringChanged(true);
std::vector<dbus::ObjectPath> device_paths =
- DBusThreadManager::Get()->GetBluetoothDeviceClient()->
- GetDevicesForAdapter(object_path_);
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothDeviceClient()
+ ->GetDevicesForAdapter(object_path_);
for (std::vector<dbus::ObjectPath>::iterator iter = device_paths.begin();
iter != device_paths.end(); ++iter) {
@@ -818,9 +835,10 @@ void BluetoothAdapterChromeOS::RemoveAdapter() {
DCHECK(IsPresent());
VLOG(1) << object_path_.value() << ": adapter removed.";
- BluetoothAdapterClient::Properties* properties =
- DBusThreadManager::Get()->GetBluetoothAdapterClient()->
- GetProperties(object_path_);
+ bluez::BluetoothAdapterClient::Properties* properties =
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothAdapterClient()
+ ->GetProperties(object_path_);
object_path_ = dbus::ObjectPath("");
@@ -1008,8 +1026,8 @@ void BluetoothAdapterChromeOS::NotifyGattDescriptorValueChanged(
void BluetoothAdapterChromeOS::UseProfile(
const BluetoothUUID& uuid,
const dbus::ObjectPath& device_path,
- const BluetoothProfileManagerClient::Options& options,
- BluetoothProfileServiceProvider::Delegate* delegate,
+ const bluez::BluetoothProfileManagerClient::Options& options,
+ bluez::BluetoothProfileServiceProvider::Delegate* delegate,
const ProfileRegisteredCallback& success_callback,
const ErrorCompletionCallback& error_callback) {
DCHECK(delegate);
@@ -1080,7 +1098,7 @@ void BluetoothAdapterChromeOS::OnRegisterProfile(
void BluetoothAdapterChromeOS::SetProfileDelegate(
const BluetoothUUID& uuid,
const dbus::ObjectPath& device_path,
- BluetoothProfileServiceProvider::Delegate* delegate,
+ bluez::BluetoothProfileServiceProvider::Delegate* delegate,
const ProfileRegisteredCallback& success_callback,
const ErrorCompletionCallback& error_callback) {
if (profiles_.find(uuid) == profiles_.end()) {
@@ -1123,13 +1141,13 @@ void BluetoothAdapterChromeOS::OnSetDiscoverable(
// Set the discoverable_timeout property to zero so the adapter remains
// discoverable forever.
- DBusThreadManager::Get()->GetBluetoothAdapterClient()->
- GetProperties(object_path_)->discoverable_timeout.Set(
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothAdapterClient()
+ ->GetProperties(object_path_)
+ ->discoverable_timeout.Set(
0,
base::Bind(&BluetoothAdapterChromeOS::OnPropertyChangeCompleted,
- weak_ptr_factory_.GetWeakPtr(),
- callback,
- error_callback));
+ weak_ptr_factory_.GetWeakPtr(), callback, error_callback));
}
void BluetoothAdapterChromeOS::OnPropertyChangeCompleted(
@@ -1197,7 +1215,7 @@ void BluetoothAdapterChromeOS::AddDiscoverySession(
// This is the first request to start device discovery.
discovery_request_pending_ = true;
- DBusThreadManager::Get()->GetBluetoothAdapterClient()->StartDiscovery(
+ bluez::BluezDBusManager::Get()->GetBluetoothAdapterClient()->StartDiscovery(
object_path_,
base::Bind(&BluetoothAdapterChromeOS::OnStartDiscovery,
weak_ptr_factory_.GetWeakPtr(), callback, error_callback),
@@ -1251,15 +1269,11 @@ void BluetoothAdapterChromeOS::RemoveDiscoverySession(
// discovery.
DCHECK_EQ(num_discovery_sessions_, 1);
discovery_request_pending_ = true;
- DBusThreadManager::Get()->GetBluetoothAdapterClient()->
- StopDiscovery(
- object_path_,
- base::Bind(&BluetoothAdapterChromeOS::OnStopDiscovery,
- weak_ptr_factory_.GetWeakPtr(),
- callback),
- base::Bind(&BluetoothAdapterChromeOS::OnStopDiscoveryError,
- weak_ptr_factory_.GetWeakPtr(),
- error_callback));
+ bluez::BluezDBusManager::Get()->GetBluetoothAdapterClient()->StopDiscovery(
+ object_path_, base::Bind(&BluetoothAdapterChromeOS::OnStopDiscovery,
+ weak_ptr_factory_.GetWeakPtr(), callback),
+ base::Bind(&BluetoothAdapterChromeOS::OnStopDiscoveryError,
+ weak_ptr_factory_.GetWeakPtr(), error_callback));
}
void BluetoothAdapterChromeOS::SetDiscoveryFilter(
@@ -1288,7 +1302,7 @@ void BluetoothAdapterChromeOS::SetDiscoveryFilter(
current_filter_.reset(discovery_filter.release());
- chromeos::BluetoothAdapterClient::DiscoveryFilter dbus_discovery_filter;
+ bluez::BluetoothAdapterClient::DiscoveryFilter dbus_discovery_filter;
if (current_filter_.get()) {
uint16_t pathloss;
@@ -1323,12 +1337,14 @@ void BluetoothAdapterChromeOS::SetDiscoveryFilter(
}
}
- DBusThreadManager::Get()->GetBluetoothAdapterClient()->SetDiscoveryFilter(
- object_path_, dbus_discovery_filter,
- base::Bind(&BluetoothAdapterChromeOS::OnSetDiscoveryFilter,
- weak_ptr_factory_.GetWeakPtr(), callback, error_callback),
- base::Bind(&BluetoothAdapterChromeOS::OnSetDiscoveryFilterError,
- weak_ptr_factory_.GetWeakPtr(), callback, error_callback));
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothAdapterClient()
+ ->SetDiscoveryFilter(
+ object_path_, dbus_discovery_filter,
+ base::Bind(&BluetoothAdapterChromeOS::OnSetDiscoveryFilter,
+ weak_ptr_factory_.GetWeakPtr(), callback, error_callback),
+ base::Bind(&BluetoothAdapterChromeOS::OnSetDiscoveryFilterError,
+ weak_ptr_factory_.GetWeakPtr(), callback, error_callback));
}
void BluetoothAdapterChromeOS::OnStartDiscovery(
@@ -1418,7 +1434,7 @@ void BluetoothAdapterChromeOS::OnPreSetDiscoveryFilter(
DCHECK(discovery_request_pending_);
DCHECK_EQ(num_discovery_sessions_, 0);
- DBusThreadManager::Get()->GetBluetoothAdapterClient()->StartDiscovery(
+ bluez::BluezDBusManager::Get()->GetBluetoothAdapterClient()->StartDiscovery(
object_path_,
base::Bind(&BluetoothAdapterChromeOS::OnStartDiscovery,
weak_ptr_factory_.GetWeakPtr(), callback, error_callback),
diff --git a/device/bluetooth/bluetooth_adapter_chromeos.h b/device/bluetooth/bluetooth_adapter_chromeos.h
index 7570780..b51e603 100644
--- a/device/bluetooth/bluetooth_adapter_chromeos.h
+++ b/device/bluetooth/bluetooth_adapter_chromeos.h
@@ -12,18 +12,18 @@
#include <vector>
#include "base/memory/weak_ptr.h"
-#include "chromeos/dbus/bluetooth_adapter_client.h"
-#include "chromeos/dbus/bluetooth_agent_service_provider.h"
-#include "chromeos/dbus/bluetooth_device_client.h"
-#include "chromeos/dbus/bluetooth_input_client.h"
-#include "chromeos/dbus/bluetooth_profile_manager_client.h"
-#include "chromeos/dbus/bluetooth_profile_service_provider.h"
#include "dbus/object_path.h"
#include "device/bluetooth/bluetooth_adapter.h"
#include "device/bluetooth/bluetooth_audio_sink.h"
#include "device/bluetooth/bluetooth_device.h"
#include "device/bluetooth/bluetooth_discovery_session.h"
#include "device/bluetooth/bluetooth_export.h"
+#include "device/bluetooth/dbus/bluetooth_adapter_client.h"
+#include "device/bluetooth/dbus/bluetooth_agent_service_provider.h"
+#include "device/bluetooth/dbus/bluetooth_device_client.h"
+#include "device/bluetooth/dbus/bluetooth_input_client.h"
+#include "device/bluetooth/dbus/bluetooth_profile_manager_client.h"
+#include "device/bluetooth/dbus/bluetooth_profile_service_provider.h"
namespace base {
class SequencedTaskRunner;
@@ -60,10 +60,10 @@ class BluetoothRemoteGattServiceChromeOS;
// BluetoothChromeOSTest, Shutdown.
class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS
: public device::BluetoothAdapter,
- public chromeos::BluetoothAdapterClient::Observer,
- public chromeos::BluetoothDeviceClient::Observer,
- public chromeos::BluetoothInputClient::Observer,
- public chromeos::BluetoothAgentServiceProvider::Delegate {
+ public bluez::BluetoothAdapterClient::Observer,
+ public bluez::BluetoothDeviceClient::Observer,
+ public bluez::BluetoothInputClient::Observer,
+ public bluez::BluetoothAgentServiceProvider::Delegate {
public:
typedef base::Callback<void(const std::string& error_message)>
ErrorCompletionCallback;
@@ -156,8 +156,8 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS
// |error_callback| will be called.
void UseProfile(const device::BluetoothUUID& uuid,
const dbus::ObjectPath& device_path,
- const BluetoothProfileManagerClient::Options& options,
- BluetoothProfileServiceProvider::Delegate* delegate,
+ const bluez::BluetoothProfileManagerClient::Options& options,
+ bluez::BluetoothProfileServiceProvider::Delegate* delegate,
const ProfileRegisteredCallback& success_callback,
const ErrorCompletionCallback& error_callback);
@@ -193,23 +193,23 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS
BluetoothAdapterChromeOS();
~BluetoothAdapterChromeOS() override;
- // BluetoothAdapterClient::Observer override.
+ // bluez::BluetoothAdapterClient::Observer override.
void AdapterAdded(const dbus::ObjectPath& object_path) override;
void AdapterRemoved(const dbus::ObjectPath& object_path) override;
void AdapterPropertyChanged(const dbus::ObjectPath& object_path,
const std::string& property_name) override;
- // BluetoothDeviceClient::Observer override.
+ // bluez::BluetoothDeviceClient::Observer override.
void DeviceAdded(const dbus::ObjectPath& object_path) override;
void DeviceRemoved(const dbus::ObjectPath& object_path) override;
void DevicePropertyChanged(const dbus::ObjectPath& object_path,
const std::string& property_name) override;
- // BluetoothInputClient::Observer override.
+ // bluez::BluetoothInputClient::Observer override.
void InputPropertyChanged(const dbus::ObjectPath& object_path,
const std::string& property_name) override;
- // BluetoothAgentServiceProvider::Delegate override.
+ // bluez::BluetoothAgentServiceProvider::Delegate override.
void Released() override;
void RequestPinCode(const dbus::ObjectPath& device_path,
const PinCodeCallback& callback) override;
@@ -332,11 +332,12 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS
void OnRegisterProfile(const device::BluetoothUUID& uuid,
scoped_ptr<BluetoothAdapterProfileChromeOS> profile);
- void SetProfileDelegate(const device::BluetoothUUID& uuid,
- const dbus::ObjectPath& device_path,
- BluetoothProfileServiceProvider::Delegate* delegate,
- const ProfileRegisteredCallback& success_callback,
- const ErrorCompletionCallback& error_callback);
+ void SetProfileDelegate(
+ const device::BluetoothUUID& uuid,
+ const dbus::ObjectPath& device_path,
+ bluez::BluetoothProfileServiceProvider::Delegate* delegate,
+ const ProfileRegisteredCallback& success_callback,
+ const ErrorCompletionCallback& error_callback);
void OnRegisterProfileError(const device::BluetoothUUID& uuid,
const std::string& error_name,
const std::string& error_message);
@@ -376,7 +377,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS
// Instance of the D-Bus agent object used for pairing, initialized with
// our own class as its delegate.
- scoped_ptr<BluetoothAgentServiceProvider> agent_;
+ scoped_ptr<bluez::BluetoothAgentServiceProvider> agent_;
// UI thread task runner and socket thread object used to create sockets.
scoped_refptr<base::SequencedTaskRunner> ui_task_runner_;
diff --git a/device/bluetooth/bluetooth_adapter_profile_chromeos.cc b/device/bluetooth/bluetooth_adapter_profile_chromeos.cc
index 207c55c4..27779f2 100644
--- a/device/bluetooth/bluetooth_adapter_profile_chromeos.cc
+++ b/device/bluetooth/bluetooth_adapter_profile_chromeos.cc
@@ -9,32 +9,31 @@
#include "base/bind.h"
#include "base/logging.h"
#include "base/strings/string_util.h"
-#include "chromeos/dbus/bluetooth_profile_service_provider.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
#include "dbus/bus.h"
#include "dbus/object_path.h"
#include "device/bluetooth/bluetooth_adapter_chromeos.h"
#include "device/bluetooth/bluetooth_uuid.h"
+#include "device/bluetooth/dbus/bluetooth_profile_service_provider.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
namespace chromeos {
// static
void BluetoothAdapterProfileChromeOS::Register(
const device::BluetoothUUID& uuid,
- const BluetoothProfileManagerClient::Options& options,
+ const bluez::BluetoothProfileManagerClient::Options& options,
const ProfileRegisteredCallback& success_callback,
- const BluetoothProfileManagerClient::ErrorCallback& error_callback) {
+ const bluez::BluetoothProfileManagerClient::ErrorCallback& error_callback) {
scoped_ptr<BluetoothAdapterProfileChromeOS> profile(
new BluetoothAdapterProfileChromeOS(uuid));
VLOG(1) << "Registering profile: " << profile->object_path().value();
const dbus::ObjectPath& object_path = profile->object_path();
- DBusThreadManager::Get()->GetBluetoothProfileManagerClient()->RegisterProfile(
- object_path,
- uuid.canonical_value(),
- options,
- base::Bind(success_callback, base::Passed(&profile)),
- error_callback);
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothProfileManagerClient()
+ ->RegisterProfile(object_path, uuid.canonical_value(), options,
+ base::Bind(success_callback, base::Passed(&profile)),
+ error_callback);
}
BluetoothAdapterProfileChromeOS::BluetoothAdapterProfileChromeOS(
@@ -45,9 +44,9 @@ BluetoothAdapterProfileChromeOS::BluetoothAdapterProfileChromeOS(
object_path_ =
dbus::ObjectPath("/org/chromium/bluetooth_profile/" + uuid_path);
- dbus::Bus* system_bus = DBusThreadManager::Get()->GetSystemBus();
- profile_.reset(
- BluetoothProfileServiceProvider::Create(system_bus, object_path_, this));
+ dbus::Bus* system_bus = bluez::BluezDBusManager::Get()->GetSystemBus();
+ profile_.reset(bluez::BluetoothProfileServiceProvider::Create(
+ system_bus, object_path_, this));
DCHECK(profile_.get());
}
@@ -56,7 +55,7 @@ BluetoothAdapterProfileChromeOS::~BluetoothAdapterProfileChromeOS() {
bool BluetoothAdapterProfileChromeOS::SetDelegate(
const dbus::ObjectPath& device_path,
- BluetoothProfileServiceProvider::Delegate* delegate) {
+ bluez::BluetoothProfileServiceProvider::Delegate* delegate) {
DCHECK(delegate);
VLOG(1) << "SetDelegate: " << object_path_.value() << " dev "
<< device_path.value();
@@ -86,7 +85,7 @@ void BluetoothAdapterProfileChromeOS::RemoveDelegate(
VLOG(1) << device_path.value() << " No delegates left, unregistering.";
// No users left, release the profile.
- DBusThreadManager::Get()
+ bluez::BluezDBusManager::Get()
->GetBluetoothProfileManagerClient()
->UnregisterProfile(
object_path_, unregistered_callback,
@@ -105,7 +104,7 @@ void BluetoothAdapterProfileChromeOS::OnUnregisterProfileError(
unregistered_callback.Run();
}
-// BluetoothProfileServiceProvider::Delegate:
+// bluez::BluetoothProfileServiceProvider::Delegate:
void BluetoothAdapterProfileChromeOS::Released() {
VLOG(1) << object_path_.value() << ": Release";
}
@@ -113,7 +112,7 @@ void BluetoothAdapterProfileChromeOS::Released() {
void BluetoothAdapterProfileChromeOS::NewConnection(
const dbus::ObjectPath& device_path,
scoped_ptr<dbus::FileDescriptor> fd,
- const BluetoothProfileServiceProvider::Delegate::Options& options,
+ const bluez::BluetoothProfileServiceProvider::Delegate::Options& options,
const ConfirmationCallback& callback) {
dbus::ObjectPath delegate_path = device_path;
diff --git a/device/bluetooth/bluetooth_adapter_profile_chromeos.h b/device/bluetooth/bluetooth_adapter_profile_chromeos.h
index 85e2ffe..35971e8 100644
--- a/device/bluetooth/bluetooth_adapter_profile_chromeos.h
+++ b/device/bluetooth/bluetooth_adapter_profile_chromeos.h
@@ -6,10 +6,10 @@
#define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_PROFILE_CHROMEOS_H_
#include "base/memory/weak_ptr.h"
-#include "chromeos/dbus/bluetooth_profile_manager_client.h"
-#include "chromeos/dbus/bluetooth_profile_service_provider.h"
#include "device/bluetooth/bluetooth_adapter_chromeos.h"
#include "device/bluetooth/bluetooth_export.h"
+#include "device/bluetooth/dbus/bluetooth_profile_manager_client.h"
+#include "device/bluetooth/dbus/bluetooth_profile_service_provider.h"
namespace device {
class BluetoothUUID;
@@ -28,7 +28,7 @@ namespace chromeos {
// BluetoothAdapterProfileChromeOS objects are owned by the
// BluetoothAdapterChromeOS and allocated through Register()
class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterProfileChromeOS
- : public chromeos::BluetoothProfileServiceProvider::Delegate {
+ : public bluez::BluetoothProfileServiceProvider::Delegate {
public:
typedef base::Callback<void(scoped_ptr<BluetoothAdapterProfileChromeOS>
profile)> ProfileRegisteredCallback;
@@ -39,9 +39,10 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterProfileChromeOS
// will be called.
static void Register(
const device::BluetoothUUID& uuid,
- const BluetoothProfileManagerClient::Options& options,
+ const bluez::BluetoothProfileManagerClient::Options& options,
const ProfileRegisteredCallback& success_callback,
- const BluetoothProfileManagerClient::ErrorCallback& error_callback);
+ const bluez::BluetoothProfileManagerClient::ErrorCallback&
+ error_callback);
~BluetoothAdapterProfileChromeOS() override;
@@ -56,7 +57,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterProfileChromeOS
// Returns true if the delegate was set, and false if the |device_path|
// already had a delegate set.
bool SetDelegate(const dbus::ObjectPath& device_path,
- BluetoothProfileServiceProvider::Delegate* delegate);
+ bluez::BluetoothProfileServiceProvider::Delegate* delegate);
// Remove the delegate for a device. |unregistered_callback| will be called
// if this unregisters the profile.
@@ -69,12 +70,12 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterProfileChromeOS
private:
BluetoothAdapterProfileChromeOS(const device::BluetoothUUID& uuid);
- // BluetoothProfileServiceProvider::Delegate:
+ // bluez::BluetoothProfileServiceProvider::Delegate:
void Released() override;
void NewConnection(
const dbus::ObjectPath& device_path,
scoped_ptr<dbus::FileDescriptor> fd,
- const BluetoothProfileServiceProvider::Delegate::Options& options,
+ const bluez::BluetoothProfileServiceProvider::Delegate::Options& options,
const ConfirmationCallback& callback) override;
void RequestDisconnection(const dbus::ObjectPath& device_path,
const ConfirmationCallback& callback) override;
@@ -86,7 +87,8 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterProfileChromeOS
const std::string& error_message);
// List of delegates which this profile is multiplexing to.
- std::map<std::string, BluetoothProfileServiceProvider::Delegate*> delegates_;
+ std::map<std::string, bluez::BluetoothProfileServiceProvider::Delegate*>
+ delegates_;
// The UUID that this profile represents.
const device::BluetoothUUID& uuid_;
@@ -95,7 +97,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterProfileChromeOS
dbus::ObjectPath object_path_;
// Profile dbus object for receiving profile method calls from BlueZ
- scoped_ptr<BluetoothProfileServiceProvider> profile_;
+ scoped_ptr<bluez::BluetoothProfileServiceProvider> profile_;
// Note: This should remain the last member so it'll be destroyed and
// invalidate its weak pointers before any other members are destroyed.
diff --git a/device/bluetooth/bluetooth_adapter_profile_chromeos_unittest.cc b/device/bluetooth/bluetooth_adapter_profile_chromeos_unittest.cc
index 1b9c0b3..be99901 100644
--- a/device/bluetooth/bluetooth_adapter_profile_chromeos_unittest.cc
+++ b/device/bluetooth/bluetooth_adapter_profile_chromeos_unittest.cc
@@ -4,17 +4,17 @@
#include "base/bind.h"
#include "base/message_loop/message_loop.h"
-#include "chromeos/dbus/bluetooth_profile_service_provider.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/fake_bluetooth_adapter_client.h"
-#include "chromeos/dbus/fake_bluetooth_agent_manager_client.h"
-#include "chromeos/dbus/fake_bluetooth_device_client.h"
-#include "chromeos/dbus/fake_bluetooth_profile_manager_client.h"
#include "device/bluetooth/bluetooth_adapter.h"
#include "device/bluetooth/bluetooth_adapter_chromeos.h"
#include "device/bluetooth/bluetooth_adapter_factory.h"
#include "device/bluetooth/bluetooth_adapter_profile_chromeos.h"
#include "device/bluetooth/bluetooth_uuid.h"
+#include "device/bluetooth/dbus/bluetooth_profile_service_provider.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
+#include "device/bluetooth/dbus/fake_bluetooth_adapter_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_agent_manager_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_device_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_profile_manager_client.h"
#include "testing/gtest/include/gtest/gtest.h"
using device::BluetoothAdapter;
@@ -27,25 +27,29 @@ class BluetoothAdapterProfileChromeOSTest : public testing::Test {
BluetoothAdapterProfileChromeOSTest()
: success_callback_count_(0),
error_callback_count_(0),
- fake_delegate_paired_(FakeBluetoothDeviceClient::kPairedDevicePath),
- fake_delegate_autopair_(FakeBluetoothDeviceClient::kLegacyAutopairPath),
+ fake_delegate_paired_(
+ bluez::FakeBluetoothDeviceClient::kPairedDevicePath),
+ fake_delegate_autopair_(
+ bluez::FakeBluetoothDeviceClient::kLegacyAutopairPath),
fake_delegate_listen_(""),
profile_user_ptr_(nullptr) {}
void SetUp() override {
- scoped_ptr<DBusThreadManagerSetter> dbus_setter =
- DBusThreadManager::GetSetterForTesting();
+ scoped_ptr<bluez::BluezDBusManagerSetter> dbus_setter =
+ bluez::BluezDBusManager::GetSetterForTesting();
dbus_setter->SetBluetoothAdapterClient(
- scoped_ptr<BluetoothAdapterClient>(new FakeBluetoothAdapterClient));
+ scoped_ptr<bluez::BluetoothAdapterClient>(
+ new bluez::FakeBluetoothAdapterClient));
dbus_setter->SetBluetoothAgentManagerClient(
- scoped_ptr<BluetoothAgentManagerClient>(
- new FakeBluetoothAgentManagerClient));
+ scoped_ptr<bluez::BluetoothAgentManagerClient>(
+ new bluez::FakeBluetoothAgentManagerClient));
dbus_setter->SetBluetoothDeviceClient(
- scoped_ptr<BluetoothDeviceClient>(new FakeBluetoothDeviceClient));
+ scoped_ptr<bluez::BluetoothDeviceClient>(
+ new bluez::FakeBluetoothDeviceClient));
dbus_setter->SetBluetoothProfileManagerClient(
- scoped_ptr<BluetoothProfileManagerClient>(
- new FakeBluetoothProfileManagerClient));
+ scoped_ptr<bluez::BluetoothProfileManagerClient>(
+ new bluez::FakeBluetoothProfileManagerClient));
// Grab a pointer to the adapter.
device::BluetoothAdapterFactory::GetAdapter(
@@ -64,21 +68,20 @@ class BluetoothAdapterProfileChromeOSTest : public testing::Test {
void TearDown() override {
profile_.reset();
adapter_ = nullptr;
- DBusThreadManager::Shutdown();
+ bluez::BluezDBusManager::Shutdown();
}
void AdapterCallback(scoped_refptr<BluetoothAdapter> adapter) {
adapter_ = adapter;
}
- class FakeDelegate
- : public chromeos::BluetoothProfileServiceProvider::Delegate {
+ class FakeDelegate : public bluez::BluetoothProfileServiceProvider::Delegate {
public:
FakeDelegate(const std::string& device_path) : connections_(0) {
device_path_ = dbus::ObjectPath(device_path);
}
- // BluetoothProfileServiceProvider::Delegate:
+ // bluez::BluetoothProfileServiceProvider::Delegate:
void Released() override {
// noop
}
@@ -86,7 +89,8 @@ class BluetoothAdapterProfileChromeOSTest : public testing::Test {
void NewConnection(
const dbus::ObjectPath& device_path,
scoped_ptr<dbus::FileDescriptor> fd,
- const BluetoothProfileServiceProvider::Delegate::Options& options,
+ const bluez::BluetoothProfileServiceProvider::Delegate::Options&
+ options,
const ConfirmationCallback& callback) override {
++connections_;
fd->CheckValidity();
@@ -157,8 +161,8 @@ class BluetoothAdapterProfileChromeOSTest : public testing::Test {
};
TEST_F(BluetoothAdapterProfileChromeOSTest, DelegateCount) {
- BluetoothUUID uuid(FakeBluetoothProfileManagerClient::kRfcommUuid);
- BluetoothProfileManagerClient::Options options;
+ BluetoothUUID uuid(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid);
+ bluez::BluetoothProfileManagerClient::Options options;
options.require_authentication.reset(new bool(false));
@@ -194,8 +198,8 @@ TEST_F(BluetoothAdapterProfileChromeOSTest, DelegateCount) {
}
TEST_F(BluetoothAdapterProfileChromeOSTest, BlackHole) {
- BluetoothUUID uuid(FakeBluetoothProfileManagerClient::kRfcommUuid);
- BluetoothProfileManagerClient::Options options;
+ BluetoothUUID uuid(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid);
+ bluez::BluetoothProfileManagerClient::Options options;
options.require_authentication.reset(new bool(false));
@@ -212,9 +216,9 @@ TEST_F(BluetoothAdapterProfileChromeOSTest, BlackHole) {
EXPECT_EQ(1U, success_callback_count_);
EXPECT_EQ(0U, error_callback_count_);
- DBusThreadManager::Get()->GetBluetoothDeviceClient()->ConnectProfile(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath),
- FakeBluetoothProfileManagerClient::kRfcommUuid,
+ bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->ConnectProfile(
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kPairedDevicePath),
+ bluez::FakeBluetoothProfileManagerClient::kRfcommUuid,
base::Bind(
&BluetoothAdapterProfileChromeOSTest::DBusConnectSuccessCallback,
base::Unretained(this)),
@@ -230,8 +234,8 @@ TEST_F(BluetoothAdapterProfileChromeOSTest, BlackHole) {
}
TEST_F(BluetoothAdapterProfileChromeOSTest, Routing) {
- BluetoothUUID uuid(FakeBluetoothProfileManagerClient::kRfcommUuid);
- BluetoothProfileManagerClient::Options options;
+ BluetoothUUID uuid(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid);
+ bluez::BluetoothProfileManagerClient::Options options;
options.require_authentication.reset(new bool(false));
@@ -255,9 +259,9 @@ TEST_F(BluetoothAdapterProfileChromeOSTest, Routing) {
profile_->SetDelegate(fake_delegate_listen_.device_path_,
&fake_delegate_listen_);
- DBusThreadManager::Get()->GetBluetoothDeviceClient()->ConnectProfile(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath),
- FakeBluetoothProfileManagerClient::kRfcommUuid,
+ bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->ConnectProfile(
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kPairedDevicePath),
+ bluez::FakeBluetoothProfileManagerClient::kRfcommUuid,
base::Bind(
&BluetoothAdapterProfileChromeOSTest::DBusConnectSuccessCallback,
base::Unretained(this)),
@@ -271,9 +275,9 @@ TEST_F(BluetoothAdapterProfileChromeOSTest, Routing) {
EXPECT_EQ(1U, fake_delegate_paired_.connections_);
- DBusThreadManager::Get()->GetBluetoothDeviceClient()->ConnectProfile(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kLegacyAutopairPath),
- FakeBluetoothProfileManagerClient::kRfcommUuid,
+ bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->ConnectProfile(
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLegacyAutopairPath),
+ bluez::FakeBluetoothProfileManagerClient::kRfcommUuid,
base::Bind(
&BluetoothAdapterProfileChromeOSTest::DBusConnectSuccessCallback,
base::Unretained(this)),
@@ -288,9 +292,9 @@ TEST_F(BluetoothAdapterProfileChromeOSTest, Routing) {
EXPECT_EQ(1U, fake_delegate_autopair_.connections_);
// Incoming connections look the same from BlueZ.
- DBusThreadManager::Get()->GetBluetoothDeviceClient()->ConnectProfile(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kDisplayPinCodePath),
- FakeBluetoothProfileManagerClient::kRfcommUuid,
+ bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->ConnectProfile(
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kDisplayPinCodePath),
+ bluez::FakeBluetoothProfileManagerClient::kRfcommUuid,
base::Bind(
&BluetoothAdapterProfileChromeOSTest::DBusConnectSuccessCallback,
base::Unretained(this)),
@@ -306,8 +310,8 @@ TEST_F(BluetoothAdapterProfileChromeOSTest, Routing) {
}
TEST_F(BluetoothAdapterProfileChromeOSTest, SimultaneousRegister) {
- BluetoothUUID uuid(FakeBluetoothProfileManagerClient::kRfcommUuid);
- BluetoothProfileManagerClient::Options options;
+ BluetoothUUID uuid(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid);
+ bluez::BluetoothProfileManagerClient::Options options;
BluetoothAdapterChromeOS* adapter =
static_cast<BluetoothAdapterChromeOS*>(adapter_.get());
@@ -347,8 +351,9 @@ TEST_F(BluetoothAdapterProfileChromeOSTest, SimultaneousRegister) {
}
TEST_F(BluetoothAdapterProfileChromeOSTest, SimultaneousRegisterFail) {
- BluetoothUUID uuid(FakeBluetoothProfileManagerClient::kUnregisterableUuid);
- BluetoothProfileManagerClient::Options options;
+ BluetoothUUID uuid(
+ bluez::FakeBluetoothProfileManagerClient::kUnregisterableUuid);
+ bluez::BluetoothProfileManagerClient::Options options;
BluetoothAdapterChromeOS* adapter =
static_cast<BluetoothAdapterChromeOS*>(adapter_.get());
diff --git a/device/bluetooth/bluetooth_advertisement_chromeos.cc b/device/bluetooth/bluetooth_advertisement_chromeos.cc
index 8cdfe90..671977d 100644
--- a/device/bluetooth/bluetooth_advertisement_chromeos.cc
+++ b/device/bluetooth/bluetooth_advertisement_chromeos.cc
@@ -12,11 +12,11 @@
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/strings/string_util.h"
-#include "chromeos/dbus/bluetooth_le_advertising_manager_client.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
#include "dbus/bus.h"
#include "dbus/object_path.h"
#include "device/bluetooth/bluetooth_adapter_chromeos.h"
+#include "device/bluetooth/dbus/bluetooth_le_advertising_manager_client.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
namespace {
@@ -82,10 +82,12 @@ BluetoothAdvertisementChromeOS::BluetoothAdvertisementChromeOS(
dbus::ObjectPath advertisement_object_path =
dbus::ObjectPath("/org/chromium/bluetooth_advertisement/" + GuidString);
- DCHECK(DBusThreadManager::Get());
- provider_ = BluetoothLEAdvertisementServiceProvider::Create(
- DBusThreadManager::Get()->GetSystemBus(), advertisement_object_path, this,
- static_cast<BluetoothLEAdvertisementServiceProvider::AdvertisementType>(
+ DCHECK(bluez::BluezDBusManager::Get());
+ provider_ = bluez::BluetoothLEAdvertisementServiceProvider::Create(
+ bluez::BluezDBusManager::Get()->GetSystemBus(), advertisement_object_path,
+ this,
+ static_cast<
+ bluez::BluetoothLEAdvertisementServiceProvider::AdvertisementType>(
data->type()),
data->service_uuids().Pass(), data->manufacturer_data().Pass(),
data->solicit_uuids().Pass(), data->service_data().Pass());
@@ -95,8 +97,8 @@ void BluetoothAdvertisementChromeOS::Register(
const base::Closure& success_callback,
const device::BluetoothAdapter::CreateAdvertisementErrorCallback&
error_callback) {
- DCHECK(DBusThreadManager::Get());
- DBusThreadManager::Get()
+ DCHECK(bluez::BluezDBusManager::Get());
+ bluez::BluezDBusManager::Get()
->GetBluetoothLEAdvertisingManagerClient()
->RegisterAdvertisement(
adapter_->object_path(), provider_->object_path(), success_callback,
@@ -118,8 +120,8 @@ void BluetoothAdvertisementChromeOS::Unregister(
return;
}
- DCHECK(DBusThreadManager::Get());
- DBusThreadManager::Get()
+ DCHECK(bluez::BluezDBusManager::Get());
+ bluez::BluezDBusManager::Get()
->GetBluetoothLEAdvertisingManagerClient()
->UnregisterAdvertisement(
adapter_->object_path(), provider_->object_path(), success_callback,
diff --git a/device/bluetooth/bluetooth_advertisement_chromeos.h b/device/bluetooth/bluetooth_advertisement_chromeos.h
index aeb59b7..44abec2 100644
--- a/device/bluetooth/bluetooth_advertisement_chromeos.h
+++ b/device/bluetooth/bluetooth_advertisement_chromeos.h
@@ -6,21 +6,24 @@
#define DEVICE_BLUETOOTH_BLUETOOTH_ADVERTISEMENT_CHROMEOS_H_
#include "base/macros.h"
-#include "chromeos/dbus/bluetooth_le_advertisement_service_provider.h"
#include "device/bluetooth/bluetooth_adapter.h"
#include "device/bluetooth/bluetooth_advertisement.h"
#include "device/bluetooth/bluetooth_export.h"
+#include "device/bluetooth/dbus/bluetooth_le_advertisement_service_provider.h"
+
+namespace bluez {
+class BluetoothLEAdvertisementServiceProvider;
+}
namespace chromeos {
-class BluetoothLEAdvertisementServiceProvider;
class BluetoothAdapterChromeOS;
// The BluetoothAdvertisementChromeOS class implements BluetoothAdvertisement
// for the Chrome OS platform.
class DEVICE_BLUETOOTH_EXPORT BluetoothAdvertisementChromeOS
: public device::BluetoothAdvertisement,
- public BluetoothLEAdvertisementServiceProvider::Delegate {
+ public bluez::BluetoothLEAdvertisementServiceProvider::Delegate {
public:
BluetoothAdvertisementChromeOS(
scoped_ptr<device::BluetoothAdvertisement::Data> data,
@@ -30,7 +33,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdvertisementChromeOS
void Unregister(const SuccessCallback& success_callback,
const ErrorCallback& error_callback) override;
- // BluetoothLEAdvertisementServiceProvider::Delegate overrides:
+ // bluez::BluetoothLEAdvertisementServiceProvider::Delegate overrides:
void Released() override;
void Register(
@@ -40,7 +43,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdvertisementChromeOS
// Used from tests to be able to trigger events on the fake advertisement
// provider.
- BluetoothLEAdvertisementServiceProvider* provider() {
+ bluez::BluetoothLEAdvertisementServiceProvider* provider() {
return provider_.get();
}
@@ -49,7 +52,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdvertisementChromeOS
// Adapter this advertisement is advertising on.
scoped_refptr<BluetoothAdapterChromeOS> adapter_;
- scoped_ptr<BluetoothLEAdvertisementServiceProvider> provider_;
+ scoped_ptr<bluez::BluetoothLEAdvertisementServiceProvider> provider_;
DISALLOW_COPY_AND_ASSIGN(BluetoothAdvertisementChromeOS);
};
diff --git a/device/bluetooth/bluetooth_advertisement_chromeos_unittest.cc b/device/bluetooth/bluetooth_advertisement_chromeos_unittest.cc
index 02fe1e4..165dc8d 100644
--- a/device/bluetooth/bluetooth_advertisement_chromeos_unittest.cc
+++ b/device/bluetooth/bluetooth_advertisement_chromeos_unittest.cc
@@ -9,12 +9,12 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/fake_bluetooth_le_advertisement_service_provider.h"
#include "device/bluetooth/bluetooth_adapter.h"
#include "device/bluetooth/bluetooth_adapter_factory.h"
#include "device/bluetooth/bluetooth_advertisement.h"
#include "device/bluetooth/bluetooth_advertisement_chromeos.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
+#include "device/bluetooth/dbus/fake_bluetooth_le_advertisement_service_provider.h"
#include "testing/gtest/include/gtest/gtest.h"
using device::BluetoothAdapter;
@@ -52,7 +52,7 @@ class TestAdvertisementObserver : public BluetoothAdvertisement::Observer {
class BluetoothAdvertisementChromeOSTest : public testing::Test {
public:
void SetUp() override {
- DBusThreadManager::Initialize();
+ bluez::BluezDBusManager::Initialize(NULL, true);
callback_count_ = 0;
error_callback_count_ = 0;
@@ -70,7 +70,7 @@ class BluetoothAdvertisementChromeOSTest : public testing::Test {
// The adapter should outlive the advertisement.
advertisement_ = nullptr;
adapter_ = nullptr;
- DBusThreadManager::Shutdown();
+ bluez::BluezDBusManager::Shutdown();
}
// Gets the existing Bluetooth adapter.
@@ -134,8 +134,8 @@ class BluetoothAdvertisementChromeOSTest : public testing::Test {
void TriggerReleased(scoped_refptr<BluetoothAdvertisement> advertisement) {
BluetoothAdvertisementChromeOS* adv =
static_cast<BluetoothAdvertisementChromeOS*>(advertisement.get());
- FakeBluetoothLEAdvertisementServiceProvider* provider =
- static_cast<FakeBluetoothLEAdvertisementServiceProvider*>(
+ bluez::FakeBluetoothLEAdvertisementServiceProvider* provider =
+ static_cast<bluez::FakeBluetoothLEAdvertisementServiceProvider*>(
adv->provider());
provider->Release();
}
diff --git a/device/bluetooth/bluetooth_audio_sink_chromeos.cc b/device/bluetooth/bluetooth_audio_sink_chromeos.cc
index 82b87f7..9bb4b60 100644
--- a/device/bluetooth/bluetooth_audio_sink_chromeos.cc
+++ b/device/bluetooth/bluetooth_audio_sink_chromeos.cc
@@ -14,9 +14,9 @@
#include "base/debug/stack_trace.h"
#include "base/files/file_util.h"
#include "base/logging.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
#include "dbus/message.h"
#include "device/bluetooth/bluetooth_adapter_chromeos.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
using dbus::ObjectPath;
using device::BluetoothAudioSink;
@@ -94,17 +94,17 @@ BluetoothAudioSinkChromeOS::BluetoothAudioSinkChromeOS(
CHECK(adapter_.get());
CHECK(adapter_->IsPresent());
- CHECK(DBusThreadManager::IsInitialized());
+ CHECK(bluez::BluezDBusManager::IsInitialized());
adapter_->AddObserver(this);
- BluetoothMediaClient* media =
- DBusThreadManager::Get()->GetBluetoothMediaClient();
+ bluez::BluetoothMediaClient* media =
+ bluez::BluezDBusManager::Get()->GetBluetoothMediaClient();
CHECK(media);
media->AddObserver(this);
- BluetoothMediaTransportClient* transport =
- DBusThreadManager::Get()->GetBluetoothMediaTransportClient();
+ bluez::BluetoothMediaTransportClient* transport =
+ bluez::BluezDBusManager::Get()->GetBluetoothMediaTransportClient();
CHECK(transport);
transport->AddObserver(this);
@@ -123,13 +123,13 @@ BluetoothAudioSinkChromeOS::~BluetoothAudioSinkChromeOS() {
adapter_->RemoveObserver(this);
- BluetoothMediaClient* media =
- DBusThreadManager::Get()->GetBluetoothMediaClient();
+ bluez::BluetoothMediaClient* media =
+ bluez::BluezDBusManager::Get()->GetBluetoothMediaClient();
CHECK(media);
media->RemoveObserver(this);
- BluetoothMediaTransportClient* transport =
- DBusThreadManager::Get()->GetBluetoothMediaTransportClient();
+ bluez::BluetoothMediaTransportClient* transport =
+ bluez::BluezDBusManager::Get()->GetBluetoothMediaTransportClient();
CHECK(transport);
transport->RemoveObserver(this);
}
@@ -139,11 +139,11 @@ void BluetoothAudioSinkChromeOS::Unregister(
const device::BluetoothAudioSink::ErrorCallback& error_callback) {
VLOG(1) << "Unregister";
- if (!DBusThreadManager::IsInitialized())
+ if (!bluez::BluezDBusManager::IsInitialized())
error_callback.Run(BluetoothAudioSink::ERROR_NOT_UNREGISTERED);
- BluetoothMediaClient* media =
- DBusThreadManager::Get()->GetBluetoothMediaClient();
+ bluez::BluetoothMediaClient* media =
+ bluez::BluezDBusManager::Get()->GetBluetoothMediaClient();
CHECK(media);
media->UnregisterEndpoint(
@@ -185,28 +185,28 @@ void BluetoothAudioSinkChromeOS::Register(
DCHECK_EQ(state_, BluetoothAudioSink::STATE_DISCONNECTED);
// Gets system bus.
- dbus::Bus* system_bus = DBusThreadManager::Get()->GetSystemBus();
+ dbus::Bus* system_bus = bluez::BluezDBusManager::Get()->GetSystemBus();
// Creates a Media Endpoint with newly-generated path.
endpoint_path_ = GenerateEndpointPath();
- media_endpoint_.reset(
- BluetoothMediaEndpointServiceProvider::Create(
- system_bus, endpoint_path_, this));
+ media_endpoint_.reset(bluez::BluetoothMediaEndpointServiceProvider::Create(
+ system_bus, endpoint_path_, this));
DCHECK(media_endpoint_.get());
// Creates endpoint properties with |options|.
options_ = options;
- chromeos::BluetoothMediaClient::EndpointProperties endpoint_properties;
- endpoint_properties.uuid = BluetoothMediaClient::kBluetoothAudioSinkUUID;
+ bluez::BluetoothMediaClient::EndpointProperties endpoint_properties;
+ endpoint_properties.uuid =
+ bluez::BluetoothMediaClient::kBluetoothAudioSinkUUID;
endpoint_properties.codec = options_.codec;
endpoint_properties.capabilities = options_.capabilities;
media_path_ = static_cast<BluetoothAdapterChromeOS*>(
adapter_.get())->object_path();
- BluetoothMediaClient* media =
- DBusThreadManager::Get()->GetBluetoothMediaClient();
+ bluez::BluetoothMediaClient* media =
+ bluez::BluezDBusManager::Get()->GetBluetoothMediaClient();
CHECK(media);
media->RegisterEndpoint(
media_path_,
@@ -218,8 +218,8 @@ void BluetoothAudioSinkChromeOS::Register(
weak_ptr_factory_.GetWeakPtr(), error_callback));
}
-BluetoothMediaEndpointServiceProvider*
- BluetoothAudioSinkChromeOS::GetEndpointServiceProvider() {
+bluez::BluetoothMediaEndpointServiceProvider*
+BluetoothAudioSinkChromeOS::GetEndpointServiceProvider() {
return media_endpoint_.get();
}
@@ -280,21 +280,21 @@ void BluetoothAudioSinkChromeOS::MediaTransportPropertyChanged(
VLOG(1) << "MediaTransportPropertyChanged: " << property_name;
// Retrieves the property set of the transport object with |object_path|.
- BluetoothMediaTransportClient::Properties* properties =
- DBusThreadManager::Get()
+ bluez::BluetoothMediaTransportClient::Properties* properties =
+ bluez::BluezDBusManager::Get()
->GetBluetoothMediaTransportClient()
->GetProperties(object_path);
// Dispatches a property changed event to the corresponding handler.
if (property_name == properties->state.name()) {
if (properties->state.value() ==
- BluetoothMediaTransportClient::kStateIdle) {
+ bluez::BluetoothMediaTransportClient::kStateIdle) {
StateChanged(BluetoothAudioSink::STATE_IDLE);
} else if (properties->state.value() ==
- BluetoothMediaTransportClient::kStatePending) {
+ bluez::BluetoothMediaTransportClient::kStatePending) {
StateChanged(BluetoothAudioSink::STATE_PENDING);
} else if (properties->state.value() ==
- BluetoothMediaTransportClient::kStateActive) {
+ bluez::BluetoothMediaTransportClient::kStateActive) {
StateChanged(BluetoothAudioSink::STATE_ACTIVE);
}
} else if (property_name == properties->volume.name()) {
@@ -309,7 +309,7 @@ void BluetoothAudioSinkChromeOS::SetConfiguration(
transport_path_ = transport_path;
// The initial state for a connection should be "idle".
- if (properties.state != BluetoothMediaTransportClient::kStateIdle) {
+ if (properties.state != bluez::BluetoothMediaTransportClient::kStateIdle) {
VLOG(1) << "SetConfiugration - unexpected state :" << properties.state;
return;
}
@@ -356,7 +356,7 @@ void BluetoothAudioSinkChromeOS::AcquireFD() {
read_has_failed_ = false;
- DBusThreadManager::Get()->GetBluetoothMediaTransportClient()->Acquire(
+ bluez::BluezDBusManager::Get()->GetBluetoothMediaTransportClient()->Acquire(
transport_path_,
base::Bind(&BluetoothAudioSinkChromeOS::OnAcquireSucceeded,
weak_ptr_factory_.GetWeakPtr()),
diff --git a/device/bluetooth/bluetooth_audio_sink_chromeos.h b/device/bluetooth/bluetooth_audio_sink_chromeos.h
index 6261ace..750b31d 100644
--- a/device/bluetooth/bluetooth_audio_sink_chromeos.h
+++ b/device/bluetooth/bluetooth_audio_sink_chromeos.h
@@ -14,14 +14,14 @@
#include "base/memory/weak_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/observer_list.h"
-#include "chromeos/dbus/bluetooth_media_client.h"
-#include "chromeos/dbus/bluetooth_media_endpoint_service_provider.h"
-#include "chromeos/dbus/bluetooth_media_transport_client.h"
#include "dbus/file_descriptor.h"
#include "dbus/object_path.h"
#include "device/bluetooth/bluetooth_adapter.h"
#include "device/bluetooth/bluetooth_audio_sink.h"
#include "device/bluetooth/bluetooth_export.h"
+#include "device/bluetooth/dbus/bluetooth_media_client.h"
+#include "device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.h"
+#include "device/bluetooth/dbus/bluetooth_media_transport_client.h"
namespace chromeos {
@@ -30,9 +30,9 @@ class BluetoothAudioSinkChromeOSTest;
class DEVICE_BLUETOOTH_EXPORT BluetoothAudioSinkChromeOS
: public device::BluetoothAudioSink,
public device::BluetoothAdapter::Observer,
- public BluetoothMediaClient::Observer,
- public BluetoothMediaTransportClient::Observer,
- public BluetoothMediaEndpointServiceProvider::Delegate,
+ public bluez::BluetoothMediaClient::Observer,
+ public bluez::BluetoothMediaTransportClient::Observer,
+ public bluez::BluetoothMediaEndpointServiceProvider::Delegate,
public base::MessageLoopForIO::Watcher {
public:
explicit BluetoothAudioSinkChromeOS(
@@ -61,7 +61,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAudioSinkChromeOS
// Returns a pointer to the media endpoint object. This function should be
// used for testing purpose only.
- BluetoothMediaEndpointServiceProvider* GetEndpointServiceProvider();
+ bluez::BluetoothMediaEndpointServiceProvider* GetEndpointServiceProvider();
private:
~BluetoothAudioSinkChromeOS() override;
@@ -72,15 +72,15 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAudioSinkChromeOS
void AdapterPoweredChanged(device::BluetoothAdapter* adapter,
bool powered) override;
- // BluetoothMediaClient::Observer overrides.
+ // bluez::BluetoothMediaClient::Observer overrides.
void MediaRemoved(const dbus::ObjectPath& object_path) override;
- // BluetoothMediaTransportClient::Observer overrides.
+ // bluez::BluetoothMediaTransportClient::Observer overrides.
void MediaTransportRemoved(const dbus::ObjectPath& object_path) override;
void MediaTransportPropertyChanged(const dbus::ObjectPath& object_path,
const std::string& property_name) override;
- // BluetoothMediaEndpointServiceProvider::Delegate overrides.
+ // bluez::BluetoothMediaEndpointServiceProvider::Delegate overrides.
void SetConfiguration(const dbus::ObjectPath& transport_path,
const TransportProperties& properties) override;
void SelectConfiguration(
@@ -204,7 +204,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAudioSinkChromeOS
device::BluetoothAudioSink::Options options_;
// Media Endpoint object owned by the audio sink object.
- scoped_ptr<BluetoothMediaEndpointServiceProvider> media_endpoint_;
+ scoped_ptr<bluez::BluetoothMediaEndpointServiceProvider> media_endpoint_;
// List of observers interested in event notifications from us. Objects in
// |observers_| are expected to outlive a BluetoothAudioSinkChromeOS object.
diff --git a/device/bluetooth/bluetooth_audio_sink_chromeos_unittest.cc b/device/bluetooth/bluetooth_audio_sink_chromeos_unittest.cc
index 9781dec..22918f7 100644
--- a/device/bluetooth/bluetooth_audio_sink_chromeos_unittest.cc
+++ b/device/bluetooth/bluetooth_audio_sink_chromeos_unittest.cc
@@ -8,18 +8,18 @@
#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "base/message_loop/message_loop.h"
-#include "chromeos/dbus/bluetooth_media_client.h"
-#include "chromeos/dbus/bluetooth_media_endpoint_service_provider.h"
-#include "chromeos/dbus/bluetooth_media_transport_client.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/fake_bluetooth_media_client.h"
-#include "chromeos/dbus/fake_bluetooth_media_endpoint_service_provider.h"
-#include "chromeos/dbus/fake_bluetooth_media_transport_client.h"
#include "dbus/object_path.h"
#include "device/bluetooth/bluetooth_adapter.h"
#include "device/bluetooth/bluetooth_adapter_factory.h"
#include "device/bluetooth/bluetooth_audio_sink.h"
#include "device/bluetooth/bluetooth_audio_sink_chromeos.h"
+#include "device/bluetooth/dbus/bluetooth_media_client.h"
+#include "device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.h"
+#include "device/bluetooth/dbus/bluetooth_media_transport_client.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
+#include "device/bluetooth/dbus/fake_bluetooth_media_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_media_endpoint_service_provider.h"
+#include "device/bluetooth/dbus/fake_bluetooth_media_transport_client.h"
#include "testing/gtest/include/gtest/gtest.h"
using dbus::ObjectPath;
@@ -81,28 +81,29 @@ class TestAudioSinkObserver : public BluetoothAudioSink::Observer {
class BluetoothAudioSinkChromeOSTest : public testing::Test {
public:
void SetUp() override {
- DBusThreadManager::Initialize();
+ bluez::BluezDBusManager::Initialize(NULL, true);
callback_count_ = 0;
error_callback_count_ = 0;
- fake_media_ = static_cast<FakeBluetoothMediaClient*>(
- DBusThreadManager::Get()->GetBluetoothMediaClient());
- fake_transport_ = static_cast<FakeBluetoothMediaTransportClient*>(
- DBusThreadManager::Get()->GetBluetoothMediaTransportClient());
+ fake_media_ = static_cast<bluez::FakeBluetoothMediaClient*>(
+ bluez::BluezDBusManager::Get()->GetBluetoothMediaClient());
+ fake_transport_ = static_cast<bluez::FakeBluetoothMediaTransportClient*>(
+ bluez::BluezDBusManager::Get()->GetBluetoothMediaTransportClient());
// Initiates Delegate::TransportProperties with default values.
- properties_.device =
- ObjectPath(FakeBluetoothMediaTransportClient::kTransportDevicePath);
- properties_.uuid = BluetoothMediaClient::kBluetoothAudioSinkUUID;
- properties_.codec = FakeBluetoothMediaTransportClient::kTransportCodec;
+ properties_.device = ObjectPath(
+ bluez::FakeBluetoothMediaTransportClient::kTransportDevicePath);
+ properties_.uuid = bluez::BluetoothMediaClient::kBluetoothAudioSinkUUID;
+ properties_.codec =
+ bluez::FakeBluetoothMediaTransportClient::kTransportCodec;
properties_.configuration =
- FakeBluetoothMediaTransportClient::kTransportConfiguration;
- properties_.state = BluetoothMediaTransportClient::kStateIdle;
- properties_.delay.reset(
- new uint16_t(FakeBluetoothMediaTransportClient::kTransportDelay));
- properties_.volume.reset(
- new uint16_t(FakeBluetoothMediaTransportClient::kTransportVolume));
+ bluez::FakeBluetoothMediaTransportClient::kTransportConfiguration;
+ properties_.state = bluez::BluetoothMediaTransportClient::kStateIdle;
+ properties_.delay.reset(new uint16_t(
+ bluez::FakeBluetoothMediaTransportClient::kTransportDelay));
+ properties_.volume.reset(new uint16_t(
+ bluez::FakeBluetoothMediaTransportClient::kTransportVolume));
GetAdapter();
}
@@ -117,7 +118,7 @@ class BluetoothAudioSinkChromeOSTest : public testing::Test {
// The adapter should outlive audio sink.
audio_sink_ = nullptr;
adapter_ = nullptr;
- DBusThreadManager::Shutdown();
+ bluez::BluezDBusManager::Shutdown();
}
// Gets the existing Bluetooth adapter.
@@ -178,8 +179,9 @@ class BluetoothAudioSinkChromeOSTest : public testing::Test {
static_cast<BluetoothAudioSinkChromeOS*>(audio_sink_.get());
ASSERT_NE(audio_sink_chromeos, nullptr);
- media_endpoint_ = static_cast<FakeBluetoothMediaEndpointServiceProvider*>(
- audio_sink_chromeos->GetEndpointServiceProvider());
+ media_endpoint_ =
+ static_cast<bluez::FakeBluetoothMediaEndpointServiceProvider*>(
+ audio_sink_chromeos->GetEndpointServiceProvider());
}
// Called whenever RegisterAudioSink is completed successfully.
@@ -231,16 +233,16 @@ class BluetoothAudioSinkChromeOSTest : public testing::Test {
base::MessageLoopForIO message_loop_;
- FakeBluetoothMediaClient* fake_media_;
- FakeBluetoothMediaTransportClient* fake_transport_;
- FakeBluetoothMediaEndpointServiceProvider* media_endpoint_;
+ bluez::FakeBluetoothMediaClient* fake_media_;
+ bluez::FakeBluetoothMediaTransportClient* fake_transport_;
+ bluez::FakeBluetoothMediaEndpointServiceProvider* media_endpoint_;
scoped_ptr<TestAudioSinkObserver> observer_;
scoped_refptr<BluetoothAdapter> adapter_;
scoped_refptr<BluetoothAudioSink> audio_sink_;
// The default property set used while calling SetConfiguration on a media
// endpoint object.
- BluetoothMediaEndpointServiceProvider::Delegate::TransportProperties
+ bluez::BluetoothMediaEndpointServiceProvider::Delegate::TransportProperties
properties_;
};
@@ -784,7 +786,7 @@ TEST_F(BluetoothAudioSinkChromeOSTest, VolumeChanged) {
// |kTransportVolume| is the initial volume of the transport, and this
// value is propagated to the audio sink via SetConfiguration.
EXPECT_EQ(audio_sink_->GetVolume(),
- FakeBluetoothMediaTransportClient::kTransportVolume);
+ bluez::FakeBluetoothMediaTransportClient::kTransportVolume);
// Changes volume to a valid level.
fake_transport_->SetVolume(media_endpoint_->object_path(), 100);
@@ -842,7 +844,7 @@ TEST_F(BluetoothAudioSinkChromeOSTest, AcquireFD) {
EXPECT_EQ(observer_->total_read_, data_one.size());
EXPECT_EQ(observer_->data_, data_one);
EXPECT_EQ(observer_->read_mtu_,
- FakeBluetoothMediaTransportClient::kDefaultReadMtu);
+ bluez::FakeBluetoothMediaTransportClient::kDefaultReadMtu);
}
// Tests the case where the remote device pauses and resume audio streaming.
@@ -879,7 +881,7 @@ TEST_F(BluetoothAudioSinkChromeOSTest, PauseAndResume) {
EXPECT_EQ(observer_->data_, data_one);
EXPECT_EQ(observer_->read_mtu_,
- FakeBluetoothMediaTransportClient::kDefaultReadMtu);
+ bluez::FakeBluetoothMediaTransportClient::kDefaultReadMtu);
EXPECT_EQ(observer_->state_changed_count_, 3);
EXPECT_EQ(observer_->total_read_, data_one.size());
@@ -899,7 +901,7 @@ TEST_F(BluetoothAudioSinkChromeOSTest, PauseAndResume) {
EXPECT_EQ(observer_->data_, data_two);
EXPECT_EQ(observer_->read_mtu_,
- FakeBluetoothMediaTransportClient::kDefaultReadMtu);
+ bluez::FakeBluetoothMediaTransportClient::kDefaultReadMtu);
EXPECT_EQ(observer_->state_changed_count_, 6);
EXPECT_EQ(observer_->total_read_, data_two.size());
}
@@ -937,7 +939,7 @@ TEST_F(BluetoothAudioSinkChromeOSTest, ContinuouslyStreaming) {
EXPECT_EQ(observer_->data_, data_one);
EXPECT_EQ(observer_->read_mtu_,
- FakeBluetoothMediaTransportClient::kDefaultReadMtu);
+ bluez::FakeBluetoothMediaTransportClient::kDefaultReadMtu);
EXPECT_EQ(observer_->state_changed_count_, 3);
EXPECT_EQ(observer_->total_read_, data_one.size());
@@ -948,7 +950,7 @@ TEST_F(BluetoothAudioSinkChromeOSTest, ContinuouslyStreaming) {
EXPECT_EQ(observer_->data_, data_two);
EXPECT_EQ(observer_->read_mtu_,
- FakeBluetoothMediaTransportClient::kDefaultReadMtu);
+ bluez::FakeBluetoothMediaTransportClient::kDefaultReadMtu);
EXPECT_EQ(observer_->state_changed_count_, 3);
EXPECT_EQ(observer_->total_read_, data_one.size() + data_two.size());
}
diff --git a/device/bluetooth/bluetooth_chromeos_unittest.cc b/device/bluetooth/bluetooth_chromeos_unittest.cc
index 079cce6..cd17a9a 100644
--- a/device/bluetooth/bluetooth_chromeos_unittest.cc
+++ b/device/bluetooth/bluetooth_chromeos_unittest.cc
@@ -6,12 +6,6 @@
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/fake_bluetooth_adapter_client.h"
-#include "chromeos/dbus/fake_bluetooth_agent_manager_client.h"
-#include "chromeos/dbus/fake_bluetooth_device_client.h"
-#include "chromeos/dbus/fake_bluetooth_gatt_service_client.h"
-#include "chromeos/dbus/fake_bluetooth_input_client.h"
#include "dbus/object_path.h"
#include "device/bluetooth/bluetooth_adapter.h"
#include "device/bluetooth/bluetooth_adapter_chromeos.h"
@@ -20,6 +14,12 @@
#include "device/bluetooth/bluetooth_device_chromeos.h"
#include "device/bluetooth/bluetooth_discovery_session.h"
#include "device/bluetooth/bluetooth_pairing_chromeos.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
+#include "device/bluetooth/dbus/fake_bluetooth_adapter_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_agent_manager_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_device_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_gatt_service_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_input_client.h"
#include "device/bluetooth/test/test_bluetooth_adapter_observer.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
@@ -45,17 +45,18 @@ void SaveConnectionInfo(BluetoothDevice::ConnectionInfo* out,
};
class FakeBluetoothProfileServiceProviderDelegate
- : public chromeos::BluetoothProfileServiceProvider::Delegate {
+ : public bluez::BluetoothProfileServiceProvider::Delegate {
public:
FakeBluetoothProfileServiceProviderDelegate() {}
- // BluetoothProfileServiceProvider::Delegate:
+ // bluez::BluetoothProfileServiceProvider::Delegate:
void Released() override {}
- void NewConnection(const dbus::ObjectPath&,
- scoped_ptr<dbus::FileDescriptor>,
- const BluetoothProfileServiceProvider::Delegate::Options&,
- const ConfirmationCallback&) override {}
+ void NewConnection(
+ const dbus::ObjectPath&,
+ scoped_ptr<dbus::FileDescriptor>,
+ const bluez::BluetoothProfileServiceProvider::Delegate::Options&,
+ const ConfirmationCallback&) override {}
void RequestDisconnection(const dbus::ObjectPath&,
const ConfirmationCallback&) override {}
@@ -153,25 +154,28 @@ class TestPairingDelegate : public BluetoothDevice::PairingDelegate {
class BluetoothChromeOSTest : public testing::Test {
public:
void SetUp() override {
- scoped_ptr<DBusThreadManagerSetter> dbus_setter =
- chromeos::DBusThreadManager::GetSetterForTesting();
- // We need to initialize DBusThreadManager early to prevent
+ scoped_ptr<bluez::BluezDBusManagerSetter> dbus_setter =
+ bluez::BluezDBusManager::GetSetterForTesting();
+ // We need to initialize BluezDBusManager early to prevent
// Bluetooth*::Create() methods from picking the real instead of fake
// implementations.
- fake_bluetooth_adapter_client_ = new FakeBluetoothAdapterClient;
+ fake_bluetooth_adapter_client_ = new bluez::FakeBluetoothAdapterClient;
dbus_setter->SetBluetoothAdapterClient(
- scoped_ptr<BluetoothAdapterClient>(fake_bluetooth_adapter_client_));
- fake_bluetooth_device_client_ = new FakeBluetoothDeviceClient;
+ scoped_ptr<bluez::BluetoothAdapterClient>(
+ fake_bluetooth_adapter_client_));
+ fake_bluetooth_device_client_ = new bluez::FakeBluetoothDeviceClient;
dbus_setter->SetBluetoothDeviceClient(
- scoped_ptr<BluetoothDeviceClient>(fake_bluetooth_device_client_));
+ scoped_ptr<bluez::BluetoothDeviceClient>(
+ fake_bluetooth_device_client_));
dbus_setter->SetBluetoothInputClient(
- scoped_ptr<BluetoothInputClient>(new FakeBluetoothInputClient));
+ scoped_ptr<bluez::BluetoothInputClient>(
+ new bluez::FakeBluetoothInputClient));
dbus_setter->SetBluetoothAgentManagerClient(
- scoped_ptr<BluetoothAgentManagerClient>(
- new FakeBluetoothAgentManagerClient));
+ scoped_ptr<bluez::BluetoothAgentManagerClient>(
+ new bluez::FakeBluetoothAgentManagerClient));
dbus_setter->SetBluetoothGattServiceClient(
- scoped_ptr<BluetoothGattServiceClient>(
- new FakeBluetoothGattServiceClient));
+ scoped_ptr<bluez::BluetoothGattServiceClient>(
+ new bluez::FakeBluetoothGattServiceClient));
fake_bluetooth_adapter_client_->SetSimulationIntervalMs(10);
@@ -196,7 +200,7 @@ class BluetoothChromeOSTest : public testing::Test {
}
discovery_sessions_.clear();
adapter_ = nullptr;
- DBusThreadManager::Shutdown();
+ bluez::BluezDBusManager::Shutdown();
}
// Generic callbacks
@@ -325,8 +329,8 @@ class BluetoothChromeOSTest : public testing::Test {
protected:
base::MessageLoop message_loop_;
- FakeBluetoothAdapterClient* fake_bluetooth_adapter_client_;
- FakeBluetoothDeviceClient* fake_bluetooth_device_client_;
+ bluez::FakeBluetoothAdapterClient* fake_bluetooth_adapter_client_;
+ bluez::FakeBluetoothDeviceClient* fake_bluetooth_device_client_;
scoped_refptr<BluetoothAdapter> adapter_;
int callback_count_;
@@ -354,16 +358,16 @@ TEST_F(BluetoothChromeOSTest, AlreadyPresent) {
// and initializes with an existing adapter if there is one.
EXPECT_TRUE(adapter_->IsPresent());
EXPECT_FALSE(adapter_->IsPowered());
- EXPECT_EQ(FakeBluetoothAdapterClient::kAdapterAddress,
+ EXPECT_EQ(bluez::FakeBluetoothAdapterClient::kAdapterAddress,
adapter_->GetAddress());
EXPECT_FALSE(adapter_->IsDiscovering());
// There should be a device
BluetoothAdapter::DeviceList devices = adapter_->GetDevices();
EXPECT_EQ(2U, devices.size());
- EXPECT_EQ(FakeBluetoothDeviceClient::kPairedDeviceAddress,
+ EXPECT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress,
devices[0]->GetAddress());
- EXPECT_EQ(FakeBluetoothDeviceClient::kPairedUnconnectableDeviceAddress,
+ EXPECT_EQ(bluez::FakeBluetoothDeviceClient::kPairedUnconnectableDeviceAddress,
devices[1]->GetAddress());
}
@@ -385,7 +389,7 @@ TEST_F(BluetoothChromeOSTest, BecomePresent) {
// We should have had a device announced.
EXPECT_EQ(2, observer.device_added_count());
- EXPECT_EQ(FakeBluetoothDeviceClient::kPairedUnconnectableDeviceAddress,
+ EXPECT_EQ(bluez::FakeBluetoothDeviceClient::kPairedUnconnectableDeviceAddress,
observer.last_device_address());
// Other callbacks shouldn't be called if the values are false.
@@ -412,7 +416,7 @@ TEST_F(BluetoothChromeOSTest, BecomeNotPresent) {
// We should have had a device removed.
EXPECT_EQ(2, observer.device_removed_count());
- EXPECT_EQ(FakeBluetoothDeviceClient::kPairedUnconnectableDeviceAddress,
+ EXPECT_EQ(bluez::FakeBluetoothDeviceClient::kPairedUnconnectableDeviceAddress,
observer.last_device_address());
// Other callbacks shouldn't be called since the values are false.
@@ -435,7 +439,7 @@ TEST_F(BluetoothChromeOSTest, SecondAdapter) {
EXPECT_EQ(0, observer.present_changed_count());
EXPECT_TRUE(adapter_->IsPresent());
- EXPECT_EQ(FakeBluetoothAdapterClient::kAdapterAddress,
+ EXPECT_EQ(bluez::FakeBluetoothAdapterClient::kAdapterAddress,
adapter_->GetAddress());
// Try removing the first adapter, we should now act as if the adapter
@@ -449,7 +453,7 @@ TEST_F(BluetoothChromeOSTest, SecondAdapter) {
// We should have had a device removed.
EXPECT_EQ(2, observer.device_removed_count());
- EXPECT_EQ(FakeBluetoothDeviceClient::kPairedUnconnectableDeviceAddress,
+ EXPECT_EQ(bluez::FakeBluetoothDeviceClient::kPairedUnconnectableDeviceAddress,
observer.last_device_address());
// Other callbacks shouldn't be called since the values are false.
@@ -720,7 +724,7 @@ TEST_F(BluetoothChromeOSTest, Discovery) {
message_loop_.Run();
EXPECT_EQ(2, observer.device_added_count());
- EXPECT_EQ(FakeBluetoothDeviceClient::kLowEnergyAddress,
+ EXPECT_EQ(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress,
observer.last_device_address());
// Next we should get another two devices...
@@ -732,7 +736,7 @@ TEST_F(BluetoothChromeOSTest, Discovery) {
message_loop_.Run();
EXPECT_EQ(1, observer.device_removed_count());
- EXPECT_EQ(FakeBluetoothDeviceClient::kVanishingDeviceAddress,
+ EXPECT_EQ(bluez::FakeBluetoothDeviceClient::kVanishingDeviceAddress,
observer.last_device_address());
}
@@ -752,7 +756,7 @@ TEST_F(BluetoothChromeOSTest, PoweredAndDiscovering) {
// Stop the timers that the simulation uses
fake_bluetooth_device_client_->EndDiscoverySimulation(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath));
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath));
ASSERT_TRUE(adapter_->IsPowered());
ASSERT_TRUE(adapter_->IsDiscovering());
@@ -946,21 +950,23 @@ TEST_F(BluetoothChromeOSTest,
// Stop the timers that the simulation uses
fake_bluetooth_device_client_->EndDiscoverySimulation(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath));
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath));
ASSERT_TRUE(adapter_->IsPowered());
ASSERT_TRUE(adapter_->IsDiscovering());
// Stop device discovery behind the adapter. The adapter and the observer
// should be notified of the change and the reference count should be reset.
- // Even though FakeBluetoothAdapterClient does its own reference counting and
+ // Even though bluez::FakeBluetoothAdapterClient does its own reference
+ // counting and
// we called 3 BluetoothAdapter::StartDiscoverySession 3 times, the
- // FakeBluetoothAdapterClient's count should be only 1 and a single call to
- // FakeBluetoothAdapterClient::StopDiscovery should work.
+ // bluez::FakeBluetoothAdapterClient's count should be only 1 and a single
+ // call to
+ // bluez::FakeBluetoothAdapterClient::StopDiscovery should work.
fake_bluetooth_adapter_client_->StopDiscovery(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), GetCallback(),
- base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
- base::Unretained(this)));
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
+ GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
+ base::Unretained(this)));
message_loop_.Run();
EXPECT_EQ(2, observer.discovering_changed_count());
EXPECT_EQ(4, callback_count_);
@@ -993,7 +999,7 @@ TEST_F(BluetoothChromeOSTest,
EXPECT_TRUE(discovery_sessions_[i]->IsActive());
fake_bluetooth_device_client_->EndDiscoverySimulation(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath));
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath));
// Make the adapter disappear and appear. This will make it come back as
// discovering. When this happens, the reference count should become and
@@ -1018,7 +1024,8 @@ TEST_F(BluetoothChromeOSTest,
EXPECT_TRUE(observer.last_discovering());
EXPECT_TRUE(adapter_->IsDiscovering());
- // Start and stop discovery. At this point, FakeBluetoothAdapterClient has
+ // Start and stop discovery. At this point, bluez::FakeBluetoothAdapterClient
+ // has
// a reference count that is equal to 1. Pretend that this was done by an
// application other than us. Starting and stopping discovery will succeed
// but it won't cause the discovery state to change.
@@ -1063,9 +1070,9 @@ TEST_F(BluetoothChromeOSTest,
// the discovery state won't change since our BluetoothAdapter also just
// requested it via D-Bus.
fake_bluetooth_adapter_client_->StopDiscovery(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), GetCallback(),
- base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
- base::Unretained(this)));
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
+ GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
+ base::Unretained(this)));
message_loop_.Run();
EXPECT_EQ(5, observer.discovering_changed_count());
EXPECT_EQ(10, callback_count_);
@@ -1124,7 +1131,7 @@ TEST_F(BluetoothChromeOSTest, InvalidatedDiscoverySessions) {
// Stop the timers that the simulation uses
fake_bluetooth_device_client_->EndDiscoverySimulation(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath));
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath));
ASSERT_TRUE(adapter_->IsPowered());
ASSERT_TRUE(adapter_->IsDiscovering());
@@ -1141,9 +1148,9 @@ TEST_F(BluetoothChromeOSTest, InvalidatedDiscoverySessions) {
// memory errors as the sessions that we explicitly deleted should get
// cleaned up.
fake_bluetooth_adapter_client_->StopDiscovery(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), GetCallback(),
- base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
- base::Unretained(this)));
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
+ GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
+ base::Unretained(this)));
message_loop_.Run();
EXPECT_EQ(2, observer.discovering_changed_count());
EXPECT_EQ(4, callback_count_);
@@ -1176,7 +1183,7 @@ TEST_F(BluetoothChromeOSTest, QueuedDiscoveryRequests) {
EXPECT_EQ(0, callback_count_);
fake_bluetooth_device_client_->EndDiscoverySimulation(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath));
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath));
// The underlying adapter has started discovery, but our call hasn't returned
// yet.
@@ -2092,12 +2099,13 @@ TEST_F(BluetoothChromeOSTest, DeviceProperties) {
BluetoothAdapter::DeviceList devices = adapter_->GetDevices();
ASSERT_EQ(2U, devices.size());
- ASSERT_EQ(FakeBluetoothDeviceClient::kPairedDeviceAddress,
+ ASSERT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress,
devices[0]->GetAddress());
// Verify the other device properties.
- EXPECT_EQ(base::UTF8ToUTF16(FakeBluetoothDeviceClient::kPairedDeviceName),
- devices[0]->GetName());
+ EXPECT_EQ(
+ base::UTF8ToUTF16(bluez::FakeBluetoothDeviceClient::kPairedDeviceName),
+ devices[0]->GetName());
EXPECT_EQ(BluetoothDevice::DEVICE_COMPUTER, devices[0]->GetDeviceType());
EXPECT_TRUE(devices[0]->IsPaired());
EXPECT_FALSE(devices[0]->IsConnected());
@@ -2124,7 +2132,7 @@ TEST_F(BluetoothChromeOSTest, DeviceClassChanged) {
BluetoothAdapter::DeviceList devices = adapter_->GetDevices();
ASSERT_EQ(2U, devices.size());
- ASSERT_EQ(FakeBluetoothDeviceClient::kPairedDeviceAddress,
+ ASSERT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress,
devices[0]->GetAddress());
ASSERT_EQ(BluetoothDevice::DEVICE_COMPUTER, devices[0]->GetDeviceType());
@@ -2132,9 +2140,9 @@ TEST_F(BluetoothChromeOSTest, DeviceClassChanged) {
// we change the class of the device.
TestBluetoothAdapterObserver observer(adapter_);
- FakeBluetoothDeviceClient::Properties* properties =
- fake_bluetooth_device_client_->GetProperties(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath));
+ bluez::FakeBluetoothDeviceClient::Properties* properties =
+ fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
+ bluez::FakeBluetoothDeviceClient::kPairedDevicePath));
properties->bluetooth_class.ReplaceValue(0x002580);
@@ -2150,18 +2158,19 @@ TEST_F(BluetoothChromeOSTest, DeviceNameChanged) {
BluetoothAdapter::DeviceList devices = adapter_->GetDevices();
ASSERT_EQ(2U, devices.size());
- ASSERT_EQ(FakeBluetoothDeviceClient::kPairedDeviceAddress,
+ ASSERT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress,
devices[0]->GetAddress());
- ASSERT_EQ(base::UTF8ToUTF16(FakeBluetoothDeviceClient::kPairedDeviceName),
- devices[0]->GetName());
+ ASSERT_EQ(
+ base::UTF8ToUTF16(bluez::FakeBluetoothDeviceClient::kPairedDeviceName),
+ devices[0]->GetName());
// Install an observer; expect the DeviceChanged method to be called when
// we change the alias of the device.
TestBluetoothAdapterObserver observer(adapter_);
- FakeBluetoothDeviceClient::Properties* properties =
- fake_bluetooth_device_client_->GetProperties(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath));
+ bluez::FakeBluetoothDeviceClient::Properties* properties =
+ fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
+ bluez::FakeBluetoothDeviceClient::kPairedDevicePath));
static const std::string new_name("New Device Name");
properties->alias.ReplaceValue(new_name);
@@ -2178,18 +2187,19 @@ TEST_F(BluetoothChromeOSTest, DeviceAddressChanged) {
BluetoothAdapter::DeviceList devices = adapter_->GetDevices();
ASSERT_EQ(2U, devices.size());
- ASSERT_EQ(FakeBluetoothDeviceClient::kPairedDeviceAddress,
+ ASSERT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress,
devices[0]->GetAddress());
- ASSERT_EQ(base::UTF8ToUTF16(FakeBluetoothDeviceClient::kPairedDeviceName),
- devices[0]->GetName());
+ ASSERT_EQ(
+ base::UTF8ToUTF16(bluez::FakeBluetoothDeviceClient::kPairedDeviceName),
+ devices[0]->GetName());
// Install an observer; expect the DeviceAddressChanged method to be called
// when we change the alias of the device.
TestBluetoothAdapterObserver observer(adapter_);
- FakeBluetoothDeviceClient::Properties* properties =
- fake_bluetooth_device_client_->GetProperties(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath));
+ bluez::FakeBluetoothDeviceClient::Properties* properties =
+ fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
+ bluez::FakeBluetoothDeviceClient::kPairedDevicePath));
static const char* kNewAddress = "D9:1F:FC:11:22:33";
properties->address.ReplaceValue(kNewAddress);
@@ -2207,7 +2217,7 @@ TEST_F(BluetoothChromeOSTest, DeviceUuidsChanged) {
BluetoothAdapter::DeviceList devices = adapter_->GetDevices();
ASSERT_EQ(2U, devices.size());
- ASSERT_EQ(FakeBluetoothDeviceClient::kPairedDeviceAddress,
+ ASSERT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress,
devices[0]->GetAddress());
BluetoothDevice::UUIDList uuids = devices[0]->GetUUIDs();
@@ -2219,9 +2229,9 @@ TEST_F(BluetoothChromeOSTest, DeviceUuidsChanged) {
// we change the class of the device.
TestBluetoothAdapterObserver observer(adapter_);
- FakeBluetoothDeviceClient::Properties* properties =
- fake_bluetooth_device_client_->GetProperties(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath));
+ bluez::FakeBluetoothDeviceClient::Properties* properties =
+ fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
+ bluez::FakeBluetoothDeviceClient::kPairedDevicePath));
std::vector<std::string> new_uuids;
new_uuids.push_back(uuids[0].canonical_value());
@@ -2252,12 +2262,12 @@ TEST_F(BluetoothChromeOSTest, DeviceInquiryRSSIInvalidated) {
BluetoothAdapter::DeviceList devices = adapter_->GetDevices();
ASSERT_EQ(2U, devices.size());
- ASSERT_EQ(FakeBluetoothDeviceClient::kPairedDeviceAddress,
+ ASSERT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress,
devices[0]->GetAddress());
- FakeBluetoothDeviceClient::Properties* properties =
- fake_bluetooth_device_client_->GetProperties(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath));
+ bluez::FakeBluetoothDeviceClient::Properties* properties =
+ fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
+ bluez::FakeBluetoothDeviceClient::kPairedDevicePath));
// During discovery, rssi is a valid value (-75)
properties->rssi.ReplaceValue(-75);
@@ -2287,12 +2297,12 @@ TEST_F(BluetoothChromeOSTest, DeviceInquiryTxPowerInvalidated) {
BluetoothAdapter::DeviceList devices = adapter_->GetDevices();
ASSERT_EQ(2U, devices.size());
- ASSERT_EQ(FakeBluetoothDeviceClient::kPairedDeviceAddress,
+ ASSERT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress,
devices[0]->GetAddress());
- FakeBluetoothDeviceClient::Properties* properties =
- fake_bluetooth_device_client_->GetProperties(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath));
+ bluez::FakeBluetoothDeviceClient::Properties* properties =
+ fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
+ bluez::FakeBluetoothDeviceClient::kPairedDevicePath));
// During discovery, tx_power is a valid value (0)
properties->tx_power.ReplaceValue(0);
@@ -2320,7 +2330,7 @@ TEST_F(BluetoothChromeOSTest, ForgetDevice) {
BluetoothAdapter::DeviceList devices = adapter_->GetDevices();
ASSERT_EQ(2U, devices.size());
- ASSERT_EQ(FakeBluetoothDeviceClient::kPairedDeviceAddress,
+ ASSERT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress,
devices[0]->GetAddress());
std::string address = devices[0]->GetAddress();
@@ -2345,7 +2355,7 @@ TEST_F(BluetoothChromeOSTest, ForgetUnpairedDevice) {
DiscoverDevices();
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kConnectUnpairableAddress);
+ bluez::FakeBluetoothDeviceClient::kConnectUnpairableAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
@@ -2362,9 +2372,9 @@ TEST_F(BluetoothChromeOSTest, ForgetUnpairedDevice) {
ASSERT_FALSE(device->IsConnecting());
// Make sure the trusted property has been set to true.
- FakeBluetoothDeviceClient::Properties* properties =
- fake_bluetooth_device_client_->GetProperties(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kConnectUnpairablePath));
+ bluez::FakeBluetoothDeviceClient::Properties* properties =
+ fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
+ bluez::FakeBluetoothDeviceClient::kConnectUnpairablePath));
ASSERT_TRUE(properties->trusted.value());
// Install an observer; expect the DeviceRemoved method to be called
@@ -2375,12 +2385,12 @@ TEST_F(BluetoothChromeOSTest, ForgetUnpairedDevice) {
EXPECT_EQ(0, error_callback_count_);
EXPECT_EQ(1, observer.device_removed_count());
- EXPECT_EQ(FakeBluetoothDeviceClient::kConnectUnpairableAddress,
+ EXPECT_EQ(bluez::FakeBluetoothDeviceClient::kConnectUnpairableAddress,
observer.last_device_address());
// GetDevices shouldn't return the device either.
device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kConnectUnpairableAddress);
+ bluez::FakeBluetoothDeviceClient::kConnectUnpairableAddress);
EXPECT_FALSE(device != nullptr);
}
@@ -2388,7 +2398,7 @@ TEST_F(BluetoothChromeOSTest, ConnectPairedDevice) {
GetAdapter();
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kPairedDeviceAddress);
+ bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_TRUE(device->IsPaired());
@@ -2417,7 +2427,7 @@ TEST_F(BluetoothChromeOSTest, ConnectUnpairableDevice) {
DiscoverDevices();
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kConnectUnpairableAddress);
+ bluez::FakeBluetoothDeviceClient::kConnectUnpairableAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
@@ -2441,9 +2451,9 @@ TEST_F(BluetoothChromeOSTest, ConnectUnpairableDevice) {
EXPECT_FALSE(device->IsConnecting());
// Make sure the trusted property has been set to true.
- FakeBluetoothDeviceClient::Properties* properties =
- fake_bluetooth_device_client_->GetProperties(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kConnectUnpairablePath));
+ bluez::FakeBluetoothDeviceClient::Properties* properties =
+ fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
+ bluez::FakeBluetoothDeviceClient::kConnectUnpairablePath));
EXPECT_TRUE(properties->trusted.value());
// Verify is a HID device and is not connectable.
@@ -2457,7 +2467,7 @@ TEST_F(BluetoothChromeOSTest, ConnectConnectedDevice) {
GetAdapter();
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kPairedDeviceAddress);
+ bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_TRUE(device->IsPaired());
@@ -2495,7 +2505,7 @@ TEST_F(BluetoothChromeOSTest, ConnectDeviceFails) {
DiscoverDevices();
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kLegacyAutopairAddress);
+ bluez::FakeBluetoothDeviceClient::kLegacyAutopairAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
@@ -2521,7 +2531,7 @@ TEST_F(BluetoothChromeOSTest, DisconnectDevice) {
GetAdapter();
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kPairedDeviceAddress);
+ bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_TRUE(device->IsPaired());
@@ -2555,7 +2565,7 @@ TEST_F(BluetoothChromeOSTest, DisconnectUnconnectedDevice) {
GetAdapter();
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kPairedDeviceAddress);
+ bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_TRUE(device->IsPaired());
ASSERT_FALSE(device->IsConnected());
@@ -2583,7 +2593,7 @@ TEST_F(BluetoothChromeOSTest, PairLegacyAutopair) {
// The Legacy Autopair device requires no PIN or Passkey to pair because
// the daemon provides 0000 to the device for us.
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kLegacyAutopairAddress);
+ bluez::FakeBluetoothDeviceClient::kLegacyAutopairAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
@@ -2620,9 +2630,9 @@ TEST_F(BluetoothChromeOSTest, PairLegacyAutopair) {
EXPECT_TRUE(device->IsConnectable());
// Make sure the trusted property has been set to true.
- FakeBluetoothDeviceClient::Properties* properties =
- fake_bluetooth_device_client_->GetProperties(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kLegacyAutopairPath));
+ bluez::FakeBluetoothDeviceClient::Properties* properties =
+ fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
+ bluez::FakeBluetoothDeviceClient::kLegacyAutopairPath));
EXPECT_TRUE(properties->trusted.value());
}
@@ -2634,7 +2644,7 @@ TEST_F(BluetoothChromeOSTest, PairDisplayPinCode) {
// Requires that we display a randomly generated PIN on the screen.
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kDisplayPinCodeAddress);
+ bluez::FakeBluetoothDeviceClient::kDisplayPinCodeAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
@@ -2673,9 +2683,9 @@ TEST_F(BluetoothChromeOSTest, PairDisplayPinCode) {
EXPECT_TRUE(device->IsConnectable());
// Make sure the trusted property has been set to true.
- FakeBluetoothDeviceClient::Properties* properties =
- fake_bluetooth_device_client_->GetProperties(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kDisplayPinCodePath));
+ bluez::FakeBluetoothDeviceClient::Properties* properties =
+ fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
+ bluez::FakeBluetoothDeviceClient::kDisplayPinCodePath));
EXPECT_TRUE(properties->trusted.value());
}
@@ -2688,7 +2698,7 @@ TEST_F(BluetoothChromeOSTest, PairDisplayPasskey) {
// Requires that we display a randomly generated Passkey on the screen,
// and notifies us as it's typed in.
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kDisplayPasskeyAddress);
+ bluez::FakeBluetoothDeviceClient::kDisplayPasskeyAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
@@ -2748,9 +2758,9 @@ TEST_F(BluetoothChromeOSTest, PairDisplayPasskey) {
EXPECT_FALSE(device->IsConnectable());
// Make sure the trusted property has been set to true.
- FakeBluetoothDeviceClient::Properties* properties =
- fake_bluetooth_device_client_->GetProperties(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kDisplayPasskeyPath));
+ bluez::FakeBluetoothDeviceClient::Properties* properties =
+ fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
+ bluez::FakeBluetoothDeviceClient::kDisplayPasskeyPath));
EXPECT_TRUE(properties->trusted.value());
}
@@ -2762,7 +2772,7 @@ TEST_F(BluetoothChromeOSTest, PairRequestPinCode) {
// Requires that the user enters a PIN for them.
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kRequestPinCodeAddress);
+ bluez::FakeBluetoothDeviceClient::kRequestPinCodeAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
@@ -2802,9 +2812,9 @@ TEST_F(BluetoothChromeOSTest, PairRequestPinCode) {
EXPECT_TRUE(device->IsConnectable());
// Make sure the trusted property has been set to true.
- FakeBluetoothDeviceClient::Properties* properties =
- fake_bluetooth_device_client_->GetProperties(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPinCodePath));
+ bluez::FakeBluetoothDeviceClient::Properties* properties =
+ fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
+ bluez::FakeBluetoothDeviceClient::kRequestPinCodePath));
EXPECT_TRUE(properties->trusted.value());
}
@@ -2816,7 +2826,7 @@ TEST_F(BluetoothChromeOSTest, PairConfirmPasskey) {
// Requests that we confirm a displayed passkey.
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kConfirmPasskeyAddress);
+ bluez::FakeBluetoothDeviceClient::kConfirmPasskeyAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
@@ -2853,9 +2863,9 @@ TEST_F(BluetoothChromeOSTest, PairConfirmPasskey) {
EXPECT_TRUE(device->IsConnectable());
// Make sure the trusted property has been set to true.
- FakeBluetoothDeviceClient::Properties* properties =
- fake_bluetooth_device_client_->GetProperties(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kConfirmPasskeyPath));
+ bluez::FakeBluetoothDeviceClient::Properties* properties =
+ fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
+ bluez::FakeBluetoothDeviceClient::kConfirmPasskeyPath));
EXPECT_TRUE(properties->trusted.value());
}
@@ -2868,7 +2878,7 @@ TEST_F(BluetoothChromeOSTest, PairRequestPasskey) {
// Requires that the user enters a Passkey, this would be some kind of
// device that has a display, but doesn't use "just works" - maybe a car?
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kRequestPasskeyAddress);
+ bluez::FakeBluetoothDeviceClient::kRequestPasskeyAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
@@ -2904,9 +2914,9 @@ TEST_F(BluetoothChromeOSTest, PairRequestPasskey) {
EXPECT_TRUE(device->IsConnectable());
// Make sure the trusted property has been set to true.
- FakeBluetoothDeviceClient::Properties* properties =
- fake_bluetooth_device_client_->GetProperties(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPasskeyPath));
+ bluez::FakeBluetoothDeviceClient::Properties* properties =
+ fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
+ bluez::FakeBluetoothDeviceClient::kRequestPasskeyPath));
EXPECT_TRUE(properties->trusted.value());
}
@@ -2918,8 +2928,8 @@ TEST_F(BluetoothChromeOSTest, PairJustWorks) {
// Uses just-works pairing, since this is an outgoing pairing, no delegate
// interaction is required.
- BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kJustWorksAddress);
+ BluetoothDevice* device =
+ adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kJustWorksAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
@@ -2951,9 +2961,9 @@ TEST_F(BluetoothChromeOSTest, PairJustWorks) {
EXPECT_TRUE(device->IsConnectable());
// Make sure the trusted property has been set to true.
- FakeBluetoothDeviceClient::Properties* properties =
+ bluez::FakeBluetoothDeviceClient::Properties* properties =
fake_bluetooth_device_client_->GetProperties(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kJustWorksPath));
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kJustWorksPath));
EXPECT_TRUE(properties->trusted.value());
}
@@ -2961,10 +2971,10 @@ TEST_F(BluetoothChromeOSTest, PairUnpairableDeviceFails) {
fake_bluetooth_device_client_->SetSimulationIntervalMs(10);
GetAdapter();
- DiscoverDevice(FakeBluetoothDeviceClient::kUnconnectableDeviceAddress);
+ DiscoverDevice(bluez::FakeBluetoothDeviceClient::kUnconnectableDeviceAddress);
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kUnpairableDeviceAddress);
+ bluez::FakeBluetoothDeviceClient::kUnpairableDeviceAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
@@ -2995,11 +3005,11 @@ TEST_F(BluetoothChromeOSTest, PairingFails) {
fake_bluetooth_device_client_->SetSimulationIntervalMs(10);
GetAdapter();
- DiscoverDevice(FakeBluetoothDeviceClient::kVanishingDeviceAddress);
+ DiscoverDevice(bluez::FakeBluetoothDeviceClient::kVanishingDeviceAddress);
// The vanishing device times out during pairing
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kVanishingDeviceAddress);
+ bluez::FakeBluetoothDeviceClient::kVanishingDeviceAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
@@ -3035,7 +3045,7 @@ TEST_F(BluetoothChromeOSTest, PairingFailsAtConnection) {
// Everything seems to go according to plan with the unconnectable device;
// it pairs, but then you can't make connections to it after.
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kUnconnectableDeviceAddress);
+ bluez::FakeBluetoothDeviceClient::kUnconnectableDeviceAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
@@ -3067,10 +3077,9 @@ TEST_F(BluetoothChromeOSTest, PairingFailsAtConnection) {
// Make sure the trusted property has been set to true still (since pairing
// worked).
- FakeBluetoothDeviceClient::Properties* properties =
- fake_bluetooth_device_client_->GetProperties(
- dbus::ObjectPath(
- FakeBluetoothDeviceClient::kUnconnectableDevicePath));
+ bluez::FakeBluetoothDeviceClient::Properties* properties =
+ fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
+ bluez::FakeBluetoothDeviceClient::kUnconnectableDevicePath));
EXPECT_TRUE(properties->trusted.value());
}
@@ -3082,7 +3091,7 @@ TEST_F(BluetoothChromeOSTest, PairingRejectedAtPinCode) {
// Reject the pairing after we receive a request for the PIN code.
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kRequestPinCodeAddress);
+ bluez::FakeBluetoothDeviceClient::kRequestPinCodeAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
@@ -3120,7 +3129,7 @@ TEST_F(BluetoothChromeOSTest, PairingCancelledAtPinCode) {
// Cancel the pairing after we receive a request for the PIN code.
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kRequestPinCodeAddress);
+ bluez::FakeBluetoothDeviceClient::kRequestPinCodeAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
@@ -3158,7 +3167,7 @@ TEST_F(BluetoothChromeOSTest, PairingRejectedAtPasskey) {
// Reject the pairing after we receive a request for the passkey.
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kRequestPasskeyAddress);
+ bluez::FakeBluetoothDeviceClient::kRequestPasskeyAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
@@ -3196,7 +3205,7 @@ TEST_F(BluetoothChromeOSTest, PairingCancelledAtPasskey) {
// Cancel the pairing after we receive a request for the passkey.
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kRequestPasskeyAddress);
+ bluez::FakeBluetoothDeviceClient::kRequestPasskeyAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
@@ -3234,7 +3243,7 @@ TEST_F(BluetoothChromeOSTest, PairingRejectedAtConfirmation) {
// Reject the pairing after we receive a request for passkey confirmation.
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kConfirmPasskeyAddress);
+ bluez::FakeBluetoothDeviceClient::kConfirmPasskeyAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
@@ -3272,7 +3281,7 @@ TEST_F(BluetoothChromeOSTest, PairingCancelledAtConfirmation) {
// Cancel the pairing after we receive a request for the passkey.
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kConfirmPasskeyAddress);
+ bluez::FakeBluetoothDeviceClient::kConfirmPasskeyAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
@@ -3310,7 +3319,7 @@ TEST_F(BluetoothChromeOSTest, PairingCancelledInFlight) {
// Cancel the pairing while we're waiting for the remote host.
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kLegacyAutopairAddress);
+ bluez::FakeBluetoothDeviceClient::kLegacyAutopairAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
@@ -3351,19 +3360,19 @@ TEST_F(BluetoothChromeOSTest, IncomingPairRequestPinCode) {
// Requires that we provide a PIN code.
fake_bluetooth_device_client_->CreateDevice(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
- dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPinCodePath));
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPinCodePath));
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kRequestPinCodeAddress);
+ bluez::FakeBluetoothDeviceClient::kRequestPinCodeAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
TestBluetoothAdapterObserver observer(adapter_);
fake_bluetooth_device_client_->SimulatePairing(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPinCodePath), true,
- GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
- base::Unretained(this)));
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPinCodePath),
+ true, GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
+ base::Unretained(this)));
EXPECT_EQ(1, pairing_delegate.call_count_);
EXPECT_EQ(1, pairing_delegate.request_pincode_count_);
@@ -3382,9 +3391,9 @@ TEST_F(BluetoothChromeOSTest, IncomingPairRequestPinCode) {
EXPECT_TRUE(device->IsPaired());
// Make sure the trusted property has been set to true.
- FakeBluetoothDeviceClient::Properties* properties =
- fake_bluetooth_device_client_->GetProperties(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPinCodePath));
+ bluez::FakeBluetoothDeviceClient::Properties* properties =
+ fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
+ bluez::FakeBluetoothDeviceClient::kRequestPinCodePath));
ASSERT_TRUE(properties->trusted.value());
// No pairing context should remain on the device.
@@ -3405,19 +3414,19 @@ TEST_F(BluetoothChromeOSTest, IncomingPairConfirmPasskey) {
// Requests that we confirm a displayed passkey.
fake_bluetooth_device_client_->CreateDevice(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
- dbus::ObjectPath(FakeBluetoothDeviceClient::kConfirmPasskeyPath));
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kConfirmPasskeyPath));
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kConfirmPasskeyAddress);
+ bluez::FakeBluetoothDeviceClient::kConfirmPasskeyAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
TestBluetoothAdapterObserver observer(adapter_);
fake_bluetooth_device_client_->SimulatePairing(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kConfirmPasskeyPath), true,
- GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
- base::Unretained(this)));
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kConfirmPasskeyPath),
+ true, GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
+ base::Unretained(this)));
EXPECT_EQ(1, pairing_delegate.call_count_);
EXPECT_EQ(1, pairing_delegate.confirm_passkey_count_);
@@ -3437,9 +3446,9 @@ TEST_F(BluetoothChromeOSTest, IncomingPairConfirmPasskey) {
EXPECT_TRUE(device->IsPaired());
// Make sure the trusted property has been set to true.
- FakeBluetoothDeviceClient::Properties* properties =
- fake_bluetooth_device_client_->GetProperties(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kConfirmPasskeyPath));
+ bluez::FakeBluetoothDeviceClient::Properties* properties =
+ fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
+ bluez::FakeBluetoothDeviceClient::kConfirmPasskeyPath));
ASSERT_TRUE(properties->trusted.value());
// No pairing context should remain on the device.
@@ -3460,19 +3469,19 @@ TEST_F(BluetoothChromeOSTest, IncomingPairRequestPasskey) {
// Requests that we provide a Passkey.
fake_bluetooth_device_client_->CreateDevice(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
- dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPasskeyPath));
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPasskeyPath));
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kRequestPasskeyAddress);
+ bluez::FakeBluetoothDeviceClient::kRequestPasskeyAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
TestBluetoothAdapterObserver observer(adapter_);
fake_bluetooth_device_client_->SimulatePairing(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPasskeyPath), true,
- GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
- base::Unretained(this)));
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPasskeyPath),
+ true, GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
+ base::Unretained(this)));
EXPECT_EQ(1, pairing_delegate.call_count_);
EXPECT_EQ(1, pairing_delegate.request_passkey_count_);
@@ -3491,9 +3500,9 @@ TEST_F(BluetoothChromeOSTest, IncomingPairRequestPasskey) {
EXPECT_TRUE(device->IsPaired());
// Make sure the trusted property has been set to true.
- FakeBluetoothDeviceClient::Properties* properties =
- fake_bluetooth_device_client_->GetProperties(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPasskeyPath));
+ bluez::FakeBluetoothDeviceClient::Properties* properties =
+ fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
+ bluez::FakeBluetoothDeviceClient::kRequestPasskeyPath));
ASSERT_TRUE(properties->trusted.value());
// No pairing context should remain on the device.
@@ -3515,17 +3524,17 @@ TEST_F(BluetoothChromeOSTest, IncomingPairJustWorks) {
// Uses just-works pairing so, sinec this an incoming pairing, require
// authorization from the user.
fake_bluetooth_device_client_->CreateDevice(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
- dbus::ObjectPath(FakeBluetoothDeviceClient::kJustWorksPath));
- BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kJustWorksAddress);
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kJustWorksPath));
+ BluetoothDevice* device =
+ adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kJustWorksAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
TestBluetoothAdapterObserver observer(adapter_);
fake_bluetooth_device_client_->SimulatePairing(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kJustWorksPath), true,
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kJustWorksPath), true,
GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
base::Unretained(this)));
@@ -3546,9 +3555,9 @@ TEST_F(BluetoothChromeOSTest, IncomingPairJustWorks) {
EXPECT_TRUE(device->IsPaired());
// Make sure the trusted property has been set to true.
- FakeBluetoothDeviceClient::Properties* properties =
+ bluez::FakeBluetoothDeviceClient::Properties* properties =
fake_bluetooth_device_client_->GetProperties(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kJustWorksPath));
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kJustWorksPath));
ASSERT_TRUE(properties->trusted.value());
// No pairing context should remain on the device.
@@ -3565,19 +3574,19 @@ TEST_F(BluetoothChromeOSTest, IncomingPairRequestPinCodeWithoutDelegate) {
// Requires that we provide a PIN Code, without a pairing delegate,
// that will be rejected.
fake_bluetooth_device_client_->CreateDevice(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
- dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPinCodePath));
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPinCodePath));
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kRequestPinCodeAddress);
+ bluez::FakeBluetoothDeviceClient::kRequestPinCodeAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
TestBluetoothAdapterObserver observer(adapter_);
fake_bluetooth_device_client_->SimulatePairing(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPinCodePath), true,
- GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
- base::Unretained(this)));
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPinCodePath),
+ true, GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
+ base::Unretained(this)));
message_loop_.Run();
@@ -3604,19 +3613,19 @@ TEST_F(BluetoothChromeOSTest, IncomingPairConfirmPasskeyWithoutDelegate) {
// Requests that we confirm a displayed passkey, without a pairing delegate,
// that will be rejected.
fake_bluetooth_device_client_->CreateDevice(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
- dbus::ObjectPath(FakeBluetoothDeviceClient::kConfirmPasskeyPath));
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kConfirmPasskeyPath));
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kConfirmPasskeyAddress);
+ bluez::FakeBluetoothDeviceClient::kConfirmPasskeyAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
TestBluetoothAdapterObserver observer(adapter_);
fake_bluetooth_device_client_->SimulatePairing(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kConfirmPasskeyPath), true,
- GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
- base::Unretained(this)));
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kConfirmPasskeyPath),
+ true, GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
+ base::Unretained(this)));
message_loop_.Run();
@@ -3643,19 +3652,19 @@ TEST_F(BluetoothChromeOSTest, IncomingPairRequestPasskeyWithoutDelegate) {
// Requests that we provide a displayed passkey, without a pairing delegate,
// that will be rejected.
fake_bluetooth_device_client_->CreateDevice(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
- dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPasskeyPath));
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPasskeyPath));
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kRequestPasskeyAddress);
+ bluez::FakeBluetoothDeviceClient::kRequestPasskeyAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
TestBluetoothAdapterObserver observer(adapter_);
fake_bluetooth_device_client_->SimulatePairing(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPasskeyPath), true,
- GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
- base::Unretained(this)));
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPasskeyPath),
+ true, GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
+ base::Unretained(this)));
message_loop_.Run();
@@ -3682,17 +3691,17 @@ TEST_F(BluetoothChromeOSTest, IncomingPairJustWorksWithoutDelegate) {
// Uses just-works pairing and thus requires authorization for incoming
// pairings, without a pairing delegate, that will be rejected.
fake_bluetooth_device_client_->CreateDevice(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
- dbus::ObjectPath(FakeBluetoothDeviceClient::kJustWorksPath));
- BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kJustWorksAddress);
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kJustWorksPath));
+ BluetoothDevice* device =
+ adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kJustWorksAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
TestBluetoothAdapterObserver observer(adapter_);
fake_bluetooth_device_client_->SimulatePairing(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kJustWorksPath), true,
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kJustWorksPath), true,
GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
base::Unretained(this)));
@@ -3725,19 +3734,19 @@ TEST_F(BluetoothChromeOSTest, RemovePairingDelegateDuringPairing) {
// Requests that we provide a Passkey.
fake_bluetooth_device_client_->CreateDevice(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
- dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPasskeyPath));
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPasskeyPath));
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kRequestPasskeyAddress);
+ bluez::FakeBluetoothDeviceClient::kRequestPasskeyAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
TestBluetoothAdapterObserver observer(adapter_);
fake_bluetooth_device_client_->SimulatePairing(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPasskeyPath), true,
- GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
- base::Unretained(this)));
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPasskeyPath),
+ true, GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
+ base::Unretained(this)));
EXPECT_EQ(1, pairing_delegate.call_count_);
EXPECT_EQ(1, pairing_delegate.request_passkey_count_);
@@ -3769,10 +3778,10 @@ TEST_F(BluetoothChromeOSTest, DeviceId) {
// Use the built-in paired device for this test, grab its Properties
// structure so we can adjust the underlying modalias property.
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kPairedDeviceAddress);
- FakeBluetoothDeviceClient::Properties* properties =
- fake_bluetooth_device_client_->GetProperties(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath));
+ bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress);
+ bluez::FakeBluetoothDeviceClient::Properties* properties =
+ fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
+ bluez::FakeBluetoothDeviceClient::kPairedDevicePath));
ASSERT_TRUE(device != nullptr);
ASSERT_TRUE(properties != nullptr);
@@ -3820,8 +3829,8 @@ TEST_F(BluetoothChromeOSTest, DeviceId) {
TEST_F(BluetoothChromeOSTest, GetConnectionInfoForDisconnectedDevice) {
GetAdapter();
- BluetoothDevice* device =
- adapter_->GetDevice(FakeBluetoothDeviceClient::kPairedDeviceAddress);
+ BluetoothDevice* device = adapter_->GetDevice(
+ bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress);
// Calling GetConnectionInfo for an unconnected device should return a result
// in which all fields are filled with BluetoothDevice::kUnknownPower.
@@ -3836,8 +3845,8 @@ TEST_F(BluetoothChromeOSTest, GetConnectionInfoForDisconnectedDevice) {
TEST_F(BluetoothChromeOSTest, GetConnectionInfoForConnectedDevice) {
GetAdapter();
- BluetoothDevice* device =
- adapter_->GetDevice(FakeBluetoothDeviceClient::kPairedDeviceAddress);
+ BluetoothDevice* device = adapter_->GetDevice(
+ bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress);
device->Connect(nullptr, GetCallback(),
base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback,
@@ -3882,8 +3891,9 @@ TEST_F(BluetoothChromeOSTest, Shutdown) {
EXPECT_TRUE(adapter_->IsDiscoverable());
EXPECT_TRUE(adapter_->IsDiscovering());
EXPECT_EQ(2U, adapter_->GetDevices().size());
- EXPECT_NE(nullptr, adapter_->GetDevice(
- FakeBluetoothDeviceClient::kPairedDeviceAddress));
+ EXPECT_NE(nullptr,
+ adapter_->GetDevice(
+ bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress));
EXPECT_NE(dbus::ObjectPath(""), static_cast<BluetoothAdapterChromeOS*>(
adapter_.get())->object_path());
@@ -3960,7 +3970,7 @@ TEST_F(BluetoothChromeOSTest, Shutdown) {
FakeBluetoothProfileServiceProviderDelegate profile_delegate;
adapter_chrome_os->UseProfile(
BluetoothUUID(), dbus::ObjectPath(""),
- BluetoothProfileManagerClient::Options(), &profile_delegate,
+ bluez::BluetoothProfileManagerClient::Options(), &profile_delegate,
base::Bind(&BluetoothChromeOSTest::ProfileRegisteredCallback,
base::Unretained(this)),
base::Bind(&BluetoothChromeOSTest::ErrorCompletionCallback,
@@ -3980,7 +3990,8 @@ TEST_F(BluetoothChromeOSTest, Shutdown) {
adapter_chrome_os->DeviceRemoved(dbus::ObjectPath(""));
adapter_chrome_os->DevicePropertyChanged(dbus::ObjectPath(""), "");
adapter_chrome_os->InputPropertyChanged(dbus::ObjectPath(""), "");
- // BluetoothAgentServiceProvider::Delegate omitted, dbus will be shutdown,
+ // bluez::BluetoothAgentServiceProvider::Delegate omitted, dbus will be
+ // shutdown,
// with the exception of Released.
adapter_chrome_os->Released();
@@ -4037,7 +4048,7 @@ TEST_F(BluetoothChromeOSTest, Shutdown) {
// UseProfile to be set first, do so again here just before calling them.
adapter_chrome_os->UseProfile(
BluetoothUUID(), dbus::ObjectPath(""),
- BluetoothProfileManagerClient::Options(), &profile_delegate,
+ bluez::BluetoothProfileManagerClient::Options(), &profile_delegate,
base::Bind(&BluetoothChromeOSTest::ProfileRegisteredCallback,
base::Unretained(this)),
base::Bind(&BluetoothChromeOSTest::ErrorCompletionCallback,
@@ -4072,8 +4083,9 @@ TEST_F(BluetoothChromeOSTest, Shutdown) {
EXPECT_EQ(1, error_callback_count_--) << "StartDiscoverySession error";
EXPECT_EQ(0U, adapter_->GetDevices().size());
- EXPECT_EQ(nullptr, adapter_->GetDevice(
- FakeBluetoothDeviceClient::kPairedDeviceAddress));
+ EXPECT_EQ(nullptr,
+ adapter_->GetDevice(
+ bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress));
TestPairingDelegate pairing_delegate2;
adapter_->AddPairingDelegate(
&pairing_delegate2, BluetoothAdapter::PAIRING_DELEGATE_PRIORITY_HIGH);
diff --git a/device/bluetooth/bluetooth_device_chromeos.cc b/device/bluetooth/bluetooth_device_chromeos.cc
index 9acaec0..89c5572 100644
--- a/device/bluetooth/bluetooth_device_chromeos.cc
+++ b/device/bluetooth/bluetooth_device_chromeos.cc
@@ -11,11 +11,6 @@
#include "base/metrics/histogram.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
-#include "chromeos/dbus/bluetooth_adapter_client.h"
-#include "chromeos/dbus/bluetooth_device_client.h"
-#include "chromeos/dbus/bluetooth_gatt_service_client.h"
-#include "chromeos/dbus/bluetooth_input_client.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
#include "dbus/bus.h"
#include "device/bluetooth/bluetooth_adapter_chromeos.h"
#include "device/bluetooth/bluetooth_gatt_connection_chromeos.h"
@@ -25,6 +20,11 @@
#include "device/bluetooth/bluetooth_socket_chromeos.h"
#include "device/bluetooth/bluetooth_socket_thread.h"
#include "device/bluetooth/bluetooth_uuid.h"
+#include "device/bluetooth/dbus/bluetooth_adapter_client.h"
+#include "device/bluetooth/dbus/bluetooth_device_client.h"
+#include "device/bluetooth/dbus/bluetooth_gatt_service_client.h"
+#include "device/bluetooth/dbus/bluetooth_input_client.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
using device::BluetoothDevice;
@@ -54,9 +54,9 @@ void ParseModalias(const dbus::ObjectPath& object_path,
uint16* vendor_id,
uint16* product_id,
uint16* device_id) {
- chromeos::BluetoothDeviceClient::Properties* properties =
- chromeos::DBusThreadManager::Get()->GetBluetoothDeviceClient()->
- GetProperties(object_path);
+ bluez::BluetoothDeviceClient::Properties* properties =
+ bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
+ object_path);
DCHECK(properties);
std::string modalias = properties->modalias.value();
@@ -132,11 +132,14 @@ BluetoothDeviceChromeOS::BluetoothDeviceChromeOS(
ui_task_runner_(ui_task_runner),
socket_thread_(socket_thread),
weak_ptr_factory_(this) {
- DBusThreadManager::Get()->GetBluetoothGattServiceClient()->AddObserver(this);
+ bluez::BluezDBusManager::Get()->GetBluetoothGattServiceClient()->AddObserver(
+ this);
// Add all known GATT services.
const std::vector<dbus::ObjectPath> gatt_services =
- DBusThreadManager::Get()->GetBluetoothGattServiceClient()->GetServices();
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothGattServiceClient()
+ ->GetServices();
for (std::vector<dbus::ObjectPath>::const_iterator it = gatt_services.begin();
it != gatt_services.end(); ++it) {
GattServiceAdded(*it);
@@ -144,8 +147,9 @@ BluetoothDeviceChromeOS::BluetoothDeviceChromeOS(
}
BluetoothDeviceChromeOS::~BluetoothDeviceChromeOS() {
- DBusThreadManager::Get()->GetBluetoothGattServiceClient()->
- RemoveObserver(this);
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothGattServiceClient()
+ ->RemoveObserver(this);
// Copy the GATT services list here and clear the original so that when we
// send GattServiceRemoved(), GetGattServices() returns no services.
@@ -161,18 +165,18 @@ BluetoothDeviceChromeOS::~BluetoothDeviceChromeOS() {
}
uint32 BluetoothDeviceChromeOS::GetBluetoothClass() const {
- BluetoothDeviceClient::Properties* properties =
- DBusThreadManager::Get()->GetBluetoothDeviceClient()->
- GetProperties(object_path_);
+ bluez::BluetoothDeviceClient::Properties* properties =
+ bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
+ object_path_);
DCHECK(properties);
return properties->bluetooth_class.value();
}
std::string BluetoothDeviceChromeOS::GetDeviceName() const {
- BluetoothDeviceClient::Properties* properties =
- DBusThreadManager::Get()->GetBluetoothDeviceClient()->
- GetProperties(object_path_);
+ bluez::BluetoothDeviceClient::Properties* properties =
+ bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
+ object_path_);
DCHECK(properties);
return properties->alias.value();
@@ -191,9 +195,9 @@ void BluetoothDeviceChromeOS::DisconnectGatt() {
}
std::string BluetoothDeviceChromeOS::GetAddress() const {
- BluetoothDeviceClient::Properties* properties =
- DBusThreadManager::Get()->GetBluetoothDeviceClient()->
- GetProperties(object_path_);
+ bluez::BluetoothDeviceClient::Properties* properties =
+ bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
+ object_path_);
DCHECK(properties);
return CanonicalizeAddress(properties->address.value());
@@ -225,9 +229,9 @@ uint16 BluetoothDeviceChromeOS::GetDeviceID() const {
}
bool BluetoothDeviceChromeOS::IsPaired() const {
- BluetoothDeviceClient::Properties* properties =
- DBusThreadManager::Get()->GetBluetoothDeviceClient()->
- GetProperties(object_path_);
+ bluez::BluetoothDeviceClient::Properties* properties =
+ bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
+ object_path_);
DCHECK(properties);
// Trusted devices are devices that don't support pairing but that the
@@ -237,9 +241,9 @@ bool BluetoothDeviceChromeOS::IsPaired() const {
}
bool BluetoothDeviceChromeOS::IsConnected() const {
- BluetoothDeviceClient::Properties* properties =
- DBusThreadManager::Get()->GetBluetoothDeviceClient()->
- GetProperties(object_path_);
+ bluez::BluetoothDeviceClient::Properties* properties =
+ bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
+ object_path_);
DCHECK(properties);
return properties->connected.value();
@@ -251,9 +255,9 @@ bool BluetoothDeviceChromeOS::IsGattConnected() const {
}
bool BluetoothDeviceChromeOS::IsConnectable() const {
- BluetoothInputClient::Properties* input_properties =
- DBusThreadManager::Get()->GetBluetoothInputClient()->
- GetProperties(object_path_);
+ bluez::BluetoothInputClient::Properties* input_properties =
+ bluez::BluezDBusManager::Get()->GetBluetoothInputClient()->GetProperties(
+ object_path_);
// GetProperties returns NULL when the device does not implement the given
// interface. Non HID devices are normally connectable.
if (!input_properties)
@@ -267,9 +271,9 @@ bool BluetoothDeviceChromeOS::IsConnecting() const {
}
BluetoothDeviceChromeOS::UUIDList BluetoothDeviceChromeOS::GetUUIDs() const {
- BluetoothDeviceClient::Properties* properties =
- DBusThreadManager::Get()->GetBluetoothDeviceClient()->
- GetProperties(object_path_);
+ bluez::BluetoothDeviceClient::Properties* properties =
+ bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
+ object_path_);
DCHECK(properties);
std::vector<device::BluetoothUUID> uuids;
@@ -284,9 +288,9 @@ BluetoothDeviceChromeOS::UUIDList BluetoothDeviceChromeOS::GetUUIDs() const {
}
int16 BluetoothDeviceChromeOS::GetInquiryRSSI() const {
- BluetoothDeviceClient::Properties* properties =
- DBusThreadManager::Get()->GetBluetoothDeviceClient()->
- GetProperties(object_path_);
+ bluez::BluetoothDeviceClient::Properties* properties =
+ bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
+ object_path_);
DCHECK(properties);
if (!properties->rssi.is_valid())
@@ -296,9 +300,9 @@ int16 BluetoothDeviceChromeOS::GetInquiryRSSI() const {
}
int16 BluetoothDeviceChromeOS::GetInquiryTxPower() const {
- BluetoothDeviceClient::Properties* properties =
- DBusThreadManager::Get()->GetBluetoothDeviceClient()->
- GetProperties(object_path_);
+ bluez::BluetoothDeviceClient::Properties* properties =
+ bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
+ object_path_);
DCHECK(properties);
if (!properties->tx_power.is_valid())
@@ -323,7 +327,7 @@ void BluetoothDeviceChromeOS::GetConnectionInfo(
const ConnectionInfoCallback& callback) {
// DBus method call should gracefully return an error if the device is not
// currently connected.
- DBusThreadManager::Get()->GetBluetoothDeviceClient()->GetConnInfo(
+ bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetConnInfo(
object_path_, base::Bind(&BluetoothDeviceChromeOS::OnGetConnInfo,
weak_ptr_factory_.GetWeakPtr(), callback),
base::Bind(&BluetoothDeviceChromeOS::OnGetConnInfoError,
@@ -347,14 +351,12 @@ void BluetoothDeviceChromeOS::Connect(
// Initiate high-security connection with pairing.
BeginPairing(pairing_delegate);
- DBusThreadManager::Get()->GetBluetoothDeviceClient()->
- Pair(object_path_,
- base::Bind(&BluetoothDeviceChromeOS::OnPair,
- weak_ptr_factory_.GetWeakPtr(),
- callback, error_callback),
- base::Bind(&BluetoothDeviceChromeOS::OnPairError,
- weak_ptr_factory_.GetWeakPtr(),
- error_callback));
+ bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->Pair(
+ object_path_,
+ base::Bind(&BluetoothDeviceChromeOS::OnPair,
+ weak_ptr_factory_.GetWeakPtr(), callback, error_callback),
+ base::Bind(&BluetoothDeviceChromeOS::OnPairError,
+ weak_ptr_factory_.GetWeakPtr(), error_callback));
}
}
@@ -398,12 +400,10 @@ void BluetoothDeviceChromeOS::CancelPairing() {
if (!canceled) {
VLOG(1) << object_path_.value() << ": No pairing context or callback. "
<< "Sending explicit cancel";
- DBusThreadManager::Get()->GetBluetoothDeviceClient()->
- CancelPairing(
- object_path_,
- base::Bind(&base::DoNothing),
- base::Bind(&BluetoothDeviceChromeOS::OnCancelPairingError,
- weak_ptr_factory_.GetWeakPtr()));
+ bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->CancelPairing(
+ object_path_, base::Bind(&base::DoNothing),
+ base::Bind(&BluetoothDeviceChromeOS::OnCancelPairingError,
+ weak_ptr_factory_.GetWeakPtr()));
}
// Since there is no callback to this method it's possible that the pairing
@@ -416,20 +416,16 @@ void BluetoothDeviceChromeOS::CancelPairing() {
void BluetoothDeviceChromeOS::Disconnect(const base::Closure& callback,
const ErrorCallback& error_callback) {
VLOG(1) << object_path_.value() << ": Disconnecting";
- DBusThreadManager::Get()->GetBluetoothDeviceClient()->
- Disconnect(
- object_path_,
- base::Bind(&BluetoothDeviceChromeOS::OnDisconnect,
- weak_ptr_factory_.GetWeakPtr(),
- callback),
- base::Bind(&BluetoothDeviceChromeOS::OnDisconnectError,
- weak_ptr_factory_.GetWeakPtr(),
- error_callback));
+ bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->Disconnect(
+ object_path_, base::Bind(&BluetoothDeviceChromeOS::OnDisconnect,
+ weak_ptr_factory_.GetWeakPtr(), callback),
+ base::Bind(&BluetoothDeviceChromeOS::OnDisconnectError,
+ weak_ptr_factory_.GetWeakPtr(), error_callback));
}
void BluetoothDeviceChromeOS::Forget(const ErrorCallback& error_callback) {
VLOG(1) << object_path_.value() << ": Removing device";
- DBusThreadManager::Get()->GetBluetoothAdapterClient()->RemoveDevice(
+ bluez::BluezDBusManager::Get()->GetBluetoothAdapterClient()->RemoveDevice(
adapter()->object_path(), object_path_, base::Bind(&base::DoNothing),
base::Bind(&BluetoothDeviceChromeOS::OnForgetError,
weak_ptr_factory_.GetWeakPtr(), error_callback));
@@ -508,9 +504,10 @@ void BluetoothDeviceChromeOS::GattServiceAdded(
return;
}
- BluetoothGattServiceClient::Properties* properties =
- DBusThreadManager::Get()->GetBluetoothGattServiceClient()->
- GetProperties(object_path);
+ bluez::BluetoothGattServiceClient::Properties* properties =
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothGattServiceClient()
+ ->GetProperties(object_path);
DCHECK(properties);
if (properties->device.value() != object_path_) {
VLOG(2) << "Remote GATT service does not belong to this device.";
@@ -577,17 +574,13 @@ void BluetoothDeviceChromeOS::ConnectInternal(
const base::Closure& callback,
const ConnectErrorCallback& error_callback) {
VLOG(1) << object_path_.value() << ": Connecting";
- DBusThreadManager::Get()->GetBluetoothDeviceClient()->
- Connect(
- object_path_,
- base::Bind(&BluetoothDeviceChromeOS::OnConnect,
- weak_ptr_factory_.GetWeakPtr(),
- after_pairing,
- callback),
- base::Bind(&BluetoothDeviceChromeOS::OnConnectError,
- weak_ptr_factory_.GetWeakPtr(),
- after_pairing,
- error_callback));
+ bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->Connect(
+ object_path_,
+ base::Bind(&BluetoothDeviceChromeOS::OnConnect,
+ weak_ptr_factory_.GetWeakPtr(), after_pairing, callback),
+ base::Bind(&BluetoothDeviceChromeOS::OnConnectError,
+ weak_ptr_factory_.GetWeakPtr(), after_pairing,
+ error_callback));
}
void BluetoothDeviceChromeOS::OnConnect(bool after_pairing,
@@ -703,11 +696,11 @@ void BluetoothDeviceChromeOS::SetTrusted() {
// first; there's no harm in doing this and it solves any race conditions
// with the property becoming true or false and this call happening before
// we get the D-Bus signal about the earlier change.
- DBusThreadManager::Get()->GetBluetoothDeviceClient()->
- GetProperties(object_path_)->trusted.Set(
- true,
- base::Bind(&BluetoothDeviceChromeOS::OnSetTrusted,
- weak_ptr_factory_.GetWeakPtr()));
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothDeviceClient()
+ ->GetProperties(object_path_)
+ ->trusted.Set(true, base::Bind(&BluetoothDeviceChromeOS::OnSetTrusted,
+ weak_ptr_factory_.GetWeakPtr()));
}
void BluetoothDeviceChromeOS::OnSetTrusted(bool success) {
diff --git a/device/bluetooth/bluetooth_device_chromeos.h b/device/bluetooth/bluetooth_device_chromeos.h
index ad300c7..92428ac 100644
--- a/device/bluetooth/bluetooth_device_chromeos.h
+++ b/device/bluetooth/bluetooth_device_chromeos.h
@@ -11,11 +11,11 @@
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/sequenced_task_runner.h"
-#include "chromeos/dbus/bluetooth_device_client.h"
-#include "chromeos/dbus/bluetooth_gatt_service_client.h"
#include "dbus/object_path.h"
#include "device/bluetooth/bluetooth_device.h"
#include "device/bluetooth/bluetooth_export.h"
+#include "device/bluetooth/dbus/bluetooth_device_client.h"
+#include "device/bluetooth/dbus/bluetooth_gatt_service_client.h"
namespace device {
class BluetoothSocketThread;
@@ -35,7 +35,7 @@ class BluetoothPairingChromeOS;
// thread.
class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceChromeOS
: public device::BluetoothDevice,
- public BluetoothGattServiceClient::Observer {
+ public bluez::BluetoothGattServiceClient::Observer {
public:
// BluetoothDevice override
uint32 GetBluetoothClass() const override;
@@ -115,7 +115,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceChromeOS
scoped_refptr<device::BluetoothSocketThread> socket_thread);
~BluetoothDeviceChromeOS() override;
- // BluetoothGattServiceClient::Observer overrides.
+ // bluez::BluetoothGattServiceClient::Observer overrides.
void GattServiceAdded(const dbus::ObjectPath& object_path) override;
void GattServiceRemoved(const dbus::ObjectPath& object_path) override;
diff --git a/device/bluetooth/bluetooth_gatt_chromeos_unittest.cc b/device/bluetooth/bluetooth_gatt_chromeos_unittest.cc
index c81acea..cc5860d 100644
--- a/device/bluetooth/bluetooth_gatt_chromeos_unittest.cc
+++ b/device/bluetooth/bluetooth_gatt_chromeos_unittest.cc
@@ -5,14 +5,6 @@
#include "base/memory/scoped_vector.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/fake_bluetooth_adapter_client.h"
-#include "chromeos/dbus/fake_bluetooth_agent_manager_client.h"
-#include "chromeos/dbus/fake_bluetooth_device_client.h"
-#include "chromeos/dbus/fake_bluetooth_gatt_characteristic_client.h"
-#include "chromeos/dbus/fake_bluetooth_gatt_descriptor_client.h"
-#include "chromeos/dbus/fake_bluetooth_gatt_service_client.h"
-#include "chromeos/dbus/fake_bluetooth_input_client.h"
#include "dbus/object_path.h"
#include "device/bluetooth/bluetooth_adapter.h"
#include "device/bluetooth/bluetooth_adapter_factory.h"
@@ -23,6 +15,14 @@
#include "device/bluetooth/bluetooth_gatt_notify_session.h"
#include "device/bluetooth/bluetooth_gatt_service.h"
#include "device/bluetooth/bluetooth_uuid.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
+#include "device/bluetooth/dbus/fake_bluetooth_adapter_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_agent_manager_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_device_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_gatt_service_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_input_client.h"
#include "device/bluetooth/test/test_bluetooth_adapter_observer.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -41,11 +41,11 @@ namespace chromeos {
namespace {
const BluetoothUUID kHeartRateMeasurementUUID(
- FakeBluetoothGattCharacteristicClient::kHeartRateMeasurementUUID);
+ bluez::FakeBluetoothGattCharacteristicClient::kHeartRateMeasurementUUID);
const BluetoothUUID kBodySensorLocationUUID(
- FakeBluetoothGattCharacteristicClient::kBodySensorLocationUUID);
+ bluez::FakeBluetoothGattCharacteristicClient::kBodySensorLocationUUID);
const BluetoothUUID kHeartRateControlPointUUID(
- FakeBluetoothGattCharacteristicClient::kHeartRateControlPointUUID);
+ bluez::FakeBluetoothGattCharacteristicClient::kHeartRateControlPointUUID);
// Compares GATT characteristic/descriptor values. Returns true, if the values
// are equal.
@@ -70,34 +70,36 @@ class BluetoothGattChromeOSTest : public testing::Test {
}
void SetUp() override {
- scoped_ptr<DBusThreadManagerSetter> dbus_setter =
- chromeos::DBusThreadManager::GetSetterForTesting();
- fake_bluetooth_device_client_ = new FakeBluetoothDeviceClient;
+ scoped_ptr<bluez::BluezDBusManagerSetter> dbus_setter =
+ bluez::BluezDBusManager::GetSetterForTesting();
+ fake_bluetooth_device_client_ = new bluez::FakeBluetoothDeviceClient;
fake_bluetooth_gatt_service_client_ =
- new FakeBluetoothGattServiceClient;
+ new bluez::FakeBluetoothGattServiceClient;
fake_bluetooth_gatt_characteristic_client_ =
- new FakeBluetoothGattCharacteristicClient;
+ new bluez::FakeBluetoothGattCharacteristicClient;
fake_bluetooth_gatt_descriptor_client_ =
- new FakeBluetoothGattDescriptorClient;
+ new bluez::FakeBluetoothGattDescriptorClient;
dbus_setter->SetBluetoothDeviceClient(
- scoped_ptr<BluetoothDeviceClient>(
+ scoped_ptr<bluez::BluetoothDeviceClient>(
fake_bluetooth_device_client_));
dbus_setter->SetBluetoothGattServiceClient(
- scoped_ptr<BluetoothGattServiceClient>(
+ scoped_ptr<bluez::BluetoothGattServiceClient>(
fake_bluetooth_gatt_service_client_));
dbus_setter->SetBluetoothGattCharacteristicClient(
- scoped_ptr<BluetoothGattCharacteristicClient>(
+ scoped_ptr<bluez::BluetoothGattCharacteristicClient>(
fake_bluetooth_gatt_characteristic_client_));
dbus_setter->SetBluetoothGattDescriptorClient(
- scoped_ptr<BluetoothGattDescriptorClient>(
+ scoped_ptr<bluez::BluetoothGattDescriptorClient>(
fake_bluetooth_gatt_descriptor_client_));
dbus_setter->SetBluetoothAdapterClient(
- scoped_ptr<BluetoothAdapterClient>(new FakeBluetoothAdapterClient));
+ scoped_ptr<bluez::BluetoothAdapterClient>(
+ new bluez::FakeBluetoothAdapterClient));
dbus_setter->SetBluetoothInputClient(
- scoped_ptr<BluetoothInputClient>(new FakeBluetoothInputClient));
+ scoped_ptr<bluez::BluetoothInputClient>(
+ new bluez::FakeBluetoothInputClient));
dbus_setter->SetBluetoothAgentManagerClient(
- scoped_ptr<BluetoothAgentManagerClient>(
- new FakeBluetoothAgentManagerClient));
+ scoped_ptr<bluez::BluetoothAgentManagerClient>(
+ new bluez::FakeBluetoothAgentManagerClient));
GetAdapter();
@@ -112,7 +114,7 @@ class BluetoothGattChromeOSTest : public testing::Test {
adapter_ = NULL;
update_sessions_.clear();
gatt_conn_.reset();
- DBusThreadManager::Shutdown();
+ bluez::BluezDBusManager::Shutdown();
}
void GetAdapter() {
@@ -175,11 +177,12 @@ class BluetoothGattChromeOSTest : public testing::Test {
base::MessageLoop message_loop_;
- FakeBluetoothDeviceClient* fake_bluetooth_device_client_;
- FakeBluetoothGattServiceClient* fake_bluetooth_gatt_service_client_;
- FakeBluetoothGattCharacteristicClient*
+ bluez::FakeBluetoothDeviceClient* fake_bluetooth_device_client_;
+ bluez::FakeBluetoothGattServiceClient* fake_bluetooth_gatt_service_client_;
+ bluez::FakeBluetoothGattCharacteristicClient*
fake_bluetooth_gatt_characteristic_client_;
- FakeBluetoothGattDescriptorClient* fake_bluetooth_gatt_descriptor_client_;
+ bluez::FakeBluetoothGattDescriptorClient*
+ fake_bluetooth_gatt_descriptor_client_;
scoped_ptr<device::BluetoothGattConnection> gatt_conn_;
ScopedVector<BluetoothGattNotifySession> update_sessions_;
scoped_refptr<BluetoothAdapter> adapter_;
@@ -192,10 +195,10 @@ class BluetoothGattChromeOSTest : public testing::Test {
TEST_F(BluetoothGattChromeOSTest, GattConnection) {
fake_bluetooth_device_client_->CreateDevice(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
- dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
- BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kLowEnergyAddress);
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
+ BluetoothDevice* device =
+ adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress);
ASSERT_TRUE(device);
ASSERT_FALSE(device->IsConnected());
ASSERT_FALSE(gatt_conn_.get());
@@ -213,7 +216,7 @@ TEST_F(BluetoothGattChromeOSTest, GattConnection) {
EXPECT_TRUE(device->IsConnected());
ASSERT_TRUE(gatt_conn_.get());
EXPECT_TRUE(gatt_conn_->IsConnected());
- EXPECT_EQ(FakeBluetoothDeviceClient::kLowEnergyAddress,
+ EXPECT_EQ(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress,
gatt_conn_->GetDeviceAddress());
gatt_conn_->Disconnect();
@@ -255,8 +258,8 @@ TEST_F(BluetoothGattChromeOSTest, GattConnection) {
EXPECT_TRUE(gatt_conn_->IsConnected());
fake_bluetooth_device_client_->RemoveDevice(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
- dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
ASSERT_TRUE(gatt_conn_.get());
EXPECT_FALSE(gatt_conn_->IsConnected());
}
@@ -265,10 +268,10 @@ TEST_F(BluetoothGattChromeOSTest, GattServiceAddedAndRemoved) {
// Create a fake LE device. We store the device pointer here because this is a
// test. It's unsafe to do this in production as the device might get deleted.
fake_bluetooth_device_client_->CreateDevice(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
- dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
- BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kLowEnergyAddress);
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
+ BluetoothDevice* device =
+ adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress);
ASSERT_TRUE(device);
TestBluetoothAdapterObserver observer(adapter_);
@@ -281,14 +284,14 @@ TEST_F(BluetoothGattChromeOSTest, GattServiceAddedAndRemoved) {
// Expose the fake Heart Rate Service.
fake_bluetooth_gatt_service_client_->ExposeHeartRateService(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
EXPECT_EQ(1, observer.gatt_service_added_count());
EXPECT_EQ(0, observer.gatt_service_removed_count());
EXPECT_FALSE(observer.last_gatt_service_id().empty());
EXPECT_EQ(1U, device->GetGattServices().size());
- EXPECT_EQ(
- BluetoothUUID(FakeBluetoothGattServiceClient::kHeartRateServiceUUID),
- observer.last_gatt_service_uuid());
+ EXPECT_EQ(BluetoothUUID(
+ bluez::FakeBluetoothGattServiceClient::kHeartRateServiceUUID),
+ observer.last_gatt_service_uuid());
BluetoothGattService* service =
device->GetGattService(observer.last_gatt_service_id());
@@ -308,9 +311,9 @@ TEST_F(BluetoothGattChromeOSTest, GattServiceAddedAndRemoved) {
EXPECT_EQ(1, observer.gatt_service_removed_count());
EXPECT_FALSE(observer.last_gatt_service_id().empty());
EXPECT_TRUE(device->GetGattServices().empty());
- EXPECT_EQ(
- BluetoothUUID(FakeBluetoothGattServiceClient::kHeartRateServiceUUID),
- observer.last_gatt_service_uuid());
+ EXPECT_EQ(BluetoothUUID(
+ bluez::FakeBluetoothGattServiceClient::kHeartRateServiceUUID),
+ observer.last_gatt_service_uuid());
EXPECT_EQ(NULL, device->GetGattService(observer.last_gatt_service_id()));
@@ -318,14 +321,14 @@ TEST_F(BluetoothGattChromeOSTest, GattServiceAddedAndRemoved) {
observer.last_gatt_service_uuid() = BluetoothUUID();
observer.last_gatt_service_id().clear();
fake_bluetooth_gatt_service_client_->ExposeHeartRateService(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
EXPECT_EQ(2, observer.gatt_service_added_count());
EXPECT_EQ(1, observer.gatt_service_removed_count());
EXPECT_FALSE(observer.last_gatt_service_id().empty());
EXPECT_EQ(1U, device->GetGattServices().size());
- EXPECT_EQ(
- BluetoothUUID(FakeBluetoothGattServiceClient::kHeartRateServiceUUID),
- observer.last_gatt_service_uuid());
+ EXPECT_EQ(BluetoothUUID(
+ bluez::FakeBluetoothGattServiceClient::kHeartRateServiceUUID),
+ observer.last_gatt_service_uuid());
// The object |service| points to should have been deallocated. |device|
// should contain a brand new instance.
@@ -341,25 +344,25 @@ TEST_F(BluetoothGattChromeOSTest, GattServiceAddedAndRemoved) {
observer.last_gatt_service_uuid() = BluetoothUUID();
observer.last_gatt_service_id().clear();
fake_bluetooth_device_client_->RemoveDevice(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
- dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
EXPECT_EQ(2, observer.gatt_service_added_count());
EXPECT_EQ(2, observer.gatt_service_removed_count());
EXPECT_FALSE(observer.last_gatt_service_id().empty());
- EXPECT_EQ(
- BluetoothUUID(FakeBluetoothGattServiceClient::kHeartRateServiceUUID),
- observer.last_gatt_service_uuid());
- EXPECT_EQ(
- NULL, adapter_->GetDevice(FakeBluetoothDeviceClient::kLowEnergyAddress));
+ EXPECT_EQ(BluetoothUUID(
+ bluez::FakeBluetoothGattServiceClient::kHeartRateServiceUUID),
+ observer.last_gatt_service_uuid());
+ EXPECT_EQ(NULL, adapter_->GetDevice(
+ bluez::FakeBluetoothDeviceClient::kLowEnergyAddress));
}
TEST_F(BluetoothGattChromeOSTest, GattCharacteristicAddedAndRemoved) {
fake_bluetooth_device_client_->CreateDevice(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
- dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
- BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kLowEnergyAddress);
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
+ BluetoothDevice* device =
+ adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress);
ASSERT_TRUE(device);
TestBluetoothAdapterObserver observer(adapter_);
@@ -367,7 +370,7 @@ TEST_F(BluetoothGattChromeOSTest, GattCharacteristicAddedAndRemoved) {
// Expose the fake Heart Rate service. This will asynchronously expose
// characteristics.
fake_bluetooth_gatt_service_client_->ExposeHeartRateService(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
ASSERT_EQ(1, observer.gatt_service_added_count());
BluetoothGattService* service =
@@ -424,10 +427,10 @@ TEST_F(BluetoothGattChromeOSTest, GattCharacteristicAddedAndRemoved) {
TEST_F(BluetoothGattChromeOSTest, GattDescriptorAddedAndRemoved) {
fake_bluetooth_device_client_->CreateDevice(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
- dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
- BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kLowEnergyAddress);
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
+ BluetoothDevice* device =
+ adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress);
ASSERT_TRUE(device);
TestBluetoothAdapterObserver observer(adapter_);
@@ -435,7 +438,7 @@ TEST_F(BluetoothGattChromeOSTest, GattDescriptorAddedAndRemoved) {
// Expose the fake Heart Rate service. This will asynchronously expose
// characteristics.
fake_bluetooth_gatt_service_client_->ExposeHeartRateService(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
ASSERT_EQ(1, observer.gatt_service_added_count());
BluetoothGattService* service =
@@ -496,7 +499,7 @@ TEST_F(BluetoothGattChromeOSTest, GattDescriptorAddedAndRemoved) {
observer.last_gatt_descriptor_uuid() = BluetoothUUID();
fake_bluetooth_gatt_descriptor_client_->ExposeDescriptor(
dbus::ObjectPath(characteristic->GetIdentifier()),
- FakeBluetoothGattDescriptorClient::
+ bluez::FakeBluetoothGattDescriptorClient::
kClientCharacteristicConfigurationUUID);
EXPECT_EQ(0, observer.gatt_service_changed_count());
EXPECT_EQ(1U, characteristic->GetDescriptors().size());
@@ -520,10 +523,10 @@ TEST_F(BluetoothGattChromeOSTest, AdapterAddedAfterGattService) {
// Create the fake D-Bus objects.
fake_bluetooth_device_client_->CreateDevice(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
- dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
fake_bluetooth_gatt_service_client_->ExposeHeartRateService(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
while (!fake_bluetooth_gatt_characteristic_client_->IsHeartRateVisible())
base::RunLoop().RunUntilIdle();
ASSERT_TRUE(fake_bluetooth_gatt_service_client_->IsHeartRateVisible());
@@ -531,8 +534,8 @@ TEST_F(BluetoothGattChromeOSTest, AdapterAddedAfterGattService) {
// Create the adapter. This should create all the GATT objects.
GetAdapter();
- BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kLowEnergyAddress);
+ BluetoothDevice* device =
+ adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress);
ASSERT_TRUE(device);
EXPECT_EQ(1U, device->GetGattServices().size());
@@ -540,9 +543,9 @@ TEST_F(BluetoothGattChromeOSTest, AdapterAddedAfterGattService) {
ASSERT_TRUE(service);
EXPECT_FALSE(service->IsLocal());
EXPECT_TRUE(service->IsPrimary());
- EXPECT_EQ(
- BluetoothUUID(FakeBluetoothGattServiceClient::kHeartRateServiceUUID),
- service->GetUUID());
+ EXPECT_EQ(BluetoothUUID(
+ bluez::FakeBluetoothGattServiceClient::kHeartRateServiceUUID),
+ service->GetUUID());
EXPECT_EQ(service, device->GetGattServices()[0]);
EXPECT_EQ(service, device->GetGattService(service->GetIdentifier()));
EXPECT_FALSE(service->IsLocal());
@@ -552,10 +555,9 @@ TEST_F(BluetoothGattChromeOSTest, AdapterAddedAfterGattService) {
fake_bluetooth_gatt_characteristic_client_->
GetBodySensorLocationPath().value());
ASSERT_TRUE(characteristic);
- EXPECT_EQ(
- BluetoothUUID(FakeBluetoothGattCharacteristicClient::
- kBodySensorLocationUUID),
- characteristic->GetUUID());
+ EXPECT_EQ(BluetoothUUID(bluez::FakeBluetoothGattCharacteristicClient::
+ kBodySensorLocationUUID),
+ characteristic->GetUUID());
EXPECT_FALSE(characteristic->IsLocal());
EXPECT_TRUE(characteristic->GetDescriptors().empty());
@@ -563,10 +565,9 @@ TEST_F(BluetoothGattChromeOSTest, AdapterAddedAfterGattService) {
fake_bluetooth_gatt_characteristic_client_->
GetHeartRateControlPointPath().value());
ASSERT_TRUE(characteristic);
- EXPECT_EQ(
- BluetoothUUID(FakeBluetoothGattCharacteristicClient::
- kHeartRateControlPointUUID),
- characteristic->GetUUID());
+ EXPECT_EQ(BluetoothUUID(bluez::FakeBluetoothGattCharacteristicClient::
+ kHeartRateControlPointUUID),
+ characteristic->GetUUID());
EXPECT_FALSE(characteristic->IsLocal());
EXPECT_TRUE(characteristic->GetDescriptors().empty());
@@ -574,10 +575,9 @@ TEST_F(BluetoothGattChromeOSTest, AdapterAddedAfterGattService) {
fake_bluetooth_gatt_characteristic_client_->
GetHeartRateMeasurementPath().value());
ASSERT_TRUE(characteristic);
- EXPECT_EQ(
- BluetoothUUID(FakeBluetoothGattCharacteristicClient::
- kHeartRateMeasurementUUID),
- characteristic->GetUUID());
+ EXPECT_EQ(BluetoothUUID(bluez::FakeBluetoothGattCharacteristicClient::
+ kHeartRateMeasurementUUID),
+ characteristic->GetUUID());
EXPECT_FALSE(characteristic->IsLocal());
EXPECT_EQ(1U, characteristic->GetDescriptors().size());
@@ -590,10 +590,10 @@ TEST_F(BluetoothGattChromeOSTest, AdapterAddedAfterGattService) {
TEST_F(BluetoothGattChromeOSTest, GattCharacteristicValue) {
fake_bluetooth_device_client_->CreateDevice(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
- dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
- BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kLowEnergyAddress);
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
+ BluetoothDevice* device =
+ adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress);
ASSERT_TRUE(device);
TestBluetoothAdapterObserver observer(adapter_);
@@ -601,7 +601,7 @@ TEST_F(BluetoothGattChromeOSTest, GattCharacteristicValue) {
// Expose the fake Heart Rate service. This will asynchronously expose
// characteristics.
fake_bluetooth_gatt_service_client_->ExposeHeartRateService(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
ASSERT_EQ(1, observer.gatt_service_added_count());
BluetoothGattService* service =
@@ -805,10 +805,10 @@ TEST_F(BluetoothGattChromeOSTest, GattCharacteristicValue) {
TEST_F(BluetoothGattChromeOSTest, GattCharacteristicProperties) {
fake_bluetooth_device_client_->CreateDevice(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
- dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
- BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kLowEnergyAddress);
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
+ BluetoothDevice* device =
+ adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress);
ASSERT_TRUE(device);
TestBluetoothAdapterObserver observer(adapter_);
@@ -816,7 +816,7 @@ TEST_F(BluetoothGattChromeOSTest, GattCharacteristicProperties) {
// Expose the fake Heart Rate service. This will asynchronously expose
// characteristics.
fake_bluetooth_gatt_service_client_->ExposeHeartRateService(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
BluetoothGattService* service =
device->GetGattService(observer.last_gatt_service_id());
@@ -847,10 +847,10 @@ TEST_F(BluetoothGattChromeOSTest, GattCharacteristicProperties) {
TEST_F(BluetoothGattChromeOSTest, GattDescriptorValue) {
fake_bluetooth_device_client_->CreateDevice(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
- dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
- BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kLowEnergyAddress);
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
+ BluetoothDevice* device =
+ adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress);
ASSERT_TRUE(device);
TestBluetoothAdapterObserver observer(adapter_);
@@ -858,7 +858,7 @@ TEST_F(BluetoothGattChromeOSTest, GattDescriptorValue) {
// Expose the fake Heart Rate service. This will asynchronously expose
// characteristics.
fake_bluetooth_gatt_service_client_->ExposeHeartRateService(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
ASSERT_EQ(1, observer.gatt_service_added_count());
BluetoothGattService* service =
@@ -970,10 +970,10 @@ TEST_F(BluetoothGattChromeOSTest, GattDescriptorValue) {
TEST_F(BluetoothGattChromeOSTest, NotifySessions) {
fake_bluetooth_device_client_->CreateDevice(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
- dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
BluetoothDevice* device =
- adapter_->GetDevice(FakeBluetoothDeviceClient::kLowEnergyAddress);
+ adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress);
ASSERT_TRUE(device);
TestBluetoothAdapterObserver observer(adapter_);
@@ -981,7 +981,7 @@ TEST_F(BluetoothGattChromeOSTest, NotifySessions) {
// Expose the fake Heart Rate service. This will asynchronously expose
// characteristics.
fake_bluetooth_gatt_service_client_->ExposeHeartRateService(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
ASSERT_EQ(1, observer.gatt_service_added_count());
BluetoothGattService* service =
@@ -1119,10 +1119,10 @@ TEST_F(BluetoothGattChromeOSTest, NotifySessions) {
TEST_F(BluetoothGattChromeOSTest, NotifySessionsMadeInactive) {
fake_bluetooth_device_client_->CreateDevice(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
- dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
BluetoothDevice* device =
- adapter_->GetDevice(FakeBluetoothDeviceClient::kLowEnergyAddress);
+ adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress);
ASSERT_TRUE(device);
TestBluetoothAdapterObserver observer(adapter_);
@@ -1130,7 +1130,7 @@ TEST_F(BluetoothGattChromeOSTest, NotifySessionsMadeInactive) {
// Expose the fake Heart Rate service. This will asynchronously expose
// characteristics.
fake_bluetooth_gatt_service_client_->ExposeHeartRateService(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
ASSERT_EQ(1, observer.gatt_service_added_count());
BluetoothGattService* service =
diff --git a/device/bluetooth/bluetooth_gatt_connection_chromeos.cc b/device/bluetooth/bluetooth_gatt_connection_chromeos.cc
index 0c46619..57aaa4d 100644
--- a/device/bluetooth/bluetooth_gatt_connection_chromeos.cc
+++ b/device/bluetooth/bluetooth_gatt_connection_chromeos.cc
@@ -6,9 +6,9 @@
#include "base/bind.h"
#include "base/logging.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
#include "device/bluetooth/bluetooth_adapter.h"
#include "device/bluetooth/bluetooth_device.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
namespace chromeos {
@@ -23,11 +23,12 @@ BluetoothGattConnectionChromeOS::BluetoothGattConnectionChromeOS(
DCHECK(!device_address_.empty());
DCHECK(object_path_.IsValid());
- DBusThreadManager::Get()->GetBluetoothDeviceClient()->AddObserver(this);
+ bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->AddObserver(this);
}
BluetoothGattConnectionChromeOS::~BluetoothGattConnectionChromeOS() {
- DBusThreadManager::Get()->GetBluetoothDeviceClient()->RemoveObserver(this);
+ bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->RemoveObserver(
+ this);
Disconnect();
}
@@ -40,9 +41,9 @@ bool BluetoothGattConnectionChromeOS::IsConnected() {
if (!connected_)
return false;
- BluetoothDeviceClient::Properties* properties =
- DBusThreadManager::Get()->GetBluetoothDeviceClient()->
- GetProperties(object_path_);
+ bluez::BluetoothDeviceClient::Properties* properties =
+ bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
+ object_path_);
if (!properties || !properties->connected.value())
connected_ = false;
@@ -82,9 +83,9 @@ void BluetoothGattConnectionChromeOS::DevicePropertyChanged(
if (!connected_)
return;
- BluetoothDeviceClient::Properties* properties =
- DBusThreadManager::Get()->GetBluetoothDeviceClient()->
- GetProperties(object_path_);
+ bluez::BluetoothDeviceClient::Properties* properties =
+ bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
+ object_path_);
if (!properties) {
connected_ = false;
diff --git a/device/bluetooth/bluetooth_gatt_connection_chromeos.h b/device/bluetooth/bluetooth_gatt_connection_chromeos.h
index 2727a23..6e40283 100644
--- a/device/bluetooth/bluetooth_gatt_connection_chromeos.h
+++ b/device/bluetooth/bluetooth_gatt_connection_chromeos.h
@@ -9,9 +9,9 @@
#include "base/callback.h"
#include "base/memory/weak_ptr.h"
-#include "chromeos/dbus/bluetooth_device_client.h"
#include "dbus/object_path.h"
#include "device/bluetooth/bluetooth_gatt_connection.h"
+#include "device/bluetooth/dbus/bluetooth_device_client.h"
namespace device {
@@ -25,7 +25,7 @@ namespace chromeos {
// Chrome OS platform.
class BluetoothGattConnectionChromeOS
: public device::BluetoothGattConnection,
- public BluetoothDeviceClient::Observer {
+ public bluez::BluetoothDeviceClient::Observer {
public:
explicit BluetoothGattConnectionChromeOS(
scoped_refptr<device::BluetoothAdapter> adapter,
@@ -38,8 +38,7 @@ class BluetoothGattConnectionChromeOS
void Disconnect() override;
private:
-
- // chromeos::BluetoothDeviceClient::Observer overrides.
+ // bluez::Bluetooth$1Client::Observer overrides.
void DeviceRemoved(const dbus::ObjectPath& object_path) override;
void DevicePropertyChanged(const dbus::ObjectPath& object_path,
const std::string& property_name) override;
diff --git a/device/bluetooth/bluetooth_gatt_notify_session_chromeos.cc b/device/bluetooth/bluetooth_gatt_notify_session_chromeos.cc
index ba7b843..02f7ed8 100644
--- a/device/bluetooth/bluetooth_gatt_notify_session_chromeos.cc
+++ b/device/bluetooth/bluetooth_gatt_notify_session_chromeos.cc
@@ -6,11 +6,11 @@
#include "base/bind.h"
#include "base/logging.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
#include "device/bluetooth/bluetooth_adapter.h"
#include "device/bluetooth/bluetooth_device.h"
#include "device/bluetooth/bluetooth_gatt_service.h"
#include "device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
namespace chromeos {
@@ -32,12 +32,13 @@ BluetoothGattNotifySessionChromeOS::BluetoothGattNotifySessionChromeOS(
DCHECK(!characteristic_id_.empty());
DCHECK(object_path_.IsValid());
- DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient()->AddObserver(
- this);
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothGattCharacteristicClient()
+ ->AddObserver(this);
}
BluetoothGattNotifySessionChromeOS::~BluetoothGattNotifySessionChromeOS() {
- DBusThreadManager::Get()
+ bluez::BluezDBusManager::Get()
->GetBluetoothGattCharacteristicClient()
->RemoveObserver(this);
Stop(base::Bind(&base::DoNothing));
@@ -58,11 +59,12 @@ bool BluetoothGattNotifySessionChromeOS::IsActive() {
// actually active, since the characteristic might have stopped sending
// notifications yet this method was called before we processed the
// observer event (e.g. because somebody else called this method in their
- // BluetoothGattCharacteristicClient::Observer implementation, which was
+ // bluez::BluetoothGattCharacteristicClient::Observer implementation, which
+ // was
// called before ours). Check the client to see if notifications are still
// being sent.
- BluetoothGattCharacteristicClient::Properties* properties =
- DBusThreadManager::Get()
+ bluez::BluetoothGattCharacteristicClient::Properties* properties =
+ bluez::BluezDBusManager::Get()
->GetBluetoothGattCharacteristicClient()
->GetProperties(object_path_);
if (!properties || !properties->notifying.value())
@@ -115,8 +117,8 @@ void BluetoothGattNotifySessionChromeOS::GattCharacteristicPropertyChanged(
if (!active_)
return;
- BluetoothGattCharacteristicClient::Properties* properties =
- DBusThreadManager::Get()
+ bluez::BluetoothGattCharacteristicClient::Properties* properties =
+ bluez::BluezDBusManager::Get()
->GetBluetoothGattCharacteristicClient()
->GetProperties(object_path_);
if (!properties) {
diff --git a/device/bluetooth/bluetooth_gatt_notify_session_chromeos.h b/device/bluetooth/bluetooth_gatt_notify_session_chromeos.h
index 245a72f..ef6e8da 100644
--- a/device/bluetooth/bluetooth_gatt_notify_session_chromeos.h
+++ b/device/bluetooth/bluetooth_gatt_notify_session_chromeos.h
@@ -8,8 +8,8 @@
#include <string>
#include "base/callback.h"
-#include "chromeos/dbus/bluetooth_gatt_characteristic_client.h"
#include "device/bluetooth/bluetooth_gatt_notify_session.h"
+#include "device/bluetooth/dbus/bluetooth_gatt_characteristic_client.h"
namespace device {
@@ -25,7 +25,7 @@ class BluetoothRemoteGattCharacteristicChromeOS;
// BluetoothGattNotifySession for the Chrome OS platform.
class BluetoothGattNotifySessionChromeOS
: public device::BluetoothGattNotifySession,
- public BluetoothGattCharacteristicClient::Observer {
+ public bluez::BluetoothGattCharacteristicClient::Observer {
public:
~BluetoothGattNotifySessionChromeOS() override;
@@ -44,7 +44,7 @@ class BluetoothGattNotifySessionChromeOS
const std::string& characteristic_identifier,
const dbus::ObjectPath& characteristic_path);
- // BluetoothGattCharacteristicClient::Observer overrides.
+ // bluez::BluetoothGattCharacteristicClient::Observer overrides.
void GattCharacteristicRemoved(const dbus::ObjectPath& object_path) override;
void GattCharacteristicPropertyChanged(
const dbus::ObjectPath& object_path,
diff --git a/device/bluetooth/bluetooth_pairing_chromeos.cc b/device/bluetooth/bluetooth_pairing_chromeos.cc
index dc73f6d..c69bc94 100644
--- a/device/bluetooth/bluetooth_pairing_chromeos.cc
+++ b/device/bluetooth/bluetooth_pairing_chromeos.cc
@@ -56,24 +56,25 @@ BluetoothPairingChromeOS::~BluetoothPairingChromeOS() {
if (!pincode_callback_.is_null()) {
pincode_callback_.Run(
- BluetoothAgentServiceProvider::Delegate::CANCELLED, "");
+ bluez::BluetoothAgentServiceProvider::Delegate::CANCELLED, "");
}
if (!passkey_callback_.is_null()) {
passkey_callback_.Run(
- BluetoothAgentServiceProvider::Delegate::CANCELLED, 0);
+ bluez::BluetoothAgentServiceProvider::Delegate::CANCELLED, 0);
}
if (!confirmation_callback_.is_null()) {
confirmation_callback_.Run(
- BluetoothAgentServiceProvider::Delegate::CANCELLED);
+ bluez::BluetoothAgentServiceProvider::Delegate::CANCELLED);
}
pairing_delegate_ = NULL;
}
void BluetoothPairingChromeOS::RequestPinCode(
- const BluetoothAgentServiceProvider::Delegate::PinCodeCallback& callback) {
+ const bluez::BluetoothAgentServiceProvider::Delegate::PinCodeCallback&
+ callback) {
UMA_HISTOGRAM_ENUMERATION("Bluetooth.PairingMethod",
UMA_PAIRING_METHOD_REQUEST_PINCODE,
UMA_PAIRING_METHOD_COUNT);
@@ -92,7 +93,7 @@ void BluetoothPairingChromeOS::SetPinCode(const std::string& pincode) {
if (pincode_callback_.is_null())
return;
- pincode_callback_.Run(BluetoothAgentServiceProvider::Delegate::SUCCESS,
+ pincode_callback_.Run(bluez::BluetoothAgentServiceProvider::Delegate::SUCCESS,
pincode);
pincode_callback_.Reset();
@@ -120,7 +121,8 @@ void BluetoothPairingChromeOS::DisplayPinCode(const std::string& pincode) {
}
void BluetoothPairingChromeOS::RequestPasskey(
- const BluetoothAgentServiceProvider::Delegate::PasskeyCallback& callback) {
+ const bluez::BluetoothAgentServiceProvider::Delegate::PasskeyCallback&
+ callback) {
UMA_HISTOGRAM_ENUMERATION("Bluetooth.PairingMethod",
UMA_PAIRING_METHOD_REQUEST_PASSKEY,
UMA_PAIRING_METHOD_COUNT);
@@ -139,7 +141,7 @@ void BluetoothPairingChromeOS::SetPasskey(uint32 passkey) {
if (passkey_callback_.is_null())
return;
- passkey_callback_.Run(BluetoothAgentServiceProvider::Delegate::SUCCESS,
+ passkey_callback_.Run(bluez::BluetoothAgentServiceProvider::Delegate::SUCCESS,
passkey);
passkey_callback_.Reset();
@@ -174,7 +176,7 @@ void BluetoothPairingChromeOS::KeysEntered(uint16 entered) {
void BluetoothPairingChromeOS::RequestConfirmation(
uint32 passkey,
- const BluetoothAgentServiceProvider::Delegate::ConfirmationCallback&
+ const bluez::BluetoothAgentServiceProvider::Delegate::ConfirmationCallback&
callback) {
UMA_HISTOGRAM_ENUMERATION("Bluetooth.PairingMethod",
UMA_PAIRING_METHOD_CONFIRM_PASSKEY,
@@ -187,7 +189,7 @@ void BluetoothPairingChromeOS::RequestConfirmation(
}
void BluetoothPairingChromeOS::RequestAuthorization(
- const BluetoothAgentServiceProvider::Delegate::ConfirmationCallback&
+ const bluez::BluetoothAgentServiceProvider::Delegate::ConfirmationCallback&
callback) {
UMA_HISTOGRAM_ENUMERATION("Bluetooth.PairingMethod",
UMA_PAIRING_METHOD_NONE,
@@ -207,7 +209,8 @@ void BluetoothPairingChromeOS::ConfirmPairing() {
if (confirmation_callback_.is_null())
return;
- confirmation_callback_.Run(BluetoothAgentServiceProvider::Delegate::SUCCESS);
+ confirmation_callback_.Run(
+ bluez::BluetoothAgentServiceProvider::Delegate::SUCCESS);
confirmation_callback_.Reset();
// If this is not an outgoing connection to the device, clean up the pairing
@@ -219,12 +222,12 @@ void BluetoothPairingChromeOS::ConfirmPairing() {
bool BluetoothPairingChromeOS::RejectPairing() {
return RunPairingCallbacks(
- BluetoothAgentServiceProvider::Delegate::REJECTED);
+ bluez::BluetoothAgentServiceProvider::Delegate::REJECTED);
}
bool BluetoothPairingChromeOS::CancelPairing() {
return RunPairingCallbacks(
- BluetoothAgentServiceProvider::Delegate::CANCELLED);
+ bluez::BluetoothAgentServiceProvider::Delegate::CANCELLED);
}
BluetoothDevice::PairingDelegate*
@@ -239,7 +242,7 @@ void BluetoothPairingChromeOS::ResetCallbacks() {
}
bool BluetoothPairingChromeOS::RunPairingCallbacks(
- BluetoothAgentServiceProvider::Delegate::Status status) {
+ bluez::BluetoothAgentServiceProvider::Delegate::Status status) {
pairing_delegate_used_ = true;
bool callback_run = false;
diff --git a/device/bluetooth/bluetooth_pairing_chromeos.h b/device/bluetooth/bluetooth_pairing_chromeos.h
index b50a328..0a4ddb6 100644
--- a/device/bluetooth/bluetooth_pairing_chromeos.h
+++ b/device/bluetooth/bluetooth_pairing_chromeos.h
@@ -5,8 +5,8 @@
#ifndef DEVICE_BLUETOOTH_BLUETOOTH_PAIRING_CHROMEOS_H_
#define DEVICE_BLUETOOTH_BLUETOOTH_PAIRING_CHROMEOS_H_
-#include "chromeos/dbus/bluetooth_agent_service_provider.h"
#include "device/bluetooth/bluetooth_device.h"
+#include "device/bluetooth/dbus/bluetooth_agent_service_provider.h"
namespace chromeos {
@@ -36,7 +36,8 @@ class BluetoothPairingChromeOS {
// calls on this object are translated into the appropriate response to
// |callback|.
void RequestPinCode(
- const BluetoothAgentServiceProvider::Delegate::PinCodeCallback& callback);
+ const bluez::BluetoothAgentServiceProvider::Delegate::PinCodeCallback&
+ callback);
// Indicates whether the device is currently pairing and expecting a
// PIN Code to be returned.
@@ -57,7 +58,8 @@ class BluetoothPairingChromeOS {
// calls on this object are translated into the appropriate response to
// |callback|.
void RequestPasskey(
- const BluetoothAgentServiceProvider::Delegate::PasskeyCallback& callback);
+ const bluez::BluetoothAgentServiceProvider::Delegate::PasskeyCallback&
+ callback);
// Sends the Passkey |passkey| to the remote device during pairing.
//
@@ -79,18 +81,16 @@ class BluetoothPairingChromeOS {
// from the current pairing delegate. The ConfirmPairing(), RejectPairing()
// and CancelPairing() method calls on this object are translated into the
// appropriate response to |callback|.
- void RequestConfirmation(
- uint32 passkey,
- const BluetoothAgentServiceProvider::Delegate::ConfirmationCallback&
- callback);
+ void RequestConfirmation(uint32 passkey,
+ const bluez::BluetoothAgentServiceProvider::
+ Delegate::ConfirmationCallback& callback);
// Requests authorization that the current device be allowed to pair with
// this device from the current pairing delegate. The ConfirmPairing(),
// RejectPairing() and CancelPairing() method calls on this object are
// translated into the appropriate response to |callback|.
- void RequestAuthorization(
- const BluetoothAgentServiceProvider::Delegate::ConfirmationCallback&
- callback);
+ void RequestAuthorization(const bluez::BluetoothAgentServiceProvider::
+ Delegate::ConfirmationCallback& callback);
// Confirms to the remote device during pairing that a passkey provided by
// the ConfirmPasskey() delegate call is displayed on both devices.
@@ -115,7 +115,7 @@ class BluetoothPairingChromeOS {
// Internal method to respond to the relevant callback for a RejectPairing
// or CancelPairing call.
bool RunPairingCallbacks(
- BluetoothAgentServiceProvider::Delegate::Status status);
+ bluez::BluetoothAgentServiceProvider::Delegate::Status status);
// The underlying BluetoothDeviceChromeOS that owns this pairing context.
BluetoothDeviceChromeOS* device_;
@@ -131,11 +131,13 @@ class BluetoothPairingChromeOS {
// During pairing these callbacks are set to those provided by method calls
// made on the BluetoothAdapterChromeOS instance by its respective
- // BluetoothAgentServiceProvider instance, and are called by our own
+ // bluez::BluetoothAgentServiceProvider instance, and are called by our own
// method calls such as SetPinCode() and SetPasskey().
- BluetoothAgentServiceProvider::Delegate::PinCodeCallback pincode_callback_;
- BluetoothAgentServiceProvider::Delegate::PasskeyCallback passkey_callback_;
- BluetoothAgentServiceProvider::Delegate::ConfirmationCallback
+ bluez::BluetoothAgentServiceProvider::Delegate::PinCodeCallback
+ pincode_callback_;
+ bluez::BluetoothAgentServiceProvider::Delegate::PasskeyCallback
+ passkey_callback_;
+ bluez::BluetoothAgentServiceProvider::Delegate::ConfirmationCallback
confirmation_callback_;
DISALLOW_COPY_AND_ASSIGN(BluetoothPairingChromeOS);
diff --git a/device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.cc b/device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.cc
index 5be8c78..7374f16 100644
--- a/device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.cc
+++ b/device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.cc
@@ -8,13 +8,13 @@
#include "base/logging.h"
#include "base/strings/stringprintf.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
#include "device/bluetooth/bluetooth_adapter_chromeos.h"
#include "device/bluetooth/bluetooth_device.h"
#include "device/bluetooth/bluetooth_gatt_notify_session_chromeos.h"
#include "device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h"
#include "device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.h"
#include "device/bluetooth/bluetooth_remote_gatt_service_chromeos.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
namespace chromeos {
@@ -44,13 +44,15 @@ BluetoothRemoteGattCharacteristicChromeOS::
weak_ptr_factory_(this) {
VLOG(1) << "Creating remote GATT characteristic with identifier: "
<< GetIdentifier() << ", UUID: " << GetUUID().canonical_value();
- DBusThreadManager::Get()->GetBluetoothGattDescriptorClient()->
- AddObserver(this);
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothGattDescriptorClient()
+ ->AddObserver(this);
// Add all known GATT characteristic descriptors.
const std::vector<dbus::ObjectPath>& gatt_descs =
- DBusThreadManager::Get()->GetBluetoothGattDescriptorClient()->
- GetDescriptors();
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothGattDescriptorClient()
+ ->GetDescriptors();
for (std::vector<dbus::ObjectPath>::const_iterator iter = gatt_descs.begin();
iter != gatt_descs.end(); ++iter)
GattDescriptorAdded(*iter);
@@ -58,8 +60,9 @@ BluetoothRemoteGattCharacteristicChromeOS::
BluetoothRemoteGattCharacteristicChromeOS::
~BluetoothRemoteGattCharacteristicChromeOS() {
- DBusThreadManager::Get()->GetBluetoothGattDescriptorClient()->
- RemoveObserver(this);
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothGattDescriptorClient()
+ ->RemoveObserver(this);
// Clean up all the descriptors. There isn't much point in notifying service
// observers for each descriptor that gets removed, so just delete them.
@@ -81,9 +84,10 @@ std::string BluetoothRemoteGattCharacteristicChromeOS::GetIdentifier() const {
device::BluetoothUUID
BluetoothRemoteGattCharacteristicChromeOS::GetUUID() const {
- BluetoothGattCharacteristicClient::Properties* properties =
- DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient()->
- GetProperties(object_path_);
+ bluez::BluetoothGattCharacteristicClient::Properties* properties =
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothGattCharacteristicClient()
+ ->GetProperties(object_path_);
DCHECK(properties);
return device::BluetoothUUID(properties->uuid.value());
}
@@ -94,8 +98,8 @@ bool BluetoothRemoteGattCharacteristicChromeOS::IsLocal() const {
const std::vector<uint8>&
BluetoothRemoteGattCharacteristicChromeOS::GetValue() const {
- BluetoothGattCharacteristicClient::Properties* properties =
- DBusThreadManager::Get()
+ bluez::BluetoothGattCharacteristicClient::Properties* properties =
+ bluez::BluezDBusManager::Get()
->GetBluetoothGattCharacteristicClient()
->GetProperties(object_path_);
@@ -111,9 +115,10 @@ BluetoothRemoteGattCharacteristicChromeOS::GetService() const {
device::BluetoothGattCharacteristic::Properties
BluetoothRemoteGattCharacteristicChromeOS::GetProperties() const {
- BluetoothGattCharacteristicClient::Properties* properties =
- DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient()->
- GetProperties(object_path_);
+ bluez::BluetoothGattCharacteristicClient::Properties* properties =
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothGattCharacteristicClient()
+ ->GetProperties(object_path_);
DCHECK(properties);
Properties props = PROPERTY_NONE;
@@ -154,8 +159,8 @@ BluetoothRemoteGattCharacteristicChromeOS::GetPermissions() const {
}
bool BluetoothRemoteGattCharacteristicChromeOS::IsNotifying() const {
- BluetoothGattCharacteristicClient::Properties* properties =
- DBusThreadManager::Get()
+ bluez::BluetoothGattCharacteristicClient::Properties* properties =
+ bluez::BluezDBusManager::Get()
->GetBluetoothGattCharacteristicClient()
->GetProperties(object_path_);
DCHECK(properties);
@@ -201,10 +206,12 @@ void BluetoothRemoteGattCharacteristicChromeOS::ReadRemoteCharacteristic(
<< GetIdentifier() << ", UUID: " << GetUUID().canonical_value()
<< ".";
- DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient()->ReadValue(
- object_path_, callback,
- base::Bind(&BluetoothRemoteGattCharacteristicChromeOS::OnError,
- weak_ptr_factory_.GetWeakPtr(), error_callback));
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothGattCharacteristicClient()
+ ->ReadValue(
+ object_path_, callback,
+ base::Bind(&BluetoothRemoteGattCharacteristicChromeOS::OnError,
+ weak_ptr_factory_.GetWeakPtr(), error_callback));
}
void BluetoothRemoteGattCharacteristicChromeOS::WriteRemoteCharacteristic(
@@ -215,13 +222,12 @@ void BluetoothRemoteGattCharacteristicChromeOS::WriteRemoteCharacteristic(
<< GetIdentifier() << ", UUID: " << GetUUID().canonical_value()
<< ", with value: " << new_value << ".";
- DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient()->WriteValue(
- object_path_,
- new_value,
- callback,
- base::Bind(&BluetoothRemoteGattCharacteristicChromeOS::OnError,
- weak_ptr_factory_.GetWeakPtr(),
- error_callback));
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothGattCharacteristicClient()
+ ->WriteValue(
+ object_path_, new_value, callback,
+ base::Bind(&BluetoothRemoteGattCharacteristicChromeOS::OnError,
+ weak_ptr_factory_.GetWeakPtr(), error_callback));
}
void BluetoothRemoteGattCharacteristicChromeOS::StartNotifySession(
@@ -267,15 +273,16 @@ void BluetoothRemoteGattCharacteristicChromeOS::StartNotifySession(
}
notify_call_pending_ = true;
- DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient()->StartNotify(
- object_path_,
- base::Bind(
- &BluetoothRemoteGattCharacteristicChromeOS::OnStartNotifySuccess,
- weak_ptr_factory_.GetWeakPtr(),
- callback),
- base::Bind(&BluetoothRemoteGattCharacteristicChromeOS::OnStartNotifyError,
- weak_ptr_factory_.GetWeakPtr(),
- error_callback));
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothGattCharacteristicClient()
+ ->StartNotify(
+ object_path_,
+ base::Bind(
+ &BluetoothRemoteGattCharacteristicChromeOS::OnStartNotifySuccess,
+ weak_ptr_factory_.GetWeakPtr(), callback),
+ base::Bind(
+ &BluetoothRemoteGattCharacteristicChromeOS::OnStartNotifyError,
+ weak_ptr_factory_.GetWeakPtr(), error_callback));
}
void BluetoothRemoteGattCharacteristicChromeOS::RemoveNotifySession(
@@ -304,15 +311,16 @@ void BluetoothRemoteGattCharacteristicChromeOS::RemoveNotifySession(
DCHECK(num_notify_sessions_ == 1);
notify_call_pending_ = true;
- DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient()->StopNotify(
- object_path_,
- base::Bind(
- &BluetoothRemoteGattCharacteristicChromeOS::OnStopNotifySuccess,
- weak_ptr_factory_.GetWeakPtr(),
- callback),
- base::Bind(&BluetoothRemoteGattCharacteristicChromeOS::OnStopNotifyError,
- weak_ptr_factory_.GetWeakPtr(),
- callback));
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothGattCharacteristicClient()
+ ->StopNotify(
+ object_path_,
+ base::Bind(
+ &BluetoothRemoteGattCharacteristicChromeOS::OnStopNotifySuccess,
+ weak_ptr_factory_.GetWeakPtr(), callback),
+ base::Bind(
+ &BluetoothRemoteGattCharacteristicChromeOS::OnStopNotifyError,
+ weak_ptr_factory_.GetWeakPtr(), callback));
}
void BluetoothRemoteGattCharacteristicChromeOS::GattDescriptorAdded(
@@ -323,9 +331,10 @@ void BluetoothRemoteGattCharacteristicChromeOS::GattDescriptorAdded(
return;
}
- BluetoothGattDescriptorClient::Properties* properties =
- DBusThreadManager::Get()->GetBluetoothGattDescriptorClient()->
- GetProperties(object_path);
+ bluez::BluetoothGattDescriptorClient::Properties* properties =
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothGattDescriptorClient()
+ ->GetProperties(object_path);
DCHECK(properties);
if (properties->characteristic.value() != object_path_) {
VLOG(3) << "Remote GATT descriptor does not belong to this characteristic.";
@@ -375,8 +384,8 @@ void BluetoothRemoteGattCharacteristicChromeOS::GattDescriptorPropertyChanged(
return;
}
- BluetoothGattDescriptorClient::Properties* properties =
- DBusThreadManager::Get()
+ bluez::BluetoothGattDescriptorClient::Properties* properties =
+ bluez::BluezDBusManager::Get()
->GetBluetoothGattDescriptorClient()
->GetProperties(object_path);
diff --git a/device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h b/device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h
index a23a1178..361b319 100644
--- a/device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h
+++ b/device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h
@@ -12,10 +12,10 @@
#include <vector>
#include "base/memory/weak_ptr.h"
-#include "chromeos/dbus/bluetooth_gatt_descriptor_client.h"
#include "dbus/object_path.h"
#include "device/bluetooth/bluetooth_gatt_characteristic.h"
#include "device/bluetooth/bluetooth_uuid.h"
+#include "device/bluetooth/dbus/bluetooth_gatt_descriptor_client.h"
namespace device {
@@ -34,7 +34,7 @@ class BluetoothRemoteGattServiceChromeOS;
// platform.
class BluetoothRemoteGattCharacteristicChromeOS
: public device::BluetoothGattCharacteristic,
- public BluetoothGattDescriptorClient::Observer {
+ public bluez::BluetoothGattDescriptorClient::Observer {
public:
// device::BluetoothGattCharacteristic overrides.
std::string GetIdentifier() const override;
@@ -78,7 +78,7 @@ class BluetoothRemoteGattCharacteristicChromeOS
const dbus::ObjectPath& object_path);
~BluetoothRemoteGattCharacteristicChromeOS() override;
- // BluetoothGattDescriptorClient::Observer overrides.
+ // bluez::BluetoothGattDescriptorClient::Observer overrides.
void GattDescriptorAdded(const dbus::ObjectPath& object_path) override;
void GattDescriptorRemoved(const dbus::ObjectPath& object_path) override;
void GattDescriptorPropertyChanged(const dbus::ObjectPath& object_path,
diff --git a/device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.cc b/device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.cc
index da38566..f864c3b 100644
--- a/device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.cc
+++ b/device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.cc
@@ -7,10 +7,10 @@
#include "base/bind.h"
#include "base/logging.h"
#include "base/strings/stringprintf.h"
-#include "chromeos/dbus/bluetooth_gatt_descriptor_client.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
#include "device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h"
#include "device/bluetooth/bluetooth_remote_gatt_service_chromeos.h"
+#include "device/bluetooth/dbus/bluetooth_gatt_descriptor_client.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
namespace chromeos {
@@ -47,9 +47,10 @@ std::string BluetoothRemoteGattDescriptorChromeOS::GetIdentifier() const {
}
device::BluetoothUUID BluetoothRemoteGattDescriptorChromeOS::GetUUID() const {
- BluetoothGattDescriptorClient::Properties* properties =
- DBusThreadManager::Get()->GetBluetoothGattDescriptorClient()->
- GetProperties(object_path_);
+ bluez::BluetoothGattDescriptorClient::Properties* properties =
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothGattDescriptorClient()
+ ->GetProperties(object_path_);
DCHECK(properties);
return device::BluetoothUUID(properties->uuid.value());
}
@@ -60,8 +61,8 @@ bool BluetoothRemoteGattDescriptorChromeOS::IsLocal() const {
const std::vector<uint8>&
BluetoothRemoteGattDescriptorChromeOS::GetValue() const {
- BluetoothGattDescriptorClient::Properties* properties =
- DBusThreadManager::Get()
+ bluez::BluetoothGattDescriptorClient::Properties* properties =
+ bluez::BluezDBusManager::Get()
->GetBluetoothGattDescriptorClient()
->GetProperties(object_path_);
@@ -89,7 +90,7 @@ void BluetoothRemoteGattDescriptorChromeOS::ReadRemoteDescriptor(
<< "descriptor: " << GetIdentifier() << ", UUID: "
<< GetUUID().canonical_value();
- DBusThreadManager::Get()->GetBluetoothGattDescriptorClient()->ReadValue(
+ bluez::BluezDBusManager::Get()->GetBluetoothGattDescriptorClient()->ReadValue(
object_path_, callback,
base::Bind(&BluetoothRemoteGattDescriptorChromeOS::OnError,
weak_ptr_factory_.GetWeakPtr(), error_callback));
@@ -104,13 +105,11 @@ void BluetoothRemoteGattDescriptorChromeOS::WriteRemoteDescriptor(
<< GetUUID().canonical_value() << ", with value: "
<< new_value << ".";
- DBusThreadManager::Get()->GetBluetoothGattDescriptorClient()->WriteValue(
- object_path_,
- new_value,
- callback,
- base::Bind(&BluetoothRemoteGattDescriptorChromeOS::OnError,
- weak_ptr_factory_.GetWeakPtr(),
- error_callback));
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothGattDescriptorClient()
+ ->WriteValue(object_path_, new_value, callback,
+ base::Bind(&BluetoothRemoteGattDescriptorChromeOS::OnError,
+ weak_ptr_factory_.GetWeakPtr(), error_callback));
}
void BluetoothRemoteGattDescriptorChromeOS::OnError(
diff --git a/device/bluetooth/bluetooth_remote_gatt_service_chromeos.cc b/device/bluetooth/bluetooth_remote_gatt_service_chromeos.cc
index cea23ec..8a57fa2 100644
--- a/device/bluetooth/bluetooth_remote_gatt_service_chromeos.cc
+++ b/device/bluetooth/bluetooth_remote_gatt_service_chromeos.cc
@@ -6,12 +6,12 @@
#include "base/logging.h"
#include "base/strings/stringprintf.h"
-#include "chromeos/dbus/bluetooth_gatt_service_client.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
#include "device/bluetooth/bluetooth_adapter_chromeos.h"
#include "device/bluetooth/bluetooth_device_chromeos.h"
#include "device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h"
#include "device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.h"
+#include "device/bluetooth/dbus/bluetooth_gatt_service_client.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
namespace chromeos {
@@ -41,24 +41,29 @@ BluetoothRemoteGattServiceChromeOS::BluetoothRemoteGattServiceChromeOS(
<< object_path.value() << ", UUID: " << GetUUID().canonical_value();
DCHECK(adapter_);
- DBusThreadManager::Get()->GetBluetoothGattServiceClient()->AddObserver(this);
- DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient()->
- AddObserver(this);
+ bluez::BluezDBusManager::Get()->GetBluetoothGattServiceClient()->AddObserver(
+ this);
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothGattCharacteristicClient()
+ ->AddObserver(this);
// Add all known GATT characteristics.
const std::vector<dbus::ObjectPath>& gatt_chars =
- DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient()->
- GetCharacteristics();
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothGattCharacteristicClient()
+ ->GetCharacteristics();
for (std::vector<dbus::ObjectPath>::const_iterator iter = gatt_chars.begin();
iter != gatt_chars.end(); ++iter)
GattCharacteristicAdded(*iter);
}
BluetoothRemoteGattServiceChromeOS::~BluetoothRemoteGattServiceChromeOS() {
- DBusThreadManager::Get()->GetBluetoothGattServiceClient()->
- RemoveObserver(this);
- DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient()->
- RemoveObserver(this);
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothGattServiceClient()
+ ->RemoveObserver(this);
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothGattCharacteristicClient()
+ ->RemoveObserver(this);
// Clean up all the characteristics. Copy the characteristics list here and
// clear the original so that when we send GattCharacteristicRemoved(),
@@ -79,9 +84,10 @@ std::string BluetoothRemoteGattServiceChromeOS::GetIdentifier() const {
}
device::BluetoothUUID BluetoothRemoteGattServiceChromeOS::GetUUID() const {
- BluetoothGattServiceClient::Properties* properties =
- DBusThreadManager::Get()->GetBluetoothGattServiceClient()->
- GetProperties(object_path_);
+ bluez::BluetoothGattServiceClient::Properties* properties =
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothGattServiceClient()
+ ->GetProperties(object_path_);
DCHECK(properties);
return device::BluetoothUUID(properties->uuid.value());
}
@@ -91,9 +97,10 @@ bool BluetoothRemoteGattServiceChromeOS::IsLocal() const {
}
bool BluetoothRemoteGattServiceChromeOS::IsPrimary() const {
- BluetoothGattServiceClient::Properties* properties =
- DBusThreadManager::Get()->GetBluetoothGattServiceClient()->
- GetProperties(object_path_);
+ bluez::BluetoothGattServiceClient::Properties* properties =
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothGattServiceClient()
+ ->GetProperties(object_path_);
DCHECK(properties);
return properties->primary.value();
}
@@ -227,9 +234,10 @@ void BluetoothRemoteGattServiceChromeOS::GattServicePropertyChanged(
VLOG(1) << "Service property changed: \"" << property_name << "\", "
<< object_path.value();
- BluetoothGattServiceClient::Properties* properties =
- DBusThreadManager::Get()->GetBluetoothGattServiceClient()->GetProperties(
- object_path);
+ bluez::BluetoothGattServiceClient::Properties* properties =
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothGattServiceClient()
+ ->GetProperties(object_path);
DCHECK(properties);
if (property_name != properties->characteristics.name()) {
@@ -255,9 +263,10 @@ void BluetoothRemoteGattServiceChromeOS::GattCharacteristicAdded(
return;
}
- BluetoothGattCharacteristicClient::Properties* properties =
- DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient()->
- GetProperties(object_path);
+ bluez::BluetoothGattCharacteristicClient::Properties* properties =
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothGattCharacteristicClient()
+ ->GetProperties(object_path);
DCHECK(properties);
if (properties->service.value() != object_path_) {
VLOG(2) << "Remote GATT characteristic does not belong to this service.";
@@ -312,9 +321,10 @@ void BluetoothRemoteGattServiceChromeOS::GattCharacteristicPropertyChanged(
// "Characteristic Extended Properties" descriptor. In this case, kick off
// a service changed observer event to let observers refresh the
// characteristics.
- BluetoothGattCharacteristicClient::Properties* properties =
- DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient()->
- GetProperties(object_path);
+ bluez::BluetoothGattCharacteristicClient::Properties* properties =
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothGattCharacteristicClient()
+ ->GetProperties(object_path);
DCHECK(properties);
DCHECK(adapter_);
diff --git a/device/bluetooth/bluetooth_remote_gatt_service_chromeos.h b/device/bluetooth/bluetooth_remote_gatt_service_chromeos.h
index 9aa8fdd..bc35cb7 100644
--- a/device/bluetooth/bluetooth_remote_gatt_service_chromeos.h
+++ b/device/bluetooth/bluetooth_remote_gatt_service_chromeos.h
@@ -12,11 +12,11 @@
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
-#include "chromeos/dbus/bluetooth_gatt_characteristic_client.h"
-#include "chromeos/dbus/bluetooth_gatt_service_client.h"
#include "dbus/object_path.h"
#include "device/bluetooth/bluetooth_gatt_service.h"
#include "device/bluetooth/bluetooth_uuid.h"
+#include "device/bluetooth/dbus/bluetooth_gatt_characteristic_client.h"
+#include "device/bluetooth/dbus/bluetooth_gatt_service_client.h"
namespace device {
@@ -36,8 +36,8 @@ class BluetoothRemoteGattDescriptorChromeOS;
// for remote GATT services on the Chrome OS platform.
class BluetoothRemoteGattServiceChromeOS
: public device::BluetoothGattService,
- public BluetoothGattServiceClient::Observer,
- public BluetoothGattCharacteristicClient::Observer {
+ public bluez::BluetoothGattServiceClient::Observer,
+ public bluez::BluetoothGattCharacteristicClient::Observer {
public:
// device::BluetoothGattService overrides.
std::string GetIdentifier() const override;
@@ -104,11 +104,11 @@ class BluetoothRemoteGattServiceChromeOS
const dbus::ObjectPath& object_path);
~BluetoothRemoteGattServiceChromeOS() override;
- // BluetoothGattServiceClient::Observer override.
+ // bluez::BluetoothGattServiceClient::Observer override.
void GattServicePropertyChanged(const dbus::ObjectPath& object_path,
const std::string& property_name) override;
- // BluetoothGattCharacteristicClient::Observer override.
+ // bluez::BluetoothGattCharacteristicClient::Observer override.
void GattCharacteristicAdded(const dbus::ObjectPath& object_path) override;
void GattCharacteristicRemoved(const dbus::ObjectPath& object_path) override;
void GattCharacteristicPropertyChanged(
diff --git a/device/bluetooth/bluetooth_socket_chromeos.cc b/device/bluetooth/bluetooth_socket_chromeos.cc
index da15484..b3e357d 100644
--- a/device/bluetooth/bluetooth_socket_chromeos.cc
+++ b/device/bluetooth/bluetooth_socket_chromeos.cc
@@ -20,10 +20,6 @@
#include "base/task_runner_util.h"
#include "base/threading/thread_restrictions.h"
#include "base/threading/worker_pool.h"
-#include "chromeos/dbus/bluetooth_device_client.h"
-#include "chromeos/dbus/bluetooth_profile_manager_client.h"
-#include "chromeos/dbus/bluetooth_profile_service_provider.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
#include "dbus/bus.h"
#include "dbus/file_descriptor.h"
#include "dbus/object_path.h"
@@ -35,6 +31,10 @@
#include "device/bluetooth/bluetooth_socket.h"
#include "device/bluetooth/bluetooth_socket_net.h"
#include "device/bluetooth/bluetooth_socket_thread.h"
+#include "device/bluetooth/dbus/bluetooth_device_client.h"
+#include "device/bluetooth/dbus/bluetooth_profile_manager_client.h"
+#include "device/bluetooth/dbus/bluetooth_profile_service_provider.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
#include "net/base/ip_endpoint.h"
#include "net/base/net_errors.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
@@ -107,7 +107,7 @@ void BluetoothSocketChromeOS::Connect(
device_address_ = device->GetAddress();
device_path_ = device->object_path();
uuid_ = uuid;
- options_.reset(new BluetoothProfileManagerClient::Options());
+ options_.reset(new bluez::BluetoothProfileManagerClient::Options());
if (security_level == SECURITY_LEVEL_LOW)
options_->require_authentication.reset(new bool(false));
@@ -135,7 +135,7 @@ void BluetoothSocketChromeOS::Listen(
adapter_->AddObserver(this);
uuid_ = uuid;
- options_.reset(new BluetoothProfileManagerClient::Options());
+ options_.reset(new bluez::BluetoothProfileManagerClient::Options());
if (service_options.name)
options_->name.reset(new std::string(*service_options.name));
@@ -165,7 +165,7 @@ void BluetoothSocketChromeOS::Close() {
// In the case below, where an asynchronous task gets posted on the socket
// thread in BluetoothSocketNet::Close, a reference will be held to this
// socket by the callback. This may cause the BluetoothAdapter to outlive
- // DBusThreadManager during shutdown if that callback executes too late.
+ // BluezDBusManager during shutdown if that callback executes too late.
if (adapter_.get()) {
adapter_->RemoveObserver(this);
adapter_ = nullptr;
@@ -264,7 +264,7 @@ void BluetoothSocketChromeOS::OnRegisterProfile(
VLOG(1) << uuid_.canonical_value() << ": Got profile, connecting to "
<< device_path_.value();
- DBusThreadManager::Get()->GetBluetoothDeviceClient()->ConnectProfile(
+ bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->ConnectProfile(
device_path_, uuid_.canonical_value(),
base::Bind(&BluetoothSocketChromeOS::OnConnectProfile, this,
success_callback),
@@ -355,7 +355,7 @@ void BluetoothSocketChromeOS::Released() {
void BluetoothSocketChromeOS::NewConnection(
const dbus::ObjectPath& device_path,
scoped_ptr<dbus::FileDescriptor> fd,
- const BluetoothProfileServiceProvider::Delegate::Options& options,
+ const bluez::BluetoothProfileServiceProvider::Delegate::Options& options,
const ConfirmationCallback& callback) {
DCHECK(ui_task_runner()->RunsTasksOnCurrentThread());
@@ -460,7 +460,7 @@ void BluetoothSocketChromeOS::AcceptConnectionRequest() {
void BluetoothSocketChromeOS::DoNewConnection(
const dbus::ObjectPath& device_path,
scoped_ptr<dbus::FileDescriptor> fd,
- const BluetoothProfileServiceProvider::Delegate::Options& options,
+ const bluez::BluetoothProfileServiceProvider::Delegate::Options& options,
const ConfirmationCallback& callback) {
DCHECK(socket_thread()->task_runner()->RunsTasksOnCurrentThread());
base::ThreadRestrictions::AssertIOAllowed();
diff --git a/device/bluetooth/bluetooth_socket_chromeos.h b/device/bluetooth/bluetooth_socket_chromeos.h
index 98d4d02..a1c76ee2 100644
--- a/device/bluetooth/bluetooth_socket_chromeos.h
+++ b/device/bluetooth/bluetooth_socket_chromeos.h
@@ -10,14 +10,14 @@
#include "base/memory/linked_ptr.h"
#include "base/memory/scoped_ptr.h"
-#include "chromeos/chromeos_export.h"
-#include "chromeos/dbus/bluetooth_profile_manager_client.h"
-#include "chromeos/dbus/bluetooth_profile_service_provider.h"
#include "dbus/object_path.h"
#include "device/bluetooth/bluetooth_adapter.h"
+#include "device/bluetooth/bluetooth_export.h"
#include "device/bluetooth/bluetooth_socket.h"
#include "device/bluetooth/bluetooth_socket_net.h"
#include "device/bluetooth/bluetooth_uuid.h"
+#include "device/bluetooth/dbus/bluetooth_profile_manager_client.h"
+#include "device/bluetooth/dbus/bluetooth_profile_service_provider.h"
namespace dbus {
class FileDescriptor;
@@ -33,10 +33,10 @@ class BluetoothAdapterProfileChromeOS;
// Chrome OS platform.
//
// This class is not thread-safe, but is only called from the UI thread.
-class CHROMEOS_EXPORT BluetoothSocketChromeOS
+class DEVICE_BLUETOOTH_EXPORT BluetoothSocketChromeOS
: public device::BluetoothSocketNet,
public device::BluetoothAdapter::Observer,
- public BluetoothProfileServiceProvider::Delegate {
+ public bluez::BluetoothProfileServiceProvider::Delegate {
public:
enum SecurityLevel {
SECURITY_LEVEL_LOW,
@@ -112,12 +112,12 @@ class CHROMEOS_EXPORT BluetoothSocketChromeOS
void OnInternalRegisterProfile(BluetoothAdapterProfileChromeOS* profile);
void OnInternalRegisterProfileError(const std::string& error_message);
- // BluetoothProfileServiceProvider::Delegate:
+ // bluez::BluetoothProfileServiceProvider::Delegate:
void Released() override;
void NewConnection(
const dbus::ObjectPath& device_path,
scoped_ptr<dbus::FileDescriptor> fd,
- const BluetoothProfileServiceProvider::Delegate::Options& options,
+ const bluez::BluetoothProfileServiceProvider::Delegate::Options& options,
const ConfirmationCallback& callback) override;
void RequestDisconnection(const dbus::ObjectPath& device_path,
const ConfirmationCallback& callback) override;
@@ -131,7 +131,7 @@ class CHROMEOS_EXPORT BluetoothSocketChromeOS
void DoNewConnection(
const dbus::ObjectPath& device_path,
scoped_ptr<dbus::FileDescriptor> fd,
- const BluetoothProfileServiceProvider::Delegate::Options& options,
+ const bluez::BluetoothProfileServiceProvider::Delegate::Options& options,
const ConfirmationCallback& callback);
// Method run on the UI thread after a new connection has been accepted and
@@ -166,7 +166,7 @@ class CHROMEOS_EXPORT BluetoothSocketChromeOS
device::BluetoothUUID uuid_;
// Copy of the profile options used for registering the profile.
- scoped_ptr<BluetoothProfileManagerClient::Options> options_;
+ scoped_ptr<bluez::BluetoothProfileManagerClient::Options> options_;
// The profile registered with the adapter for this socket.
BluetoothAdapterProfileChromeOS* profile_;
@@ -188,7 +188,7 @@ class CHROMEOS_EXPORT BluetoothSocketChromeOS
dbus::ObjectPath device_path;
scoped_ptr<dbus::FileDescriptor> fd;
- BluetoothProfileServiceProvider::Delegate::Options options;
+ bluez::BluetoothProfileServiceProvider::Delegate::Options options;
ConfirmationCallback callback;
bool accepting;
bool cancelled;
diff --git a/device/bluetooth/bluetooth_socket_chromeos_unittest.cc b/device/bluetooth/bluetooth_socket_chromeos_unittest.cc
index 697365d..0bdc3be 100644
--- a/device/bluetooth/bluetooth_socket_chromeos_unittest.cc
+++ b/device/bluetooth/bluetooth_socket_chromeos_unittest.cc
@@ -5,14 +5,6 @@
#include "base/bind.h"
#include "base/memory/ref_counted.h"
#include "base/message_loop/message_loop.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/fake_bluetooth_adapter_client.h"
-#include "chromeos/dbus/fake_bluetooth_agent_manager_client.h"
-#include "chromeos/dbus/fake_bluetooth_device_client.h"
-#include "chromeos/dbus/fake_bluetooth_gatt_service_client.h"
-#include "chromeos/dbus/fake_bluetooth_input_client.h"
-#include "chromeos/dbus/fake_bluetooth_profile_manager_client.h"
-#include "chromeos/dbus/fake_bluetooth_profile_service_provider.h"
#include "device/bluetooth/bluetooth_adapter.h"
#include "device/bluetooth/bluetooth_adapter_chromeos.h"
#include "device/bluetooth/bluetooth_adapter_factory.h"
@@ -22,6 +14,14 @@
#include "device/bluetooth/bluetooth_socket_chromeos.h"
#include "device/bluetooth/bluetooth_socket_thread.h"
#include "device/bluetooth/bluetooth_uuid.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
+#include "device/bluetooth/dbus/fake_bluetooth_adapter_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_agent_manager_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_device_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_gatt_service_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_input_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_profile_manager_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_profile_service_provider.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -51,24 +51,27 @@ class BluetoothSocketChromeOSTest : public testing::Test {
last_reason_(BluetoothSocket::kSystemError) {}
void SetUp() override {
- scoped_ptr<DBusThreadManagerSetter> dbus_setter =
- DBusThreadManager::GetSetterForTesting();
+ scoped_ptr<bluez::BluezDBusManagerSetter> dbus_setter =
+ bluez::BluezDBusManager::GetSetterForTesting();
dbus_setter->SetBluetoothAdapterClient(
- scoped_ptr<BluetoothAdapterClient>(new FakeBluetoothAdapterClient));
+ scoped_ptr<bluez::BluetoothAdapterClient>(
+ new bluez::FakeBluetoothAdapterClient));
dbus_setter->SetBluetoothAgentManagerClient(
- scoped_ptr<BluetoothAgentManagerClient>(
- new FakeBluetoothAgentManagerClient));
+ scoped_ptr<bluez::BluetoothAgentManagerClient>(
+ new bluez::FakeBluetoothAgentManagerClient));
dbus_setter->SetBluetoothDeviceClient(
- scoped_ptr<BluetoothDeviceClient>(new FakeBluetoothDeviceClient));
+ scoped_ptr<bluez::BluetoothDeviceClient>(
+ new bluez::FakeBluetoothDeviceClient));
dbus_setter->SetBluetoothGattServiceClient(
- scoped_ptr<BluetoothGattServiceClient>(
- new FakeBluetoothGattServiceClient));
+ scoped_ptr<bluez::BluetoothGattServiceClient>(
+ new bluez::FakeBluetoothGattServiceClient));
dbus_setter->SetBluetoothInputClient(
- scoped_ptr<BluetoothInputClient>(new FakeBluetoothInputClient));
+ scoped_ptr<bluez::BluetoothInputClient>(
+ new bluez::FakeBluetoothInputClient));
dbus_setter->SetBluetoothProfileManagerClient(
- scoped_ptr<BluetoothProfileManagerClient>(
- new FakeBluetoothProfileManagerClient));
+ scoped_ptr<bluez::BluetoothProfileManagerClient>(
+ new bluez::FakeBluetoothProfileManagerClient));
BluetoothSocketThread::Get();
@@ -91,7 +94,7 @@ class BluetoothSocketChromeOSTest : public testing::Test {
void TearDown() override {
adapter_ = nullptr;
BluetoothSocketThread::CleanupForTesting();
- DBusThreadManager::Shutdown();
+ bluez::BluezDBusManager::Shutdown();
}
void AdapterCallback(scoped_refptr<BluetoothAdapter> adapter) {
@@ -183,11 +186,11 @@ class BluetoothSocketChromeOSTest : public testing::Test {
TEST_F(BluetoothSocketChromeOSTest, Connect) {
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kPairedDeviceAddress);
+ bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress);
ASSERT_TRUE(device != nullptr);
device->ConnectToService(
- BluetoothUUID(FakeBluetoothProfileManagerClient::kRfcommUuid),
+ BluetoothUUID(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid),
base::Bind(&BluetoothSocketChromeOSTest::ConnectToServiceSuccessCallback,
base::Unretained(this)),
base::Bind(&BluetoothSocketChromeOSTest::ErrorCallback,
@@ -294,7 +297,7 @@ TEST_F(BluetoothSocketChromeOSTest, Connect) {
TEST_F(BluetoothSocketChromeOSTest, Listen) {
adapter_->CreateRfcommService(
- BluetoothUUID(FakeBluetoothProfileManagerClient::kRfcommUuid),
+ BluetoothUUID(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid),
BluetoothAdapter::ServiceOptions(),
base::Bind(&BluetoothSocketChromeOSTest::CreateServiceSuccessCallback,
base::Unretained(this)),
@@ -319,17 +322,16 @@ TEST_F(BluetoothSocketChromeOSTest, Listen) {
//
// This is done before the Accept() call to simulate a pending call at the
// point that Accept() is called.
- FakeBluetoothDeviceClient* fake_bluetooth_device_client =
- static_cast<FakeBluetoothDeviceClient*>(
- DBusThreadManager::Get()->GetBluetoothDeviceClient());
+ bluez::FakeBluetoothDeviceClient* fake_bluetooth_device_client =
+ static_cast<bluez::FakeBluetoothDeviceClient*>(
+ bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient());
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kPairedDeviceAddress);
+ bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress);
ASSERT_TRUE(device != nullptr);
fake_bluetooth_device_client->ConnectProfile(
static_cast<BluetoothDeviceChromeOS*>(device)->object_path(),
- FakeBluetoothProfileManagerClient::kRfcommUuid,
- base::Bind(&base::DoNothing),
- base::Bind(&DoNothingDBusErrorCallback));
+ bluez::FakeBluetoothProfileManagerClient::kRfcommUuid,
+ base::Bind(&base::DoNothing), base::Bind(&DoNothingDBusErrorCallback));
message_loop_.RunUntilIdle();
@@ -375,9 +377,8 @@ TEST_F(BluetoothSocketChromeOSTest, Listen) {
fake_bluetooth_device_client->ConnectProfile(
static_cast<BluetoothDeviceChromeOS*>(device)->object_path(),
- FakeBluetoothProfileManagerClient::kRfcommUuid,
- base::Bind(&base::DoNothing),
- base::Bind(&DoNothingDBusErrorCallback));
+ bluez::FakeBluetoothProfileManagerClient::kRfcommUuid,
+ base::Bind(&base::DoNothing), base::Bind(&DoNothingDBusErrorCallback));
message_loop_.Run();
@@ -416,13 +417,13 @@ TEST_F(BluetoothSocketChromeOSTest, Listen) {
TEST_F(BluetoothSocketChromeOSTest, ListenBeforeAdapterStart) {
// Start off with an invisible adapter, register the profile, then make
// the adapter visible.
- FakeBluetoothAdapterClient* fake_bluetooth_adapter_client =
- static_cast<FakeBluetoothAdapterClient*>(
- DBusThreadManager::Get()->GetBluetoothAdapterClient());
+ bluez::FakeBluetoothAdapterClient* fake_bluetooth_adapter_client =
+ static_cast<bluez::FakeBluetoothAdapterClient*>(
+ bluez::BluezDBusManager::Get()->GetBluetoothAdapterClient());
fake_bluetooth_adapter_client->SetVisible(false);
adapter_->CreateRfcommService(
- BluetoothUUID(FakeBluetoothProfileManagerClient::kRfcommUuid),
+ BluetoothUUID(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid),
BluetoothAdapter::ServiceOptions(),
base::Bind(&BluetoothSocketChromeOSTest::CreateServiceSuccessCallback,
base::Unretained(this)),
@@ -441,12 +442,14 @@ TEST_F(BluetoothSocketChromeOSTest, ListenBeforeAdapterStart) {
error_callback_count_ = 0;
// But there shouldn't be a profile registered yet.
- FakeBluetoothProfileManagerClient* fake_bluetooth_profile_manager_client =
- static_cast<FakeBluetoothProfileManagerClient*>(
- DBusThreadManager::Get()->GetBluetoothProfileManagerClient());
- FakeBluetoothProfileServiceProvider* profile_service_provider =
+ bluez::FakeBluetoothProfileManagerClient*
+ fake_bluetooth_profile_manager_client =
+ static_cast<bluez::FakeBluetoothProfileManagerClient*>(
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothProfileManagerClient());
+ bluez::FakeBluetoothProfileServiceProvider* profile_service_provider =
fake_bluetooth_profile_manager_client->GetProfileServiceProvider(
- FakeBluetoothProfileManagerClient::kRfcommUuid);
+ bluez::FakeBluetoothProfileManagerClient::kRfcommUuid);
EXPECT_TRUE(profile_service_provider == nullptr);
// Make the adapter visible. This should register a profile.
@@ -456,7 +459,7 @@ TEST_F(BluetoothSocketChromeOSTest, ListenBeforeAdapterStart) {
profile_service_provider =
fake_bluetooth_profile_manager_client->GetProfileServiceProvider(
- FakeBluetoothProfileManagerClient::kRfcommUuid);
+ bluez::FakeBluetoothProfileManagerClient::kRfcommUuid);
EXPECT_TRUE(profile_service_provider != nullptr);
// Cleanup the socket.
@@ -471,12 +474,12 @@ TEST_F(BluetoothSocketChromeOSTest, ListenBeforeAdapterStart) {
TEST_F(BluetoothSocketChromeOSTest, ListenAcrossAdapterRestart) {
// The fake adapter starts off visible by default.
- FakeBluetoothAdapterClient* fake_bluetooth_adapter_client =
- static_cast<FakeBluetoothAdapterClient*>(
- DBusThreadManager::Get()->GetBluetoothAdapterClient());
+ bluez::FakeBluetoothAdapterClient* fake_bluetooth_adapter_client =
+ static_cast<bluez::FakeBluetoothAdapterClient*>(
+ bluez::BluezDBusManager::Get()->GetBluetoothAdapterClient());
adapter_->CreateRfcommService(
- BluetoothUUID(FakeBluetoothProfileManagerClient::kRfcommUuid),
+ BluetoothUUID(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid),
BluetoothAdapter::ServiceOptions(),
base::Bind(&BluetoothSocketChromeOSTest::CreateServiceSuccessCallback,
base::Unretained(this)),
@@ -495,12 +498,14 @@ TEST_F(BluetoothSocketChromeOSTest, ListenAcrossAdapterRestart) {
error_callback_count_ = 0;
// Make sure the profile was registered with the daemon.
- FakeBluetoothProfileManagerClient* fake_bluetooth_profile_manager_client =
- static_cast<FakeBluetoothProfileManagerClient*>(
- DBusThreadManager::Get()->GetBluetoothProfileManagerClient());
- FakeBluetoothProfileServiceProvider* profile_service_provider =
+ bluez::FakeBluetoothProfileManagerClient*
+ fake_bluetooth_profile_manager_client =
+ static_cast<bluez::FakeBluetoothProfileManagerClient*>(
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothProfileManagerClient());
+ bluez::FakeBluetoothProfileServiceProvider* profile_service_provider =
fake_bluetooth_profile_manager_client->GetProfileServiceProvider(
- FakeBluetoothProfileManagerClient::kRfcommUuid);
+ bluez::FakeBluetoothProfileManagerClient::kRfcommUuid);
EXPECT_TRUE(profile_service_provider != nullptr);
// Make the adapter invisible, and fiddle with the profile fake to unregister
@@ -516,7 +521,7 @@ TEST_F(BluetoothSocketChromeOSTest, ListenAcrossAdapterRestart) {
profile_service_provider =
fake_bluetooth_profile_manager_client->GetProfileServiceProvider(
- FakeBluetoothProfileManagerClient::kRfcommUuid);
+ bluez::FakeBluetoothProfileManagerClient::kRfcommUuid);
EXPECT_TRUE(profile_service_provider != nullptr);
// Cleanup the socket.
@@ -531,11 +536,11 @@ TEST_F(BluetoothSocketChromeOSTest, ListenAcrossAdapterRestart) {
TEST_F(BluetoothSocketChromeOSTest, PairedConnectFails) {
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kPairedUnconnectableDeviceAddress);
+ bluez::FakeBluetoothDeviceClient::kPairedUnconnectableDeviceAddress);
ASSERT_TRUE(device != nullptr);
device->ConnectToService(
- BluetoothUUID(FakeBluetoothProfileManagerClient::kRfcommUuid),
+ BluetoothUUID(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid),
base::Bind(&BluetoothSocketChromeOSTest::ConnectToServiceSuccessCallback,
base::Unretained(this)),
base::Bind(&BluetoothSocketChromeOSTest::ErrorCallback,
@@ -547,7 +552,7 @@ TEST_F(BluetoothSocketChromeOSTest, PairedConnectFails) {
EXPECT_TRUE(last_socket_.get() == nullptr);
device->ConnectToService(
- BluetoothUUID(FakeBluetoothProfileManagerClient::kRfcommUuid),
+ BluetoothUUID(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid),
base::Bind(&BluetoothSocketChromeOSTest::ConnectToServiceSuccessCallback,
base::Unretained(this)),
base::Bind(&BluetoothSocketChromeOSTest::ErrorCallback,
@@ -561,7 +566,7 @@ TEST_F(BluetoothSocketChromeOSTest, PairedConnectFails) {
TEST_F(BluetoothSocketChromeOSTest, SocketListenTwice) {
adapter_->CreateRfcommService(
- BluetoothUUID(FakeBluetoothProfileManagerClient::kRfcommUuid),
+ BluetoothUUID(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid),
BluetoothAdapter::ServiceOptions(),
base::Bind(&BluetoothSocketChromeOSTest::CreateServiceSuccessCallback,
base::Unretained(this)),
@@ -594,7 +599,7 @@ TEST_F(BluetoothSocketChromeOSTest, SocketListenTwice) {
EXPECT_EQ(1U, error_callback_count_);
adapter_->CreateRfcommService(
- BluetoothUUID(FakeBluetoothProfileManagerClient::kRfcommUuid),
+ BluetoothUUID(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid),
BluetoothAdapter::ServiceOptions(),
base::Bind(&BluetoothSocketChromeOSTest::CreateServiceSuccessCallback,
base::Unretained(this)),
diff --git a/chromeos/dbus/bluetooth_adapter_client.cc b/device/bluetooth/dbus/bluetooth_adapter_client.cc
index 741dc03..26081ea 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
diff --git a/chromeos/dbus/bluetooth_adapter_client.h b/device/bluetooth/dbus/bluetooth_adapter_client.h
index 4530127..5a024eb 100644
--- a/chromeos/dbus/bluetooth_adapter_client.h
+++ b/device/bluetooth/dbus/bluetooth_adapter_client.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_DBUS_BLUETOOTH_ADAPTER_CLIENT_H_
-#define CHROMEOS_DBUS_BLUETOOTH_ADAPTER_CLIENT_H_
+#ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_ADAPTER_CLIENT_H_
+#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_ADAPTER_CLIENT_H_
#include <string>
#include <vector>
@@ -11,16 +11,16 @@
#include "base/callback.h"
#include "base/observer_list.h"
#include "base/values.h"
-#include "chromeos/chromeos_export.h"
-#include "chromeos/dbus/dbus_client.h"
#include "dbus/object_path.h"
#include "dbus/property.h"
+#include "device/bluetooth/bluetooth_export.h"
+#include "device/bluetooth/dbus/bluez_dbus_client.h"
-namespace chromeos {
+namespace bluez {
// BluetoothAdapterClient is used to communicate with objects representing
// local Bluetooth Adapters.
-class CHROMEOS_EXPORT BluetoothAdapterClient : public DBusClient {
+class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterClient : public BluezDBusClient {
public:
// A DiscoveryFilter represents a filter passed to the SetDiscoveryFilter
// method.
@@ -84,7 +84,7 @@ class CHROMEOS_EXPORT BluetoothAdapterClient : public DBusClient {
// List of 128-bit UUIDs that represent the available local services.
// Read-only.
- dbus::Property<std::vector<std::string> > uuids;
+ dbus::Property<std::vector<std::string>> uuids;
// Local Device ID information in Linux kernel modalias format. Read-only.
dbus::Property<std::string> modalias;
@@ -179,6 +179,6 @@ class CHROMEOS_EXPORT BluetoothAdapterClient : public DBusClient {
DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterClient);
};
-} // namespace chromeos
+} // namespace bluez
-#endif // CHROMEOS_DBUS_BLUETOOTH_ADAPTER_CLIENT_H_
+#endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_ADAPTER_CLIENT_H_
diff --git a/chromeos/dbus/bluetooth_agent_manager_client.cc b/device/bluetooth/dbus/bluetooth_agent_manager_client.cc
index af7bb16..6caee9b 100644
--- a/chromeos/dbus/bluetooth_agent_manager_client.cc
+++ b/device/bluetooth/dbus/bluetooth_agent_manager_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_agent_manager_client.h"
+#include "device/bluetooth/dbus/bluetooth_agent_manager_client.h"
#include "base/bind.h"
#include "base/logging.h"
@@ -11,14 +11,13 @@
#include "dbus/object_proxy.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
-namespace chromeos {
+namespace bluez {
const char BluetoothAgentManagerClient::kNoResponseError[] =
"org.chromium.Error.NoResponse";
// The BluetoothAgentManagerClient implementation used in production.
-class BluetoothAgentManagerClientImpl
- : public BluetoothAgentManagerClient {
+class BluetoothAgentManagerClientImpl : public BluetoothAgentManagerClient {
public:
BluetoothAgentManagerClientImpl() : weak_ptr_factory_(this) {}
@@ -30,16 +29,15 @@ class BluetoothAgentManagerClientImpl
const base::Closure& callback,
const ErrorCallback& error_callback) override {
dbus::MethodCall method_call(
- bluetooth_agent_manager::kBluetoothAgentManagerInterface,
- bluetooth_agent_manager::kRegisterAgent);
+ bluetooth_agent_manager::kBluetoothAgentManagerInterface,
+ bluetooth_agent_manager::kRegisterAgent);
dbus::MessageWriter writer(&method_call);
writer.AppendObjectPath(agent_path);
writer.AppendString(capability);
object_proxy_->CallMethodWithErrorCallback(
- &method_call,
- dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
+ &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
base::Bind(&BluetoothAgentManagerClientImpl::OnSuccess,
weak_ptr_factory_.GetWeakPtr(), callback),
base::Bind(&BluetoothAgentManagerClientImpl::OnError,
@@ -58,15 +56,13 @@ class BluetoothAgentManagerClientImpl
writer.AppendObjectPath(agent_path);
object_proxy_->CallMethodWithErrorCallback(
- &method_call,
- dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
+ &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
base::Bind(&BluetoothAgentManagerClientImpl::OnSuccess,
weak_ptr_factory_.GetWeakPtr(), callback),
base::Bind(&BluetoothAgentManagerClientImpl::OnError,
weak_ptr_factory_.GetWeakPtr(), error_callback));
}
-
// BluetoothAgentManagerClient override.
void RequestDefaultAgent(const dbus::ObjectPath& agent_path,
const base::Closure& callback,
@@ -79,8 +75,7 @@ class BluetoothAgentManagerClientImpl
writer.AppendObjectPath(agent_path);
object_proxy_->CallMethodWithErrorCallback(
- &method_call,
- dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
+ &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
base::Bind(&BluetoothAgentManagerClientImpl::OnSuccess,
weak_ptr_factory_.GetWeakPtr(), callback),
base::Bind(&BluetoothAgentManagerClientImpl::OnError,
@@ -98,8 +93,7 @@ class BluetoothAgentManagerClientImpl
private:
// 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();
}
@@ -127,20 +121,17 @@ class BluetoothAgentManagerClientImpl
// 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<BluetoothAgentManagerClientImpl>
- weak_ptr_factory_;
+ base::WeakPtrFactory<BluetoothAgentManagerClientImpl> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(BluetoothAgentManagerClientImpl);
};
-BluetoothAgentManagerClient::BluetoothAgentManagerClient() {
-}
+BluetoothAgentManagerClient::BluetoothAgentManagerClient() {}
-BluetoothAgentManagerClient::~BluetoothAgentManagerClient() {
-}
+BluetoothAgentManagerClient::~BluetoothAgentManagerClient() {}
BluetoothAgentManagerClient* BluetoothAgentManagerClient::Create() {
return new BluetoothAgentManagerClientImpl();
}
-} // namespace chromeos
+} // namespace bluez
diff --git a/chromeos/dbus/bluetooth_agent_manager_client.h b/device/bluetooth/dbus/bluetooth_agent_manager_client.h
index f43f4f8..c43568a 100644
--- a/chromeos/dbus/bluetooth_agent_manager_client.h
+++ b/device/bluetooth/dbus/bluetooth_agent_manager_client.h
@@ -2,23 +2,24 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_DBUS_BLUETOOTH_AGENT_MANAGER_CLIENT_H_
-#define CHROMEOS_DBUS_BLUETOOTH_AGENT_MANAGER_CLIENT_H_
+#ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_AGENT_MANAGER_CLIENT_H_
+#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_AGENT_MANAGER_CLIENT_H_
#include <string>
#include <vector>
#include "base/callback.h"
#include "base/values.h"
-#include "chromeos/chromeos_export.h"
-#include "chromeos/dbus/dbus_client.h"
#include "dbus/object_path.h"
+#include "device/bluetooth/bluetooth_export.h"
+#include "device/bluetooth/dbus/bluez_dbus_client.h"
-namespace chromeos {
+namespace bluez {
// BluetoothAgentManagerClient is used to communicate with the agent manager
// object of the Bluetooth daemon.
-class CHROMEOS_EXPORT BluetoothAgentManagerClient : public DBusClient {
+class DEVICE_BLUETOOTH_EXPORT BluetoothAgentManagerClient
+ : public BluezDBusClient {
public:
~BluetoothAgentManagerClient() override;
@@ -63,6 +64,6 @@ class CHROMEOS_EXPORT BluetoothAgentManagerClient : public DBusClient {
DISALLOW_COPY_AND_ASSIGN(BluetoothAgentManagerClient);
};
-} // namespace chromeos
+} // namespace bluez
-#endif // CHROMEOS_DBUS_BLUETOOTH_AGENT_MANAGER_CLIENT_H_
+#endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_AGENT_MANAGER_CLIENT_H_
diff --git a/chromeos/dbus/bluetooth_agent_service_provider.cc b/device/bluetooth/dbus/bluetooth_agent_service_provider.cc
index 97eb273..7392f2b 100644
--- a/chromeos/dbus/bluetooth_agent_service_provider.cc
+++ b/device/bluetooth/dbus/bluetooth_agent_service_provider.cc
@@ -2,24 +2,22 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chromeos/dbus/bluetooth_agent_service_provider.h"
-
+#include "device/bluetooth/dbus/bluetooth_agent_service_provider.h"
#include "base/bind.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "base/threading/platform_thread.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/fake_bluetooth_agent_service_provider.h"
#include "dbus/exported_object.h"
#include "dbus/message.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
+#include "device/bluetooth/dbus/fake_bluetooth_agent_service_provider.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
-namespace chromeos {
+namespace bluez {
// The BluetoothAgentServiceProvider implementation used in production.
-class BluetoothAgentServiceProviderImpl
- : public BluetoothAgentServiceProvider {
+class BluetoothAgentServiceProviderImpl : public BluetoothAgentServiceProvider {
public:
BluetoothAgentServiceProviderImpl(dbus::Bus* bus,
const dbus::ObjectPath& object_path,
@@ -34,8 +32,7 @@ class BluetoothAgentServiceProviderImpl
exported_object_ = bus_->GetExportedObject(object_path_);
exported_object_->ExportMethod(
- bluetooth_agent::kBluetoothAgentInterface,
- bluetooth_agent::kRelease,
+ bluetooth_agent::kBluetoothAgentInterface, bluetooth_agent::kRelease,
base::Bind(&BluetoothAgentServiceProviderImpl::Release,
weak_ptr_factory_.GetWeakPtr()),
base::Bind(&BluetoothAgentServiceProviderImpl::OnExported,
@@ -98,8 +95,7 @@ class BluetoothAgentServiceProviderImpl
weak_ptr_factory_.GetWeakPtr()));
exported_object_->ExportMethod(
- bluetooth_agent::kBluetoothAgentInterface,
- bluetooth_agent::kCancel,
+ bluetooth_agent::kBluetoothAgentInterface, bluetooth_agent::kCancel,
base::Bind(&BluetoothAgentServiceProviderImpl::Cancel,
weak_ptr_factory_.GetWeakPtr()),
base::Bind(&BluetoothAgentServiceProviderImpl::OnExported,
@@ -148,9 +144,7 @@ class BluetoothAgentServiceProviderImpl
Delegate::PinCodeCallback callback = base::Bind(
&BluetoothAgentServiceProviderImpl::OnPinCode,
- weak_ptr_factory_.GetWeakPtr(),
- method_call,
- response_sender);
+ weak_ptr_factory_.GetWeakPtr(), method_call, response_sender);
delegate_->RequestPinCode(device_path, callback);
}
@@ -166,8 +160,7 @@ class BluetoothAgentServiceProviderImpl
dbus::MessageReader reader(method_call);
dbus::ObjectPath device_path;
std::string pincode;
- if (!reader.PopObjectPath(&device_path) ||
- !reader.PopString(&pincode)) {
+ if (!reader.PopObjectPath(&device_path) || !reader.PopString(&pincode)) {
LOG(WARNING) << "DisplayPinCode called with incorrect paramters: "
<< method_call->ToString();
return;
@@ -195,9 +188,7 @@ class BluetoothAgentServiceProviderImpl
Delegate::PasskeyCallback callback = base::Bind(
&BluetoothAgentServiceProviderImpl::OnPasskey,
- weak_ptr_factory_.GetWeakPtr(),
- method_call,
- response_sender);
+ weak_ptr_factory_.GetWeakPtr(), method_call, response_sender);
delegate_->RequestPasskey(device_path, callback);
}
@@ -214,8 +205,7 @@ class BluetoothAgentServiceProviderImpl
dbus::ObjectPath device_path;
uint32 passkey;
uint16 entered;
- if (!reader.PopObjectPath(&device_path) ||
- !reader.PopUint32(&passkey) ||
+ if (!reader.PopObjectPath(&device_path) || !reader.PopUint32(&passkey) ||
!reader.PopUint16(&entered)) {
LOG(WARNING) << "DisplayPasskey called with incorrect paramters: "
<< method_call->ToString();
@@ -239,8 +229,7 @@ class BluetoothAgentServiceProviderImpl
dbus::MessageReader reader(method_call);
dbus::ObjectPath device_path;
uint32 passkey;
- if (!reader.PopObjectPath(&device_path) ||
- !reader.PopUint32(&passkey)) {
+ if (!reader.PopObjectPath(&device_path) || !reader.PopUint32(&passkey)) {
LOG(WARNING) << "RequestConfirmation called with incorrect paramters: "
<< method_call->ToString();
return;
@@ -248,9 +237,7 @@ class BluetoothAgentServiceProviderImpl
Delegate::ConfirmationCallback callback = base::Bind(
&BluetoothAgentServiceProviderImpl::OnConfirmation,
- weak_ptr_factory_.GetWeakPtr(),
- method_call,
- response_sender);
+ weak_ptr_factory_.GetWeakPtr(), method_call, response_sender);
delegate_->RequestConfirmation(device_path, passkey, callback);
}
@@ -258,8 +245,8 @@ class BluetoothAgentServiceProviderImpl
// Called by dbus:: when the Bluetooth daemon requires that the user
// confirm an incoming just-works pairing.
void RequestAuthorization(
- dbus::MethodCall* method_call,
- dbus::ExportedObject::ResponseSender response_sender) {
+ dbus::MethodCall* method_call,
+ dbus::ExportedObject::ResponseSender response_sender) {
DCHECK(OnOriginThread());
DCHECK(delegate_);
@@ -273,9 +260,7 @@ class BluetoothAgentServiceProviderImpl
Delegate::ConfirmationCallback callback = base::Bind(
&BluetoothAgentServiceProviderImpl::OnConfirmation,
- weak_ptr_factory_.GetWeakPtr(),
- method_call,
- response_sender);
+ weak_ptr_factory_.GetWeakPtr(), method_call, response_sender);
delegate_->RequestAuthorization(device_path, callback);
}
@@ -291,8 +276,7 @@ class BluetoothAgentServiceProviderImpl
dbus::MessageReader reader(method_call);
dbus::ObjectPath device_path;
std::string uuid;
- if (!reader.PopObjectPath(&device_path) ||
- !reader.PopString(&uuid)) {
+ if (!reader.PopObjectPath(&device_path) || !reader.PopString(&uuid)) {
LOG(WARNING) << "AuthorizeService called with incorrect paramters: "
<< method_call->ToString();
return;
@@ -300,9 +284,7 @@ class BluetoothAgentServiceProviderImpl
Delegate::ConfirmationCallback callback = base::Bind(
&BluetoothAgentServiceProviderImpl::OnConfirmation,
- weak_ptr_factory_.GetWeakPtr(),
- method_call,
- response_sender);
+ weak_ptr_factory_.GetWeakPtr(), method_call, response_sender);
delegate_->AuthorizeService(device_path, uuid, callback);
}
@@ -323,8 +305,8 @@ class BluetoothAgentServiceProviderImpl
void OnExported(const std::string& interface_name,
const std::string& method_name,
bool success) {
- LOG_IF(WARNING, !success) << "Failed to export "
- << interface_name << "." << method_name;
+ LOG_IF(WARNING, !success) << "Failed to export " << interface_name << "."
+ << method_name;
}
// Called by the Delegate to response to a method requesting a PIN code.
@@ -443,22 +425,20 @@ class BluetoothAgentServiceProviderImpl
DISALLOW_COPY_AND_ASSIGN(BluetoothAgentServiceProviderImpl);
};
-BluetoothAgentServiceProvider::BluetoothAgentServiceProvider() {
-}
+BluetoothAgentServiceProvider::BluetoothAgentServiceProvider() {}
-BluetoothAgentServiceProvider::~BluetoothAgentServiceProvider() {
-}
+BluetoothAgentServiceProvider::~BluetoothAgentServiceProvider() {}
// static
BluetoothAgentServiceProvider* BluetoothAgentServiceProvider::Create(
dbus::Bus* bus,
const dbus::ObjectPath& object_path,
Delegate* delegate) {
- if (!DBusThreadManager::Get()->IsUsingStub(DBusClientBundle::BLUETOOTH)) {
+ if (!bluez::BluezDBusManager::Get()->IsUsingStub()) {
return new BluetoothAgentServiceProviderImpl(bus, object_path, delegate);
} else {
return new FakeBluetoothAgentServiceProvider(object_path, delegate);
}
}
-} // namespace chromeos
+} // namespace bluez
diff --git a/chromeos/dbus/bluetooth_agent_service_provider.h b/device/bluetooth/dbus/bluetooth_agent_service_provider.h
index 411cc1d..e31ef8f 100644
--- a/chromeos/dbus/bluetooth_agent_service_provider.h
+++ b/device/bluetooth/dbus/bluetooth_agent_service_provider.h
@@ -2,18 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_DBUS_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_
-#define CHROMEOS_DBUS_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_
+#ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_
+#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_
#include <string>
#include "base/basictypes.h"
#include "base/callback.h"
-#include "chromeos/chromeos_export.h"
#include "dbus/bus.h"
#include "dbus/object_path.h"
+#include "device/bluetooth/bluetooth_export.h"
-namespace chromeos {
+namespace bluez {
// BluetoothAgentServiceProvider is used to provide a D-Bus object that
// the bluetooth daemon can communicate with during a remote device pairing
@@ -28,7 +28,7 @@ namespace chromeos {
// make calls to this agent object and they will be passed on to your Delegate
// object for handling. Responses should be returned using the callbacks
// supplied to those methods.
-class CHROMEOS_EXPORT BluetoothAgentServiceProvider {
+class DEVICE_BLUETOOTH_EXPORT BluetoothAgentServiceProvider {
public:
// Interface for reacting to agent requests.
class Delegate {
@@ -40,11 +40,7 @@ class CHROMEOS_EXPORT BluetoothAgentServiceProvider {
// granted; rejected indicates the user rejected the request or denied
// permission; cancelled indicates the user cancelled the request
// without confirming either way.
- enum Status {
- SUCCESS,
- REJECTED,
- CANCELLED
- };
+ enum Status { SUCCESS, REJECTED, CANCELLED };
// The PinCodeCallback is used for the RequestPinCode() method, it should
// be called with two arguments, the |status| of the request (success,
@@ -117,7 +113,8 @@ class CHROMEOS_EXPORT BluetoothAgentServiceProvider {
// As the user enters the passkey onto the device, |entered| will be
// updated to reflect the number of digits entered so far.
virtual void DisplayPasskey(const dbus::ObjectPath& device_path,
- uint32 passkey, uint16 entered) = 0;
+ uint32 passkey,
+ uint16 entered) = 0;
// This method will be called when the Bluetooth daemon requires that the
// user confirm that the Passkey |passkey| is displayed on the screen
@@ -176,6 +173,6 @@ class CHROMEOS_EXPORT BluetoothAgentServiceProvider {
DISALLOW_COPY_AND_ASSIGN(BluetoothAgentServiceProvider);
};
-} // namespace chromeos
+} // namespace bluez
-#endif // CHROMEOS_DBUS_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_
+#endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_
diff --git a/device/bluetooth/dbus/bluetooth_dbus_client_bundle.cc b/device/bluetooth/dbus/bluetooth_dbus_client_bundle.cc
new file mode 100644
index 0000000..29a4ce8
--- /dev/null
+++ b/device/bluetooth/dbus/bluetooth_dbus_client_bundle.cc
@@ -0,0 +1,84 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "device/bluetooth/dbus/bluetooth_dbus_client_bundle.h"
+
+#include <vector>
+
+#include "base/command_line.h"
+#include "base/strings/string_split.h"
+#include "base/strings/string_util.h"
+#include "chromeos/chromeos_switches.h"
+#include "device/bluetooth/dbus/bluetooth_adapter_client.h"
+#include "device/bluetooth/dbus/bluetooth_agent_manager_client.h"
+#include "device/bluetooth/dbus/bluetooth_device_client.h"
+#include "device/bluetooth/dbus/bluetooth_gatt_characteristic_client.h"
+#include "device/bluetooth/dbus/bluetooth_gatt_descriptor_client.h"
+#include "device/bluetooth/dbus/bluetooth_gatt_manager_client.h"
+#include "device/bluetooth/dbus/bluetooth_gatt_service_client.h"
+#include "device/bluetooth/dbus/bluetooth_input_client.h"
+#include "device/bluetooth/dbus/bluetooth_le_advertising_manager_client.h"
+#include "device/bluetooth/dbus/bluetooth_media_client.h"
+#include "device/bluetooth/dbus/bluetooth_media_transport_client.h"
+#include "device/bluetooth/dbus/bluetooth_profile_manager_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_adapter_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_agent_manager_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_device_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_gatt_service_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_input_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_le_advertising_manager_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_media_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_media_transport_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_profile_manager_client.h"
+
+namespace bluez {
+
+BluetoothDBusClientBundle::BluetoothDBusClientBundle(bool use_stubs)
+ : use_stubs_(use_stubs) {
+ if (!use_stubs) {
+ bluetooth_adapter_client_.reset(BluetoothAdapterClient::Create());
+ bluetooth_le_advertising_manager_client_.reset(
+ BluetoothLEAdvertisingManagerClient::Create());
+ bluetooth_agent_manager_client_.reset(
+ BluetoothAgentManagerClient::Create());
+ bluetooth_device_client_.reset(BluetoothDeviceClient::Create());
+ bluetooth_input_client_.reset(BluetoothInputClient::Create());
+ bluetooth_media_client_.reset(BluetoothMediaClient::Create());
+ bluetooth_media_transport_client_.reset(
+ BluetoothMediaTransportClient::Create());
+ bluetooth_profile_manager_client_.reset(
+ BluetoothProfileManagerClient::Create());
+ bluetooth_gatt_characteristic_client_.reset(
+ BluetoothGattCharacteristicClient::Create());
+ bluetooth_gatt_descriptor_client_.reset(
+ BluetoothGattDescriptorClient::Create());
+ bluetooth_gatt_manager_client_.reset(BluetoothGattManagerClient::Create());
+ bluetooth_gatt_service_client_.reset(BluetoothGattServiceClient::Create());
+ } else {
+ bluetooth_adapter_client_.reset(new FakeBluetoothAdapterClient);
+ bluetooth_le_advertising_manager_client_.reset(
+ new FakeBluetoothLEAdvertisingManagerClient);
+ bluetooth_agent_manager_client_.reset(new FakeBluetoothAgentManagerClient);
+ bluetooth_device_client_.reset(new FakeBluetoothDeviceClient);
+ bluetooth_input_client_.reset(new FakeBluetoothInputClient);
+ bluetooth_media_client_.reset(new FakeBluetoothMediaClient);
+ bluetooth_media_transport_client_.reset(
+ new FakeBluetoothMediaTransportClient);
+ bluetooth_profile_manager_client_.reset(
+ new FakeBluetoothProfileManagerClient);
+ bluetooth_gatt_characteristic_client_.reset(
+ new FakeBluetoothGattCharacteristicClient);
+ bluetooth_gatt_descriptor_client_.reset(
+ new FakeBluetoothGattDescriptorClient);
+ bluetooth_gatt_manager_client_.reset(new FakeBluetoothGattManagerClient);
+ bluetooth_gatt_service_client_.reset(new FakeBluetoothGattServiceClient);
+ }
+}
+
+BluetoothDBusClientBundle::~BluetoothDBusClientBundle() {}
+
+} // namespace bluez
diff --git a/device/bluetooth/dbus/bluetooth_dbus_client_bundle.h b/device/bluetooth/dbus/bluetooth_dbus_client_bundle.h
new file mode 100644
index 0000000..bc1a63c
--- /dev/null
+++ b/device/bluetooth/dbus/bluetooth_dbus_client_bundle.h
@@ -0,0 +1,113 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_DBUS_CLIENT_BUNDLE_H_
+#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_DBUS_CLIENT_BUNDLE_H_
+
+#include <string>
+
+#include "base/memory/scoped_ptr.h"
+#include "device/bluetooth/bluetooth_export.h"
+
+namespace bluez {
+
+class BluetoothAdapterClient;
+class BluetoothAgentManagerClient;
+class BluetoothDeviceClient;
+class BluetoothGattCharacteristicClient;
+class BluetoothGattDescriptorClient;
+class BluetoothGattManagerClient;
+class BluetoothGattServiceClient;
+class BluetoothInputClient;
+class BluetoothLEAdvertisingManagerClient;
+class BluetoothMediaClient;
+class BluetoothMediaTransportClient;
+class BluetoothProfileManagerClient;
+
+// The bundle of all D-Bus clients used in DBusThreadManager. The bundle
+// is used to delete them at once in the right order before shutting down the
+// system bus. See also the comment in the destructor of DBusThreadManager.
+class DEVICE_BLUETOOTH_EXPORT BluetoothDBusClientBundle {
+ public:
+ explicit BluetoothDBusClientBundle(bool use_stubs);
+ ~BluetoothDBusClientBundle();
+
+ // Returns true if |client| is stubbed.
+ bool IsUsingStub() { return use_stubs_; }
+
+ BluetoothAdapterClient* bluetooth_adapter_client() {
+ return bluetooth_adapter_client_.get();
+ }
+
+ BluetoothLEAdvertisingManagerClient*
+ bluetooth_le_advertising_manager_client() {
+ return bluetooth_le_advertising_manager_client_.get();
+ }
+
+ BluetoothAgentManagerClient* bluetooth_agent_manager_client() {
+ return bluetooth_agent_manager_client_.get();
+ }
+
+ BluetoothDeviceClient* bluetooth_device_client() {
+ return bluetooth_device_client_.get();
+ }
+
+ BluetoothGattCharacteristicClient* bluetooth_gatt_characteristic_client() {
+ return bluetooth_gatt_characteristic_client_.get();
+ }
+
+ BluetoothGattDescriptorClient* bluetooth_gatt_descriptor_client() {
+ return bluetooth_gatt_descriptor_client_.get();
+ }
+
+ BluetoothGattManagerClient* bluetooth_gatt_manager_client() {
+ return bluetooth_gatt_manager_client_.get();
+ }
+
+ BluetoothGattServiceClient* bluetooth_gatt_service_client() {
+ return bluetooth_gatt_service_client_.get();
+ }
+
+ BluetoothInputClient* bluetooth_input_client() {
+ return bluetooth_input_client_.get();
+ }
+
+ BluetoothMediaClient* bluetooth_media_client() {
+ return bluetooth_media_client_.get();
+ }
+
+ BluetoothMediaTransportClient* bluetooth_media_transport_client() {
+ return bluetooth_media_transport_client_.get();
+ }
+
+ BluetoothProfileManagerClient* bluetooth_profile_manager_client() {
+ return bluetooth_profile_manager_client_.get();
+ }
+
+ private:
+ friend class BluezDBusManagerSetter;
+
+ bool use_stubs_;
+
+ scoped_ptr<BluetoothAdapterClient> bluetooth_adapter_client_;
+ scoped_ptr<BluetoothLEAdvertisingManagerClient>
+ bluetooth_le_advertising_manager_client_;
+ scoped_ptr<BluetoothAgentManagerClient> bluetooth_agent_manager_client_;
+ scoped_ptr<BluetoothDeviceClient> bluetooth_device_client_;
+ scoped_ptr<BluetoothGattCharacteristicClient>
+ bluetooth_gatt_characteristic_client_;
+ scoped_ptr<BluetoothGattDescriptorClient> bluetooth_gatt_descriptor_client_;
+ scoped_ptr<BluetoothGattManagerClient> bluetooth_gatt_manager_client_;
+ scoped_ptr<BluetoothGattServiceClient> bluetooth_gatt_service_client_;
+ scoped_ptr<BluetoothInputClient> bluetooth_input_client_;
+ scoped_ptr<BluetoothMediaClient> bluetooth_media_client_;
+ scoped_ptr<BluetoothMediaTransportClient> bluetooth_media_transport_client_;
+ scoped_ptr<BluetoothProfileManagerClient> bluetooth_profile_manager_client_;
+
+ DISALLOW_COPY_AND_ASSIGN(BluetoothDBusClientBundle);
+};
+
+} // namespace bluez
+
+#endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_DBUS_CLIENT_BUNDLE_H_
diff --git a/chromeos/dbus/bluetooth_device_client.cc b/device/bluetooth/dbus/bluetooth_device_client.cc
index 02a5c6b..65059c6 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
diff --git a/chromeos/dbus/bluetooth_device_client.h b/device/bluetooth/dbus/bluetooth_device_client.h
index 4a0d6b4..b0991dc 100644
--- a/chromeos/dbus/bluetooth_device_client.h
+++ b/device/bluetooth/dbus/bluetooth_device_client.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_DBUS_BLUETOOTH_DEVICE_CLIENT_H_
-#define CHROMEOS_DBUS_BLUETOOTH_DEVICE_CLIENT_H_
+#ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_DEVICE_CLIENT_H_
+#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_DEVICE_CLIENT_H_
#include <string>
#include <vector>
@@ -11,16 +11,16 @@
#include "base/callback.h"
#include "base/observer_list.h"
#include "base/values.h"
-#include "chromeos/chromeos_export.h"
-#include "chromeos/dbus/dbus_client.h"
#include "dbus/object_path.h"
#include "dbus/property.h"
+#include "device/bluetooth/bluetooth_export.h"
+#include "device/bluetooth/dbus/bluez_dbus_client.h"
-namespace chromeos {
+namespace bluez {
// BluetoothDeviceClient is used to communicate with objects representing
// remote Bluetooth Devices.
-class CHROMEOS_EXPORT BluetoothDeviceClient : public DBusClient {
+class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceClient : public BluezDBusClient {
public:
// Structure of properties associated with bluetooth devices.
struct Properties : public dbus::PropertySet {
@@ -46,7 +46,7 @@ class CHROMEOS_EXPORT BluetoothDeviceClient : public DBusClient {
// List of 128-bit UUIDs that represent the available remote services.
// Read-only.
- dbus::Property<std::vector<std::string> > uuids;
+ dbus::Property<std::vector<std::string>> uuids;
// Transmitted power level. This field is avaliable only for LE devices
// that include this field in AD. Read-only.
@@ -201,6 +201,6 @@ class CHROMEOS_EXPORT BluetoothDeviceClient : public DBusClient {
DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceClient);
};
-} // namespace chromeos
+} // namespace bluez
-#endif // CHROMEOS_DBUS_BLUETOOTH_DEVICE_CLIENT_H_
+#endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_DEVICE_CLIENT_H_
diff --git a/chromeos/dbus/bluetooth_gatt_characteristic_client.cc b/device/bluetooth/dbus/bluetooth_gatt_characteristic_client.cc
index 5e48601..6000a52 100644
--- a/chromeos/dbus/bluetooth_gatt_characteristic_client.cc
+++ b/device/bluetooth/dbus/bluetooth_gatt_characteristic_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_characteristic_client.h"
+#include "device/bluetooth/dbus/bluetooth_gatt_characteristic_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 {
@@ -42,8 +42,7 @@ BluetoothGattCharacteristicClient::Properties::Properties(
&descriptors);
}
-BluetoothGattCharacteristicClient::Properties::~Properties() {
-}
+BluetoothGattCharacteristicClient::Properties::~Properties() {}
// The BluetoothGattCharacteristicClient implementation used in production.
class BluetoothGattCharacteristicClientImpl
@@ -51,9 +50,7 @@ class BluetoothGattCharacteristicClientImpl
public dbus::ObjectManager::Interface {
public:
BluetoothGattCharacteristicClientImpl()
- : object_manager_(NULL),
- weak_ptr_factory_(this) {
- }
+ : object_manager_(NULL), weak_ptr_factory_(this) {}
~BluetoothGattCharacteristicClientImpl() override {
object_manager_->UnregisterInterface(
@@ -84,11 +81,9 @@ class BluetoothGattCharacteristicClientImpl
// BluetoothGattCharacteristicClient override.
Properties* GetProperties(const dbus::ObjectPath& object_path) override {
DCHECK(object_manager_);
- return static_cast<Properties*>(
- object_manager_->GetProperties(
- object_path,
- bluetooth_gatt_characteristic::
- kBluetoothGattCharacteristicInterface));
+ return static_cast<Properties*>(object_manager_->GetProperties(
+ object_path,
+ bluetooth_gatt_characteristic::kBluetoothGattCharacteristicInterface));
}
// BluetoothGattCharacteristicClient override.
@@ -107,14 +102,11 @@ class BluetoothGattCharacteristicClientImpl
bluetooth_gatt_characteristic::kReadValue);
object_proxy->CallMethodWithErrorCallback(
- &method_call,
- dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
+ &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
base::Bind(&BluetoothGattCharacteristicClientImpl::OnValueSuccess,
- weak_ptr_factory_.GetWeakPtr(),
- callback),
+ weak_ptr_factory_.GetWeakPtr(), callback),
base::Bind(&BluetoothGattCharacteristicClientImpl::OnError,
- weak_ptr_factory_.GetWeakPtr(),
- error_callback));
+ weak_ptr_factory_.GetWeakPtr(), error_callback));
}
// BluetoothGattCharacteristicClient override.
@@ -136,14 +128,11 @@ class BluetoothGattCharacteristicClientImpl
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(&BluetoothGattCharacteristicClientImpl::OnSuccess,
- weak_ptr_factory_.GetWeakPtr(),
- callback),
+ weak_ptr_factory_.GetWeakPtr(), callback),
base::Bind(&BluetoothGattCharacteristicClientImpl::OnError,
- weak_ptr_factory_.GetWeakPtr(),
- error_callback));
+ weak_ptr_factory_.GetWeakPtr(), error_callback));
}
// BluetoothGattCharacteristicClient override.
@@ -162,14 +151,11 @@ class BluetoothGattCharacteristicClientImpl
bluetooth_gatt_characteristic::kStartNotify);
object_proxy->CallMethodWithErrorCallback(
- &method_call,
- dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
+ &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
base::Bind(&BluetoothGattCharacteristicClientImpl::OnSuccess,
- weak_ptr_factory_.GetWeakPtr(),
- callback),
+ weak_ptr_factory_.GetWeakPtr(), callback),
base::Bind(&BluetoothGattCharacteristicClientImpl::OnError,
- weak_ptr_factory_.GetWeakPtr(),
- error_callback));
+ weak_ptr_factory_.GetWeakPtr(), error_callback));
}
// BluetoothGattCharacteristicClient override.
@@ -188,14 +174,11 @@ class BluetoothGattCharacteristicClientImpl
bluetooth_gatt_characteristic::kStopNotify);
object_proxy->CallMethodWithErrorCallback(
- &method_call,
- dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
+ &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
base::Bind(&BluetoothGattCharacteristicClientImpl::OnSuccess,
- weak_ptr_factory_.GetWeakPtr(),
- callback),
+ weak_ptr_factory_.GetWeakPtr(), callback),
base::Bind(&BluetoothGattCharacteristicClientImpl::OnError,
- weak_ptr_factory_.GetWeakPtr(),
- error_callback));
+ weak_ptr_factory_.GetWeakPtr(), error_callback));
}
// dbus::ObjectManager::Interface override.
@@ -204,11 +187,9 @@ class BluetoothGattCharacteristicClientImpl
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(&BluetoothGattCharacteristicClientImpl::OnPropertyChanged,
- weak_ptr_factory_.GetWeakPtr(),
- object_path));
+ weak_ptr_factory_.GetWeakPtr(), object_path));
return static_cast<dbus::PropertySet*>(properties);
}
@@ -248,9 +229,9 @@ class BluetoothGattCharacteristicClientImpl
const std::string& property_name) {
VLOG(2) << "Remote GATT characteristic property changed: "
<< object_path.value() << ": " << property_name;
- FOR_EACH_OBSERVER(BluetoothGattCharacteristicClient::Observer, observers_,
- GattCharacteristicPropertyChanged(object_path,
- property_name));
+ FOR_EACH_OBSERVER(
+ BluetoothGattCharacteristicClient::Observer, observers_,
+ GattCharacteristicPropertyChanged(object_path, property_name));
}
// Called when a response for successful method call is received.
@@ -305,21 +286,18 @@ class BluetoothGattCharacteristicClientImpl
// 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<BluetoothGattCharacteristicClientImpl>
- weak_ptr_factory_;
+ base::WeakPtrFactory<BluetoothGattCharacteristicClientImpl> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(BluetoothGattCharacteristicClientImpl);
};
-BluetoothGattCharacteristicClient::BluetoothGattCharacteristicClient() {
-}
+BluetoothGattCharacteristicClient::BluetoothGattCharacteristicClient() {}
-BluetoothGattCharacteristicClient::~BluetoothGattCharacteristicClient() {
-}
+BluetoothGattCharacteristicClient::~BluetoothGattCharacteristicClient() {}
// static
BluetoothGattCharacteristicClient* BluetoothGattCharacteristicClient::Create() {
return new BluetoothGattCharacteristicClientImpl();
}
-} // namespace chromeos
+} // namespace bluez
diff --git a/chromeos/dbus/bluetooth_gatt_characteristic_client.h b/device/bluetooth/dbus/bluetooth_gatt_characteristic_client.h
index b040b56..3c476eb 100644
--- a/chromeos/dbus/bluetooth_gatt_characteristic_client.h
+++ b/device/bluetooth/dbus/bluetooth_gatt_characteristic_client.h
@@ -2,24 +2,25 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_CLIENT_H_
-#define CHROMEOS_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_CLIENT_H_
+#ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_CLIENT_H_
+#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_CLIENT_H_
#include <string>
#include <vector>
#include "base/basictypes.h"
#include "base/callback.h"
-#include "chromeos/chromeos_export.h"
-#include "chromeos/dbus/dbus_client.h"
#include "dbus/object_path.h"
#include "dbus/property.h"
+#include "device/bluetooth/bluetooth_export.h"
+#include "device/bluetooth/dbus/bluez_dbus_client.h"
-namespace chromeos {
+namespace bluez {
// BluetoothGattCharacteristicClient is used to communicate with remote GATT
// characteristic objects exposed by the Bluetooth daemon.
-class CHROMEOS_EXPORT BluetoothGattCharacteristicClient : public DBusClient {
+class DEVICE_BLUETOOTH_EXPORT BluetoothGattCharacteristicClient
+ : public BluezDBusClient {
public:
// Structure of properties associated with GATT characteristics.
struct Properties : public dbus::PropertySet {
@@ -138,6 +139,6 @@ class CHROMEOS_EXPORT BluetoothGattCharacteristicClient : public DBusClient {
DISALLOW_COPY_AND_ASSIGN(BluetoothGattCharacteristicClient);
};
-} // namespace chromeos
+} // namespace bluez
-#endif // CHROMEOS_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_CLIENT_H_
+#endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_CLIENT_H_
diff --git a/chromeos/dbus/bluetooth_gatt_characteristic_service_provider.cc b/device/bluetooth/dbus/bluetooth_gatt_characteristic_service_provider.cc
index 545880a..4decdf0 100644
--- a/chromeos/dbus/bluetooth_gatt_characteristic_service_provider.cc
+++ b/device/bluetooth/dbus/bluetooth_gatt_characteristic_service_provider.cc
@@ -2,27 +2,25 @@
// 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_characteristic_service_provider.h"
+#include "device/bluetooth/dbus/bluetooth_gatt_characteristic_service_provider.h"
#include "base/bind.h"
#include "base/logging.h"
#include "base/memory/weak_ptr.h"
#include "base/strings/string_util.h"
#include "base/threading/platform_thread.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/fake_bluetooth_gatt_characteristic_service_provider.h"
#include "dbus/exported_object.h"
#include "dbus/message.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
+#include "device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
-namespace chromeos {
+namespace bluez {
namespace {
-const char kErrorInvalidArgs[] =
- "org.freedesktop.DBus.Error.InvalidArgs";
+const char kErrorInvalidArgs[] = "org.freedesktop.DBus.Error.InvalidArgs";
const char kErrorPropertyReadOnly[] =
"org.freedesktop.DBus.Error.PropertyReadOnly";
-const char kErrorFailed[] =
- "org.freedesktop.DBus.Error.Failed";
+const char kErrorFailed[] = "org.freedesktop.DBus.Error.Failed";
} // namespace
// The BluetoothGattCharacteristicServiceProvider implementation used in
@@ -52,31 +50,27 @@ class BluetoothGattCharacteristicServiceProviderImpl
DCHECK(!uuid_.empty());
DCHECK(object_path_.IsValid());
DCHECK(service_path_.IsValid());
- DCHECK(base::StartsWith(object_path_.value(),
- service_path_.value() + "/",
+ DCHECK(base::StartsWith(object_path_.value(), service_path_.value() + "/",
base::CompareCase::SENSITIVE));
exported_object_ = bus_->GetExportedObject(object_path_);
exported_object_->ExportMethod(
- dbus::kDBusPropertiesInterface,
- dbus::kDBusPropertiesGet,
+ dbus::kDBusPropertiesInterface, dbus::kDBusPropertiesGet,
base::Bind(&BluetoothGattCharacteristicServiceProviderImpl::Get,
weak_ptr_factory_.GetWeakPtr()),
base::Bind(&BluetoothGattCharacteristicServiceProviderImpl::OnExported,
weak_ptr_factory_.GetWeakPtr()));
exported_object_->ExportMethod(
- dbus::kDBusPropertiesInterface,
- dbus::kDBusPropertiesSet,
+ dbus::kDBusPropertiesInterface, dbus::kDBusPropertiesSet,
base::Bind(&BluetoothGattCharacteristicServiceProviderImpl::Set,
weak_ptr_factory_.GetWeakPtr()),
base::Bind(&BluetoothGattCharacteristicServiceProviderImpl::OnExported,
weak_ptr_factory_.GetWeakPtr()));
exported_object_->ExportMethod(
- dbus::kDBusPropertiesInterface,
- dbus::kDBusPropertiesGetAll,
+ dbus::kDBusPropertiesInterface, dbus::kDBusPropertiesGetAll,
base::Bind(&BluetoothGattCharacteristicServiceProviderImpl::GetAll,
weak_ptr_factory_.GetWeakPtr()),
base::Bind(&BluetoothGattCharacteristicServiceProviderImpl::OnExported,
@@ -92,9 +86,8 @@ class BluetoothGattCharacteristicServiceProviderImpl
// BluetoothGattCharacteristicServiceProvider override.
void SendValueChanged(const std::vector<uint8>& value) override {
VLOG(2) << "Emitting a PropertiesChanged signal for characteristic value.";
- dbus::Signal signal(
- dbus::kDBusPropertiesInterface,
- dbus::kDBusPropertiesChangedSignal);
+ dbus::Signal signal(dbus::kDBusPropertiesInterface,
+ dbus::kDBusPropertiesChangedSignal);
dbus::MessageWriter writer(&signal);
dbus::MessageWriter array_writer(NULL);
dbus::MessageWriter dict_entry_writer(NULL);
@@ -141,11 +134,10 @@ class BluetoothGattCharacteristicServiceProviderImpl
std::string interface_name;
std::string property_name;
if (!reader.PopString(&interface_name) ||
- !reader.PopString(&property_name) ||
- reader.HasMoreData()) {
+ !reader.PopString(&property_name) || reader.HasMoreData()) {
scoped_ptr<dbus::ErrorResponse> error_response =
- dbus::ErrorResponse::FromMethodCall(
- method_call, kErrorInvalidArgs, "Expected 'ss'.");
+ dbus::ErrorResponse::FromMethodCall(method_call, kErrorInvalidArgs,
+ "Expected 'ss'.");
response_sender.Run(error_response.Pass());
return;
}
@@ -166,11 +158,11 @@ class BluetoothGattCharacteristicServiceProviderImpl
DCHECK(delegate_);
delegate_->GetCharacteristicValue(
base::Bind(&BluetoothGattCharacteristicServiceProviderImpl::OnGet,
- weak_ptr_factory_.GetWeakPtr(),
- method_call, response_sender),
+ weak_ptr_factory_.GetWeakPtr(), method_call,
+ response_sender),
base::Bind(&BluetoothGattCharacteristicServiceProviderImpl::OnFailure,
- weak_ptr_factory_.GetWeakPtr(),
- method_call, response_sender));
+ weak_ptr_factory_.GetWeakPtr(), method_call,
+ response_sender));
return;
}
@@ -191,8 +183,7 @@ class BluetoothGattCharacteristicServiceProviderImpl
writer.CloseContainer(&variant_writer);
} else {
response = dbus::ErrorResponse::FromMethodCall(
- method_call,
- kErrorInvalidArgs,
+ method_call, kErrorInvalidArgs,
"No such property: '" + property_name + "'.");
}
@@ -214,11 +205,10 @@ class BluetoothGattCharacteristicServiceProviderImpl
dbus::MessageReader variant_reader(NULL);
if (!reader.PopString(&interface_name) ||
!reader.PopString(&property_name) ||
- !reader.PopVariant(&variant_reader) ||
- reader.HasMoreData()) {
+ !reader.PopVariant(&variant_reader) || reader.HasMoreData()) {
scoped_ptr<dbus::ErrorResponse> error_response =
- dbus::ErrorResponse::FromMethodCall(
- method_call, kErrorInvalidArgs, "Expected 'ssv'.");
+ dbus::ErrorResponse::FromMethodCall(method_call, kErrorInvalidArgs,
+ "Expected 'ssv'.");
response_sender.Run(error_response.Pass());
return;
}
@@ -247,8 +237,8 @@ class BluetoothGattCharacteristicServiceProviderImpl
error_message = "No such property: '" + property_name + "'.";
}
scoped_ptr<dbus::ErrorResponse> error_response =
- dbus::ErrorResponse::FromMethodCall(
- method_call, error_name, error_message);
+ dbus::ErrorResponse::FromMethodCall(method_call, error_name,
+ error_message);
response_sender.Run(error_response.Pass());
return;
}
@@ -271,11 +261,11 @@ class BluetoothGattCharacteristicServiceProviderImpl
delegate_->SetCharacteristicValue(
value,
base::Bind(&BluetoothGattCharacteristicServiceProviderImpl::OnSet,
- weak_ptr_factory_.GetWeakPtr(),
- method_call, response_sender),
+ weak_ptr_factory_.GetWeakPtr(), method_call,
+ response_sender),
base::Bind(&BluetoothGattCharacteristicServiceProviderImpl::OnFailure,
- weak_ptr_factory_.GetWeakPtr(),
- method_call, response_sender));
+ weak_ptr_factory_.GetWeakPtr(), method_call,
+ response_sender));
}
// Called by dbus:: when the Bluetooth daemon fetches all properties of the
@@ -291,8 +281,8 @@ class BluetoothGattCharacteristicServiceProviderImpl
std::string interface_name;
if (!reader.PopString(&interface_name) || reader.HasMoreData()) {
scoped_ptr<dbus::ErrorResponse> error_response =
- dbus::ErrorResponse::FromMethodCall(
- method_call, kErrorInvalidArgs, "Expected 's'.");
+ dbus::ErrorResponse::FromMethodCall(method_call, kErrorInvalidArgs,
+ "Expected 's'.");
response_sender.Run(error_response.Pass());
return;
}
@@ -313,19 +303,19 @@ class BluetoothGattCharacteristicServiceProviderImpl
DCHECK(delegate_);
delegate_->GetCharacteristicValue(
base::Bind(&BluetoothGattCharacteristicServiceProviderImpl::OnGetAll,
- weak_ptr_factory_.GetWeakPtr(),
- method_call, response_sender),
+ weak_ptr_factory_.GetWeakPtr(), method_call,
+ response_sender),
base::Bind(&BluetoothGattCharacteristicServiceProviderImpl::OnFailure,
- weak_ptr_factory_.GetWeakPtr(),
- method_call, response_sender));
+ weak_ptr_factory_.GetWeakPtr(), method_call,
+ response_sender));
}
// Called by dbus:: when a method is exported.
void OnExported(const std::string& interface_name,
const std::string& method_name,
bool success) {
- LOG_IF(WARNING, !success) << "Failed to export "
- << interface_name << "." << method_name;
+ LOG_IF(WARNING, !success) << "Failed to export " << interface_name << "."
+ << method_name;
}
// Called by the Delegate in response to a method to call to get all
@@ -448,24 +438,22 @@ class BluetoothGattCharacteristicServiceProviderImpl
};
BluetoothGattCharacteristicServiceProvider::
- BluetoothGattCharacteristicServiceProvider() {
-}
+ BluetoothGattCharacteristicServiceProvider() {}
BluetoothGattCharacteristicServiceProvider::
- ~BluetoothGattCharacteristicServiceProvider() {
-}
+ ~BluetoothGattCharacteristicServiceProvider() {}
// static
BluetoothGattCharacteristicServiceProvider*
BluetoothGattCharacteristicServiceProvider::Create(
- dbus::Bus* bus,
- const dbus::ObjectPath& object_path,
- Delegate* delegate,
- const std::string& uuid,
- const std::vector<std::string>& flags,
- const std::vector<std::string>& permissions,
- const dbus::ObjectPath& service_path) {
- if (!DBusThreadManager::Get()->IsUsingStub(DBusClientBundle::BLUETOOTH)) {
+ dbus::Bus* bus,
+ const dbus::ObjectPath& object_path,
+ Delegate* delegate,
+ const std::string& uuid,
+ const std::vector<std::string>& flags,
+ const std::vector<std::string>& permissions,
+ const dbus::ObjectPath& service_path) {
+ if (!bluez::BluezDBusManager::Get()->IsUsingStub()) {
return new BluetoothGattCharacteristicServiceProviderImpl(
bus, object_path, delegate, uuid, flags, permissions, service_path);
}
@@ -473,4 +461,4 @@ BluetoothGattCharacteristicServiceProvider::Create(
object_path, delegate, uuid, flags, permissions, service_path);
}
-} // namespace chromeos
+} // namespace bluez
diff --git a/chromeos/dbus/bluetooth_gatt_characteristic_service_provider.h b/device/bluetooth/dbus/bluetooth_gatt_characteristic_service_provider.h
index 174a908..ad5d999 100644
--- a/chromeos/dbus/bluetooth_gatt_characteristic_service_provider.h
+++ b/device/bluetooth/dbus/bluetooth_gatt_characteristic_service_provider.h
@@ -2,19 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_H_
-#define CHROMEOS_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_H_
+#ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_H_
+#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_H_
#include <string>
#include <vector>
#include "base/basictypes.h"
#include "base/callback.h"
-#include "chromeos/chromeos_export.h"
#include "dbus/bus.h"
#include "dbus/object_path.h"
+#include "device/bluetooth/bluetooth_export.h"
-namespace chromeos {
+namespace bluez {
// BluetoothGattCharacteristicServiceProvider is used to provide a D-Bus object
// that represents a local GATT characteristic that the Bluetooth daemon can
@@ -30,7 +30,7 @@ namespace chromeos {
// mandatory during initialization. In addition, a "SendValueChanged" method is
// provided, which emits a DBus.Properties.PropertyChanged signal for the
// "Value" property.
-class CHROMEOS_EXPORT BluetoothGattCharacteristicServiceProvider {
+class DEVICE_BLUETOOTH_EXPORT BluetoothGattCharacteristicServiceProvider {
public:
// Interface for reacting to GATT characteristic value requests.
class Delegate {
@@ -108,6 +108,6 @@ class CHROMEOS_EXPORT BluetoothGattCharacteristicServiceProvider {
DISALLOW_COPY_AND_ASSIGN(BluetoothGattCharacteristicServiceProvider);
};
-} // namespace chromeos
+} // namespace bluez
-#endif // CHROMEOS_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_H_
+#endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_H_
diff --git a/chromeos/dbus/bluetooth_gatt_descriptor_client.cc b/device/bluetooth/dbus/bluetooth_gatt_descriptor_client.cc
index 86d38ff..f3ba343 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
diff --git a/chromeos/dbus/bluetooth_gatt_descriptor_client.h b/device/bluetooth/dbus/bluetooth_gatt_descriptor_client.h
index 15d3d9c..364331e 100644
--- a/chromeos/dbus/bluetooth_gatt_descriptor_client.h
+++ b/device/bluetooth/dbus/bluetooth_gatt_descriptor_client.h
@@ -2,24 +2,25 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_DBUS_BLUETOOTH_GATT_DESCRIPTOR_CLIENT_H_
-#define CHROMEOS_DBUS_BLUETOOTH_GATT_DESCRIPTOR_CLIENT_H_
+#ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_DESCRIPTOR_CLIENT_H_
+#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_DESCRIPTOR_CLIENT_H_
#include <string>
#include <vector>
#include "base/basictypes.h"
#include "base/callback.h"
-#include "chromeos/chromeos_export.h"
-#include "chromeos/dbus/dbus_client.h"
#include "dbus/object_path.h"
#include "dbus/property.h"
+#include "device/bluetooth/bluetooth_export.h"
+#include "device/bluetooth/dbus/bluez_dbus_client.h"
-namespace chromeos {
+namespace bluez {
// BluetoothGattDescriptorClient is used to communicate with remote GATT
// characteristic descriptor objects exposed by the Bluetooth daemon.
-class CHROMEOS_EXPORT BluetoothGattDescriptorClient : public DBusClient {
+class DEVICE_BLUETOOTH_EXPORT BluetoothGattDescriptorClient
+ : public BluezDBusClient {
public:
// Structure of properties associated with GATT descriptors.
struct Properties : public dbus::PropertySet {
@@ -110,6 +111,6 @@ class CHROMEOS_EXPORT BluetoothGattDescriptorClient : public DBusClient {
DISALLOW_COPY_AND_ASSIGN(BluetoothGattDescriptorClient);
};
-} // namespace chromeos
+} // namespace bluez
-#endif // CHROMEOS_DBUS_BLUETOOTH_GATT_DESCRIPTOR_CLIENT_H_
+#endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_DESCRIPTOR_CLIENT_H_
diff --git a/chromeos/dbus/bluetooth_gatt_descriptor_service_provider.cc b/device/bluetooth/dbus/bluetooth_gatt_descriptor_service_provider.cc
index 3ed39b9..e4aa245 100644
--- a/chromeos/dbus/bluetooth_gatt_descriptor_service_provider.cc
+++ b/device/bluetooth/dbus/bluetooth_gatt_descriptor_service_provider.cc
@@ -2,27 +2,25 @@
// 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_service_provider.h"
+#include "device/bluetooth/dbus/bluetooth_gatt_descriptor_service_provider.h"
#include "base/bind.h"
#include "base/logging.h"
#include "base/memory/weak_ptr.h"
#include "base/strings/string_util.h"
#include "base/threading/platform_thread.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/fake_bluetooth_gatt_descriptor_service_provider.h"
#include "dbus/exported_object.h"
#include "dbus/message.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
+#include "device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_service_provider.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
-namespace chromeos {
+namespace bluez {
namespace {
-const char kErrorInvalidArgs[] =
- "org.freedesktop.DBus.Error.InvalidArgs";
+const char kErrorInvalidArgs[] = "org.freedesktop.DBus.Error.InvalidArgs";
const char kErrorPropertyReadOnly[] =
"org.freedesktop.DBus.Error.PropertyReadOnly";
-const char kErrorFailed[] =
- "org.freedesktop.DBus.Error.Failed";
+const char kErrorFailed[] = "org.freedesktop.DBus.Error.Failed";
} // namespace
// The BluetoothGattDescriptorServiceProvider implementation used in production.
@@ -57,24 +55,21 @@ class BluetoothGattDescriptorServiceProviderImpl
exported_object_ = bus_->GetExportedObject(object_path_);
exported_object_->ExportMethod(
- dbus::kDBusPropertiesInterface,
- dbus::kDBusPropertiesGet,
+ dbus::kDBusPropertiesInterface, dbus::kDBusPropertiesGet,
base::Bind(&BluetoothGattDescriptorServiceProviderImpl::Get,
weak_ptr_factory_.GetWeakPtr()),
base::Bind(&BluetoothGattDescriptorServiceProviderImpl::OnExported,
weak_ptr_factory_.GetWeakPtr()));
exported_object_->ExportMethod(
- dbus::kDBusPropertiesInterface,
- dbus::kDBusPropertiesSet,
+ dbus::kDBusPropertiesInterface, dbus::kDBusPropertiesSet,
base::Bind(&BluetoothGattDescriptorServiceProviderImpl::Set,
weak_ptr_factory_.GetWeakPtr()),
base::Bind(&BluetoothGattDescriptorServiceProviderImpl::OnExported,
weak_ptr_factory_.GetWeakPtr()));
exported_object_->ExportMethod(
- dbus::kDBusPropertiesInterface,
- dbus::kDBusPropertiesGetAll,
+ dbus::kDBusPropertiesInterface, dbus::kDBusPropertiesGetAll,
base::Bind(&BluetoothGattDescriptorServiceProviderImpl::GetAll,
weak_ptr_factory_.GetWeakPtr()),
base::Bind(&BluetoothGattDescriptorServiceProviderImpl::OnExported,
@@ -90,9 +85,8 @@ class BluetoothGattDescriptorServiceProviderImpl
// BluetoothGattDescriptorServiceProvider override.
void SendValueChanged(const std::vector<uint8>& value) override {
VLOG(2) << "Emitting a PropertiesChanged signal for descriptor value.";
- dbus::Signal signal(
- dbus::kDBusPropertiesInterface,
- dbus::kDBusPropertiesChangedSignal);
+ dbus::Signal signal(dbus::kDBusPropertiesInterface,
+ dbus::kDBusPropertiesChangedSignal);
dbus::MessageWriter writer(&signal);
dbus::MessageWriter array_writer(NULL);
dbus::MessageWriter dict_entry_writer(NULL);
@@ -138,11 +132,10 @@ class BluetoothGattDescriptorServiceProviderImpl
std::string interface_name;
std::string property_name;
if (!reader.PopString(&interface_name) ||
- !reader.PopString(&property_name) ||
- reader.HasMoreData()) {
+ !reader.PopString(&property_name) || reader.HasMoreData()) {
scoped_ptr<dbus::ErrorResponse> error_response =
- dbus::ErrorResponse::FromMethodCall(
- method_call, kErrorInvalidArgs, "Expected 'ss'.");
+ dbus::ErrorResponse::FromMethodCall(method_call, kErrorInvalidArgs,
+ "Expected 'ss'.");
response_sender.Run(error_response.Pass());
return;
}
@@ -163,11 +156,11 @@ class BluetoothGattDescriptorServiceProviderImpl
DCHECK(delegate_);
delegate_->GetDescriptorValue(
base::Bind(&BluetoothGattDescriptorServiceProviderImpl::OnGet,
- weak_ptr_factory_.GetWeakPtr(),
- method_call, response_sender),
+ weak_ptr_factory_.GetWeakPtr(), method_call,
+ response_sender),
base::Bind(&BluetoothGattDescriptorServiceProviderImpl::OnFailure,
- weak_ptr_factory_.GetWeakPtr(),
- method_call, response_sender));
+ weak_ptr_factory_.GetWeakPtr(), method_call,
+ response_sender));
return;
}
@@ -188,8 +181,7 @@ class BluetoothGattDescriptorServiceProviderImpl
writer.CloseContainer(&variant_writer);
} else {
response = dbus::ErrorResponse::FromMethodCall(
- method_call,
- kErrorInvalidArgs,
+ method_call, kErrorInvalidArgs,
"No such property: '" + property_name + "'.");
}
@@ -211,11 +203,10 @@ class BluetoothGattDescriptorServiceProviderImpl
dbus::MessageReader variant_reader(NULL);
if (!reader.PopString(&interface_name) ||
!reader.PopString(&property_name) ||
- !reader.PopVariant(&variant_reader) ||
- reader.HasMoreData()) {
+ !reader.PopVariant(&variant_reader) || reader.HasMoreData()) {
scoped_ptr<dbus::ErrorResponse> error_response =
- dbus::ErrorResponse::FromMethodCall(
- method_call, kErrorInvalidArgs, "Expected 'ssv'.");
+ dbus::ErrorResponse::FromMethodCall(method_call, kErrorInvalidArgs,
+ "Expected 'ssv'.");
response_sender.Run(error_response.Pass());
return;
}
@@ -244,8 +235,8 @@ class BluetoothGattDescriptorServiceProviderImpl
error_message = "No such property: '" + property_name + "'.";
}
scoped_ptr<dbus::ErrorResponse> error_response =
- dbus::ErrorResponse::FromMethodCall(
- method_call, error_name, error_message);
+ dbus::ErrorResponse::FromMethodCall(method_call, error_name,
+ error_message);
response_sender.Run(error_response.Pass());
return;
}
@@ -266,13 +257,12 @@ class BluetoothGattDescriptorServiceProviderImpl
std::vector<uint8> value(bytes, bytes + length);
DCHECK(delegate_);
delegate_->SetDescriptorValue(
- value,
- base::Bind(&BluetoothGattDescriptorServiceProviderImpl::OnSet,
- weak_ptr_factory_.GetWeakPtr(),
- method_call, response_sender),
+ value, base::Bind(&BluetoothGattDescriptorServiceProviderImpl::OnSet,
+ weak_ptr_factory_.GetWeakPtr(), method_call,
+ response_sender),
base::Bind(&BluetoothGattDescriptorServiceProviderImpl::OnFailure,
- weak_ptr_factory_.GetWeakPtr(),
- method_call, response_sender));
+ weak_ptr_factory_.GetWeakPtr(), method_call,
+ response_sender));
}
// Called by dbus:: when the Bluetooth daemon fetches all properties of the
@@ -288,8 +278,8 @@ class BluetoothGattDescriptorServiceProviderImpl
std::string interface_name;
if (!reader.PopString(&interface_name) || reader.HasMoreData()) {
scoped_ptr<dbus::ErrorResponse> error_response =
- dbus::ErrorResponse::FromMethodCall(
- method_call, kErrorInvalidArgs, "Expected 's'.");
+ dbus::ErrorResponse::FromMethodCall(method_call, kErrorInvalidArgs,
+ "Expected 's'.");
response_sender.Run(error_response.Pass());
return;
}
@@ -310,19 +300,19 @@ class BluetoothGattDescriptorServiceProviderImpl
DCHECK(delegate_);
delegate_->GetDescriptorValue(
base::Bind(&BluetoothGattDescriptorServiceProviderImpl::OnGetAll,
- weak_ptr_factory_.GetWeakPtr(),
- method_call, response_sender),
+ weak_ptr_factory_.GetWeakPtr(), method_call,
+ response_sender),
base::Bind(&BluetoothGattDescriptorServiceProviderImpl::OnFailure,
- weak_ptr_factory_.GetWeakPtr(),
- method_call, response_sender));
+ weak_ptr_factory_.GetWeakPtr(), method_call,
+ response_sender));
}
// Called by dbus:: when a method is exported.
void OnExported(const std::string& interface_name,
const std::string& method_name,
bool success) {
- LOG_IF(WARNING, !success) << "Failed to export "
- << interface_name << "." << method_name;
+ LOG_IF(WARNING, !success) << "Failed to export " << interface_name << "."
+ << method_name;
}
// Called by the Delegate in response to a method to call to get all
@@ -344,8 +334,7 @@ class BluetoothGattDescriptorServiceProviderImpl
writer.OpenArray("{sv}", &array_writer);
array_writer.OpenDictEntry(&dict_entry_writer);
- dict_entry_writer.AppendString(
- bluetooth_gatt_descriptor::kUUIDProperty);
+ dict_entry_writer.AppendString(bluetooth_gatt_descriptor::kUUIDProperty);
dict_entry_writer.AppendVariantOfString(uuid_);
array_writer.CloseContainer(&dict_entry_writer);
@@ -356,8 +345,7 @@ class BluetoothGattDescriptorServiceProviderImpl
array_writer.CloseContainer(&dict_entry_writer);
array_writer.OpenDictEntry(&dict_entry_writer);
- dict_entry_writer.AppendString(
- bluetooth_gatt_descriptor::kValueProperty);
+ dict_entry_writer.AppendString(bluetooth_gatt_descriptor::kValueProperty);
dict_entry_writer.OpenVariant("ay", &variant_writer);
variant_writer.AppendArrayOfBytes(value.data(), value.size());
dict_entry_writer.CloseContainer(&variant_writer);
@@ -403,8 +391,7 @@ class BluetoothGattDescriptorServiceProviderImpl
VLOG(2) << "Failed to get/set descriptor value. Report error.";
scoped_ptr<dbus::ErrorResponse> error_response =
dbus::ErrorResponse::FromMethodCall(
- method_call, kErrorFailed,
- "Failed to get/set descriptor value.");
+ method_call, kErrorFailed, "Failed to get/set descriptor value.");
response_sender.Run(error_response.Pass());
}
@@ -445,12 +432,10 @@ class BluetoothGattDescriptorServiceProviderImpl
};
BluetoothGattDescriptorServiceProvider::
- BluetoothGattDescriptorServiceProvider() {
-}
+ BluetoothGattDescriptorServiceProvider() {}
BluetoothGattDescriptorServiceProvider::
- ~BluetoothGattDescriptorServiceProvider() {
-}
+ ~BluetoothGattDescriptorServiceProvider() {}
// static
BluetoothGattDescriptorServiceProvider*
@@ -461,7 +446,7 @@ BluetoothGattDescriptorServiceProvider::Create(
const std::string& uuid,
const std::vector<std::string>& permissions,
const dbus::ObjectPath& characteristic_path) {
- if (!DBusThreadManager::Get()->IsUsingStub(DBusClientBundle::BLUETOOTH)) {
+ if (!bluez::BluezDBusManager::Get()->IsUsingStub()) {
return new BluetoothGattDescriptorServiceProviderImpl(
bus, object_path, delegate, uuid, permissions, characteristic_path);
}
@@ -469,4 +454,4 @@ BluetoothGattDescriptorServiceProvider::Create(
object_path, delegate, uuid, permissions, characteristic_path);
}
-} // namespace chromeos
+} // namespace bluez
diff --git a/chromeos/dbus/bluetooth_gatt_descriptor_service_provider.h b/device/bluetooth/dbus/bluetooth_gatt_descriptor_service_provider.h
index 4b5fef8..e4925ff 100644
--- a/chromeos/dbus/bluetooth_gatt_descriptor_service_provider.h
+++ b/device/bluetooth/dbus/bluetooth_gatt_descriptor_service_provider.h
@@ -2,19 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_DBUS_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_H_
-#define CHROMEOS_DBUS_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_H_
+#ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_H_
+#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_H_
#include <string>
#include <vector>
#include "base/basictypes.h"
#include "base/callback.h"
-#include "chromeos/chromeos_export.h"
#include "dbus/bus.h"
#include "dbus/object_path.h"
+#include "device/bluetooth/bluetooth_export.h"
-namespace chromeos {
+namespace bluez {
// BluetoothGattDescriptorServiceProvider is used to provide a D-Bus object that
// represents a local GATT characteristic descriptor that the Bluetooth daemon
@@ -30,7 +30,7 @@ namespace chromeos {
// mandatory during initialization. In addition, a "SendValueChanged" method is
// provided, which emits a DBus.Properties.PropertyChanged signal for the
// "Value" property.
-class CHROMEOS_EXPORT BluetoothGattDescriptorServiceProvider {
+class DEVICE_BLUETOOTH_EXPORT BluetoothGattDescriptorServiceProvider {
public:
// Interface for reacting to GATT characteristic descriptor value requests.
class Delegate {
@@ -104,6 +104,6 @@ class CHROMEOS_EXPORT BluetoothGattDescriptorServiceProvider {
DISALLOW_COPY_AND_ASSIGN(BluetoothGattDescriptorServiceProvider);
};
-} // namespace chromeos
+} // namespace bluez
-#endif // CHROMEOS_DBUS_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_H_
+#endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_H_
diff --git a/chromeos/dbus/bluetooth_gatt_manager_client.cc b/device/bluetooth/dbus/bluetooth_gatt_manager_client.cc
index 8ccbb69..7e471a5 100644
--- a/chromeos/dbus/bluetooth_gatt_manager_client.cc
+++ b/device/bluetooth/dbus/bluetooth_gatt_manager_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_manager_client.h"
+#include "device/bluetooth/dbus/bluetooth_gatt_manager_client.h"
#include "base/bind.h"
#include "base/memory/weak_ptr.h"
@@ -11,7 +11,7 @@
#include "dbus/object_proxy.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
-namespace chromeos {
+namespace bluez {
const char BluetoothGattManagerClient::kNoResponseError[] =
"org.chromium.Error.NoResponse";
@@ -20,9 +20,7 @@ const char BluetoothGattManagerClient::kNoResponseError[] =
class BluetoothGattManagerClientImpl : public BluetoothGattManagerClient {
public:
BluetoothGattManagerClientImpl()
- : object_proxy_(NULL),
- weak_ptr_factory_(this) {
- }
+ : object_proxy_(NULL), weak_ptr_factory_(this) {}
~BluetoothGattManagerClientImpl() override {}
@@ -47,8 +45,7 @@ class BluetoothGattManagerClientImpl : public BluetoothGattManagerClient {
DCHECK(object_proxy_);
object_proxy_->CallMethodWithErrorCallback(
- &method_call,
- dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
+ &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
base::Bind(&BluetoothGattManagerClientImpl::OnSuccess,
weak_ptr_factory_.GetWeakPtr(), callback),
base::Bind(&BluetoothGattManagerClientImpl::OnError,
@@ -68,8 +65,7 @@ class BluetoothGattManagerClientImpl : public BluetoothGattManagerClient {
DCHECK(object_proxy_);
object_proxy_->CallMethodWithErrorCallback(
- &method_call,
- dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
+ &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
base::Bind(&BluetoothGattManagerClientImpl::OnSuccess,
weak_ptr_factory_.GetWeakPtr(), callback),
base::Bind(&BluetoothGattManagerClientImpl::OnError,
@@ -121,15 +117,13 @@ class BluetoothGattManagerClientImpl : public BluetoothGattManagerClient {
DISALLOW_COPY_AND_ASSIGN(BluetoothGattManagerClientImpl);
};
-BluetoothGattManagerClient::BluetoothGattManagerClient() {
-}
+BluetoothGattManagerClient::BluetoothGattManagerClient() {}
-BluetoothGattManagerClient::~BluetoothGattManagerClient() {
-}
+BluetoothGattManagerClient::~BluetoothGattManagerClient() {}
// static
BluetoothGattManagerClient* BluetoothGattManagerClient::Create() {
return new BluetoothGattManagerClientImpl();
}
-} // namespace chromeos
+} // namespace bluez
diff --git a/chromeos/dbus/bluetooth_gatt_manager_client.h b/device/bluetooth/dbus/bluetooth_gatt_manager_client.h
index 155c2b5..3fab5c3 100644
--- a/chromeos/dbus/bluetooth_gatt_manager_client.h
+++ b/device/bluetooth/dbus/bluetooth_gatt_manager_client.h
@@ -2,24 +2,25 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_DBUS_BLUETOOTH_GATT_MANAGER_CLIENT_H_
-#define CHROMEOS_DBUS_BLUETOOTH_GATT_MANAGER_CLIENT_H_
+#ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_MANAGER_CLIENT_H_
+#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_MANAGER_CLIENT_H_
#include <string>
#include "base/callback.h"
-#include "chromeos/chromeos_export.h"
-#include "chromeos/dbus/dbus_client.h"
#include "dbus/object_path.h"
+#include "device/bluetooth/bluetooth_export.h"
+#include "device/bluetooth/dbus/bluez_dbus_client.h"
-namespace chromeos {
+namespace bluez {
// BluetoothGattManagerClient is used to communicate with the GATT Service
// manager object of the Bluetooth daemon.
-class CHROMEOS_EXPORT BluetoothGattManagerClient : public DBusClient {
+class DEVICE_BLUETOOTH_EXPORT BluetoothGattManagerClient
+ : public BluezDBusClient {
public:
// Options used to register a GATT service hierarchy.
- struct CHROMEOS_EXPORT Options {
+ struct DEVICE_BLUETOOTH_EXPORT Options {
// TODO(armansito): This parameter is not yet clearly defined. Add fields
// later as we know more about how this will be used.
};
@@ -67,6 +68,6 @@ class CHROMEOS_EXPORT BluetoothGattManagerClient : public DBusClient {
DISALLOW_COPY_AND_ASSIGN(BluetoothGattManagerClient);
};
-} // namespace chromeos
+} // namespace bluez
-#endif // CHROMEOS_DBUS_BLUETOOTH_GATT_MANAGER_CLIENT_H_
+#endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_MANAGER_CLIENT_H_
diff --git a/chromeos/dbus/bluetooth_gatt_service_client.cc b/device/bluetooth/dbus/bluetooth_gatt_service_client.cc
index 58266c1..dc3ef5a 100644
--- a/chromeos/dbus/bluetooth_gatt_service_client.cc
+++ b/device/bluetooth/dbus/bluetooth_gatt_service_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_service_client.h"
+#include "device/bluetooth/dbus/bluetooth_gatt_service_client.h"
#include "base/bind.h"
#include "base/memory/weak_ptr.h"
@@ -11,12 +11,12 @@
#include "dbus/object_manager.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
-namespace chromeos {
+namespace bluez {
BluetoothGattServiceClient::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_service::kUUIDProperty, &uuid);
RegisterProperty(bluetooth_gatt_service::kIncludesProperty, &includes);
@@ -26,17 +26,14 @@ BluetoothGattServiceClient::Properties::Properties(
&characteristics);
}
-BluetoothGattServiceClient::Properties::~Properties() {
-}
+BluetoothGattServiceClient::Properties::~Properties() {}
// The BluetoothGattServiceClient implementation used in production.
class BluetoothGattServiceClientImpl : public BluetoothGattServiceClient,
public dbus::ObjectManager::Interface {
public:
BluetoothGattServiceClientImpl()
- : object_manager_(NULL),
- weak_ptr_factory_(this) {
- }
+ : object_manager_(NULL), weak_ptr_factory_(this) {}
~BluetoothGattServiceClientImpl() override {
object_manager_->UnregisterInterface(
@@ -65,10 +62,8 @@ class BluetoothGattServiceClientImpl : public BluetoothGattServiceClient,
// BluetoothGattServiceClientImpl override.
Properties* GetProperties(const dbus::ObjectPath& object_path) override {
DCHECK(object_manager_);
- return static_cast<Properties*>(
- object_manager_->GetProperties(
- object_path,
- bluetooth_gatt_service::kBluetoothGattServiceInterface));
+ return static_cast<Properties*>(object_manager_->GetProperties(
+ object_path, bluetooth_gatt_service::kBluetoothGattServiceInterface));
}
// dbus::ObjectManager::Interface override.
@@ -77,11 +72,9 @@ class BluetoothGattServiceClientImpl : public BluetoothGattServiceClient,
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(&BluetoothGattServiceClientImpl::OnPropertyChanged,
- weak_ptr_factory_.GetWeakPtr(),
- object_path));
+ weak_ptr_factory_.GetWeakPtr(), object_path));
return static_cast<dbus::PropertySet*>(properties);
}
@@ -138,15 +131,13 @@ class BluetoothGattServiceClientImpl : public BluetoothGattServiceClient,
DISALLOW_COPY_AND_ASSIGN(BluetoothGattServiceClientImpl);
};
-BluetoothGattServiceClient::BluetoothGattServiceClient() {
-}
+BluetoothGattServiceClient::BluetoothGattServiceClient() {}
-BluetoothGattServiceClient::~BluetoothGattServiceClient() {
-}
+BluetoothGattServiceClient::~BluetoothGattServiceClient() {}
// static
BluetoothGattServiceClient* BluetoothGattServiceClient::Create() {
return new BluetoothGattServiceClientImpl();
}
-} // namespace chromeos
+} // namespace bluez
diff --git a/chromeos/dbus/bluetooth_gatt_service_client.h b/device/bluetooth/dbus/bluetooth_gatt_service_client.h
index 080ca8f..5828c50 100644
--- a/chromeos/dbus/bluetooth_gatt_service_client.h
+++ b/device/bluetooth/dbus/bluetooth_gatt_service_client.h
@@ -2,22 +2,23 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_DBUS_BLUETOOTH_GATT_SERVICE_CLIENT_H_
-#define CHROMEOS_DBUS_BLUETOOTH_GATT_SERVICE_CLIENT_H_
+#ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_SERVICE_CLIENT_H_
+#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_SERVICE_CLIENT_H_
#include <string>
#include <vector>
-#include "chromeos/chromeos_export.h"
-#include "chromeos/dbus/dbus_client.h"
#include "dbus/object_path.h"
#include "dbus/property.h"
+#include "device/bluetooth/bluetooth_export.h"
+#include "device/bluetooth/dbus/bluez_dbus_client.h"
-namespace chromeos {
+namespace bluez {
// BluetoothGattServiceClient is used to communicate with remote GATT service
// objects exposed by the Bluetooth daemon.
-class CHROMEOS_EXPORT BluetoothGattServiceClient : public DBusClient {
+class DEVICE_BLUETOOTH_EXPORT BluetoothGattServiceClient
+ : public BluezDBusClient {
public:
// Structure of properties associated with GATT services.
struct Properties : public dbus::PropertySet {
@@ -32,11 +33,11 @@ class CHROMEOS_EXPORT BluetoothGattServiceClient : public DBusClient {
// Array of object paths representing the characteristics of this service.
// [read-only]
- dbus::Property<std::vector<dbus::ObjectPath> > characteristics;
+ dbus::Property<std::vector<dbus::ObjectPath>> characteristics;
// Array of object paths representing the included services of this service.
// [read-only]
- dbus::Property<std::vector<dbus::ObjectPath> > includes;
+ dbus::Property<std::vector<dbus::ObjectPath>> includes;
Properties(dbus::ObjectProxy* object_proxy,
const std::string& interface_name,
@@ -88,6 +89,6 @@ class CHROMEOS_EXPORT BluetoothGattServiceClient : public DBusClient {
DISALLOW_COPY_AND_ASSIGN(BluetoothGattServiceClient);
};
-} // namespace chromeos
+} // namespace bluez
-#endif // CHROMEOS_DBUS_BLUETOOTH_GATT_SERVICE_CLIENT_H_
+#endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_SERVICE_CLIENT_H_
diff --git a/chromeos/dbus/bluetooth_gatt_service_service_provider.cc b/device/bluetooth/dbus/bluetooth_gatt_service_service_provider.cc
index 7aeed9b..06b6827 100644
--- a/chromeos/dbus/bluetooth_gatt_service_service_provider.cc
+++ b/device/bluetooth/dbus/bluetooth_gatt_service_service_provider.cc
@@ -2,23 +2,22 @@
// 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_service_service_provider.h"
+#include "device/bluetooth/dbus/bluetooth_gatt_service_service_provider.h"
#include "base/bind.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/threading/platform_thread.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/fake_bluetooth_gatt_service_service_provider.h"
#include "dbus/exported_object.h"
#include "dbus/message.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
+#include "device/bluetooth/dbus/fake_bluetooth_gatt_service_service_provider.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
-namespace chromeos {
+namespace bluez {
namespace {
-const char kErrorInvalidArgs[] =
- "org.freedesktop.DBus.Error.InvalidArgs";
+const char kErrorInvalidArgs[] = "org.freedesktop.DBus.Error.InvalidArgs";
const char kErrorPropertyReadOnly[] =
"org.freedesktop.DBus.Error.PropertyReadOnly";
} // namespace
@@ -47,24 +46,21 @@ class BluetoothGattServiceServiceProviderImpl
exported_object_ = bus_->GetExportedObject(object_path_);
exported_object_->ExportMethod(
- dbus::kDBusPropertiesInterface,
- dbus::kDBusPropertiesGet,
+ dbus::kDBusPropertiesInterface, dbus::kDBusPropertiesGet,
base::Bind(&BluetoothGattServiceServiceProviderImpl::Get,
weak_ptr_factory_.GetWeakPtr()),
base::Bind(&BluetoothGattServiceServiceProviderImpl::OnExported,
weak_ptr_factory_.GetWeakPtr()));
exported_object_->ExportMethod(
- dbus::kDBusPropertiesInterface,
- dbus::kDBusPropertiesSet,
+ dbus::kDBusPropertiesInterface, dbus::kDBusPropertiesSet,
base::Bind(&BluetoothGattServiceServiceProviderImpl::Set,
weak_ptr_factory_.GetWeakPtr()),
base::Bind(&BluetoothGattServiceServiceProviderImpl::OnExported,
weak_ptr_factory_.GetWeakPtr()));
exported_object_->ExportMethod(
- dbus::kDBusPropertiesInterface,
- dbus::kDBusPropertiesGetAll,
+ dbus::kDBusPropertiesInterface, dbus::kDBusPropertiesGetAll,
base::Bind(&BluetoothGattServiceServiceProviderImpl::GetAll,
weak_ptr_factory_.GetWeakPtr()),
base::Bind(&BluetoothGattServiceServiceProviderImpl::OnExported,
@@ -95,11 +91,10 @@ class BluetoothGattServiceServiceProviderImpl
std::string interface_name;
std::string property_name;
if (!reader.PopString(&interface_name) ||
- !reader.PopString(&property_name) ||
- reader.HasMoreData()) {
+ !reader.PopString(&property_name) || reader.HasMoreData()) {
scoped_ptr<dbus::ErrorResponse> error_response =
- dbus::ErrorResponse::FromMethodCall(
- method_call, kErrorInvalidArgs, "Expected 'ss'.");
+ dbus::ErrorResponse::FromMethodCall(method_call, kErrorInvalidArgs,
+ "Expected 'ss'.");
response_sender.Run(error_response.Pass());
return;
}
@@ -155,9 +150,8 @@ class BluetoothGattServiceServiceProviderImpl
// All of the properties on this interface are read-only, so just return
// error.
scoped_ptr<dbus::ErrorResponse> error_response =
- dbus::ErrorResponse::FromMethodCall(
- method_call, kErrorPropertyReadOnly,
- "All properties are read-only.");
+ dbus::ErrorResponse::FromMethodCall(method_call, kErrorPropertyReadOnly,
+ "All properties are read-only.");
response_sender.Run(error_response.Pass());
}
@@ -174,8 +168,8 @@ class BluetoothGattServiceServiceProviderImpl
std::string interface_name;
if (!reader.PopString(&interface_name) || reader.HasMoreData()) {
scoped_ptr<dbus::ErrorResponse> error_response =
- dbus::ErrorResponse::FromMethodCall(
- method_call, kErrorInvalidArgs, "Expected 's'.");
+ dbus::ErrorResponse::FromMethodCall(method_call, kErrorInvalidArgs,
+ "Expected 's'.");
response_sender.Run(error_response.Pass());
return;
}
@@ -221,8 +215,8 @@ class BluetoothGattServiceServiceProviderImpl
void OnExported(const std::string& interface_name,
const std::string& method_name,
bool success) {
- LOG_IF(WARNING, !success) << "Failed to export "
- << interface_name << "." << method_name;
+ LOG_IF(WARNING, !success) << "Failed to export " << interface_name << "."
+ << method_name;
}
// Origin thread (i.e. the UI thread in production).
@@ -256,11 +250,9 @@ class BluetoothGattServiceServiceProviderImpl
DISALLOW_COPY_AND_ASSIGN(BluetoothGattServiceServiceProviderImpl);
};
-BluetoothGattServiceServiceProvider::BluetoothGattServiceServiceProvider() {
-}
+BluetoothGattServiceServiceProvider::BluetoothGattServiceServiceProvider() {}
-BluetoothGattServiceServiceProvider::~BluetoothGattServiceServiceProvider() {
-}
+BluetoothGattServiceServiceProvider::~BluetoothGattServiceServiceProvider() {}
// static
BluetoothGattServiceServiceProvider*
@@ -269,12 +261,12 @@ BluetoothGattServiceServiceProvider::Create(
const dbus::ObjectPath& object_path,
const std::string& uuid,
const std::vector<dbus::ObjectPath>& includes) {
- if (!DBusThreadManager::Get()->IsUsingStub(DBusClientBundle::BLUETOOTH)) {
- return new BluetoothGattServiceServiceProviderImpl(
- bus, object_path, uuid, includes);
+ if (!bluez::BluezDBusManager::Get()->IsUsingStub()) {
+ return new BluetoothGattServiceServiceProviderImpl(bus, object_path, uuid,
+ includes);
}
- return new FakeBluetoothGattServiceServiceProvider(
- object_path, uuid, includes);
+ return new FakeBluetoothGattServiceServiceProvider(object_path, uuid,
+ includes);
}
-} // namespace chromeos
+} // namespace bluez
diff --git a/chromeos/dbus/bluetooth_gatt_service_service_provider.h b/device/bluetooth/dbus/bluetooth_gatt_service_service_provider.h
index 258c4b4..828f096 100644
--- a/chromeos/dbus/bluetooth_gatt_service_service_provider.h
+++ b/device/bluetooth/dbus/bluetooth_gatt_service_service_provider.h
@@ -2,17 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_DBUS_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_H_
-#define CHROMEOS_DBUS_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_H_
+#ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_H_
+#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_H_
#include <string>
#include <vector>
-#include "chromeos/chromeos_export.h"
#include "dbus/bus.h"
#include "dbus/object_path.h"
+#include "device/bluetooth/bluetooth_export.h"
-namespace chromeos {
+namespace bluez {
// BluetoothGattServiceServiceProvider is used to provide a D-Bus object that
// the Bluetooth daemon can communicate with to register GATT service
@@ -24,7 +24,7 @@ namespace chromeos {
// chromeos::BluetoothGattManagerClient::RegisterService method. Make sure to
// create characteristic and descriptor objects using the appropriate service
// providers before registering a GATT service with the Bluetooth daemon.
-class CHROMEOS_EXPORT BluetoothGattServiceServiceProvider {
+class DEVICE_BLUETOOTH_EXPORT BluetoothGattServiceServiceProvider {
public:
virtual ~BluetoothGattServiceServiceProvider();
@@ -47,6 +47,6 @@ class CHROMEOS_EXPORT BluetoothGattServiceServiceProvider {
DISALLOW_COPY_AND_ASSIGN(BluetoothGattServiceServiceProvider);
};
-} // namespace chromeos
+} // namespace bluez
-#endif // CHROMEOS_DBUS_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_H_
+#endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_H_
diff --git a/chromeos/dbus/bluetooth_input_client.cc b/device/bluetooth/dbus/bluetooth_input_client.cc
index 61ff6ed..42542a8 100644
--- a/chromeos/dbus/bluetooth_input_client.cc
+++ b/device/bluetooth/dbus/bluetooth_input_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_input_client.h"
+#include "device/bluetooth/dbus/bluetooth_input_client.h"
#include <map>
@@ -14,7 +14,7 @@
#include "dbus/object_proxy.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
-namespace chromeos {
+namespace bluez {
BluetoothInputClient::Properties::Properties(
dbus::ObjectProxy* object_proxy,
@@ -24,14 +24,11 @@ BluetoothInputClient::Properties::Properties(
RegisterProperty(bluetooth_input::kReconnectModeProperty, &reconnect_mode);
}
-BluetoothInputClient::Properties::~Properties() {
-}
-
+BluetoothInputClient::Properties::~Properties() {}
// The BluetoothInputClient implementation used in production.
-class BluetoothInputClientImpl
- : public BluetoothInputClient,
- public dbus::ObjectManager::Interface {
+class BluetoothInputClientImpl : public BluetoothInputClient,
+ public dbus::ObjectManager::Interface {
public:
BluetoothInputClientImpl() : object_manager_(NULL), weak_ptr_factory_(this) {}
@@ -57,21 +54,17 @@ class BluetoothInputClientImpl
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(&BluetoothInputClientImpl::OnPropertyChanged,
- weak_ptr_factory_.GetWeakPtr(),
- object_path));
+ Properties* properties =
+ new Properties(object_proxy, interface_name,
+ base::Bind(&BluetoothInputClientImpl::OnPropertyChanged,
+ weak_ptr_factory_.GetWeakPtr(), object_path));
return static_cast<dbus::PropertySet*>(properties);
}
// BluetoothInputClient override.
Properties* GetProperties(const dbus::ObjectPath& object_path) override {
- return static_cast<Properties*>(
- object_manager_->GetProperties(
- object_path,
- bluetooth_input::kBluetoothInputInterface));
+ return static_cast<Properties*>(object_manager_->GetProperties(
+ object_path, bluetooth_input::kBluetoothInputInterface));
}
protected:
@@ -124,14 +117,12 @@ class BluetoothInputClientImpl
DISALLOW_COPY_AND_ASSIGN(BluetoothInputClientImpl);
};
-BluetoothInputClient::BluetoothInputClient() {
-}
+BluetoothInputClient::BluetoothInputClient() {}
-BluetoothInputClient::~BluetoothInputClient() {
-}
+BluetoothInputClient::~BluetoothInputClient() {}
BluetoothInputClient* BluetoothInputClient::Create() {
return new BluetoothInputClientImpl();
}
-} // namespace chromeos
+} // namespace bluez
diff --git a/chromeos/dbus/bluetooth_input_client.h b/device/bluetooth/dbus/bluetooth_input_client.h
index 02abf99..0059506 100644
--- a/chromeos/dbus/bluetooth_input_client.h
+++ b/device/bluetooth/dbus/bluetooth_input_client.h
@@ -2,24 +2,24 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_DBUS_BLUETOOTH_INPUT_CLIENT_H_
-#define CHROMEOS_DBUS_BLUETOOTH_INPUT_CLIENT_H_
+#ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_INPUT_CLIENT_H_
+#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_INPUT_CLIENT_H_
#include <string>
#include <vector>
#include "base/callback.h"
#include "base/observer_list.h"
-#include "chromeos/chromeos_export.h"
-#include "chromeos/dbus/dbus_client.h"
#include "dbus/object_path.h"
#include "dbus/property.h"
+#include "device/bluetooth/bluetooth_export.h"
+#include "device/bluetooth/dbus/bluez_dbus_client.h"
-namespace chromeos {
+namespace bluez {
// BluetoothInputClient is used to communicate with objects representing
// Bluetooth Input (HID) devices.
-class CHROMEOS_EXPORT BluetoothInputClient : public DBusClient {
+class DEVICE_BLUETOOTH_EXPORT BluetoothInputClient : public BluezDBusClient {
public:
// Structure of properties associated with bluetooth input devices.
struct Properties : public dbus::PropertySet {
@@ -76,6 +76,6 @@ class CHROMEOS_EXPORT BluetoothInputClient : public DBusClient {
DISALLOW_COPY_AND_ASSIGN(BluetoothInputClient);
};
-} // namespace chromeos
+} // namespace bluez
-#endif // CHROMEOS_DBUS_BLUETOOTH_INPUT_CLIENT_H_
+#endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_INPUT_CLIENT_H_
diff --git a/chromeos/dbus/bluetooth_le_advertisement_service_provider.cc b/device/bluetooth/dbus/bluetooth_le_advertisement_service_provider.cc
index e598322..e981124 100644
--- a/chromeos/dbus/bluetooth_le_advertisement_service_provider.cc
+++ b/device/bluetooth/dbus/bluetooth_le_advertisement_service_provider.cc
@@ -2,20 +2,20 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chromeos/dbus/bluetooth_le_advertisement_service_provider.h"
+#include "device/bluetooth/dbus/bluetooth_le_advertisement_service_provider.h"
#include "base/bind.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "base/stl_util.h"
#include "base/threading/platform_thread.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/fake_bluetooth_le_advertisement_service_provider.h"
#include "dbus/exported_object.h"
#include "dbus/message.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
+#include "device/bluetooth/dbus/fake_bluetooth_le_advertisement_service_provider.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
-namespace chromeos {
+namespace bluez {
namespace {
const char kErrorInvalidArgs[] = "org.freedesktop.DBus.Error.InvalidArgs";
@@ -397,12 +397,10 @@ class BluetoothAdvertisementServiceProviderImpl
};
BluetoothLEAdvertisementServiceProvider::
- BluetoothLEAdvertisementServiceProvider() {
-}
+ BluetoothLEAdvertisementServiceProvider() {}
BluetoothLEAdvertisementServiceProvider::
- ~BluetoothLEAdvertisementServiceProvider() {
-}
+ ~BluetoothLEAdvertisementServiceProvider() {}
// static
scoped_ptr<BluetoothLEAdvertisementServiceProvider>
@@ -415,7 +413,7 @@ BluetoothLEAdvertisementServiceProvider::Create(
scoped_ptr<ManufacturerData> manufacturer_data,
scoped_ptr<UUIDList> solicit_uuids,
scoped_ptr<ServiceData> service_data) {
- if (!DBusThreadManager::Get()->IsUsingStub(DBusClientBundle::BLUETOOTH)) {
+ if (!bluez::BluezDBusManager::Get()->IsUsingStub()) {
return make_scoped_ptr(new BluetoothAdvertisementServiceProviderImpl(
bus, object_path, delegate, type, service_uuids.Pass(),
manufacturer_data.Pass(), solicit_uuids.Pass(), service_data.Pass()));
@@ -425,4 +423,4 @@ BluetoothLEAdvertisementServiceProvider::Create(
}
}
-} // namespace chromeos
+} // namespace bluez
diff --git a/chromeos/dbus/bluetooth_le_advertisement_service_provider.h b/device/bluetooth/dbus/bluetooth_le_advertisement_service_provider.h
index 98622a2..8f4692f 100644
--- a/chromeos/dbus/bluetooth_le_advertisement_service_provider.h
+++ b/device/bluetooth/dbus/bluetooth_le_advertisement_service_provider.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_DBUS_BLUETOOTH_LE_ADVERTISEMENT_SERVICE_PROVIDER_H_
-#define CHROMEOS_DBUS_BLUETOOTH_LE_ADVERTISEMENT_SERVICE_PROVIDER_H_
+#ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_LE_ADVERTISEMENT_SERVICE_PROVIDER_H_
+#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_LE_ADVERTISEMENT_SERVICE_PROVIDER_H_
#include <stdint.h>
@@ -14,16 +14,16 @@
#include "base/basictypes.h"
#include "base/callback.h"
#include "base/memory/scoped_ptr.h"
-#include "chromeos/chromeos_export.h"
#include "dbus/bus.h"
#include "dbus/file_descriptor.h"
#include "dbus/object_path.h"
+#include "device/bluetooth/bluetooth_export.h"
-namespace chromeos {
+namespace bluez {
// BluetoothAdvertisementServiceProvider is used to provide a D-Bus object that
// the Bluetooth daemon can communicate with to advertise data.
-class CHROMEOS_EXPORT BluetoothLEAdvertisementServiceProvider {
+class DEVICE_BLUETOOTH_EXPORT BluetoothLEAdvertisementServiceProvider {
public:
using UUIDList = std::vector<std::string>;
using ManufacturerData = std::map<uint16_t, std::vector<uint8_t>>;
@@ -77,6 +77,6 @@ class CHROMEOS_EXPORT BluetoothLEAdvertisementServiceProvider {
DISALLOW_COPY_AND_ASSIGN(BluetoothLEAdvertisementServiceProvider);
};
-} // namespace chromeos
+} // namespace bluez
-#endif // CHROMEOS_DBUS_BLUETOOTH_LE_ADVERTISEMENT_SERVICE_PROVIDER_H_
+#endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_LE_ADVERTISEMENT_SERVICE_PROVIDER_H_
diff --git a/chromeos/dbus/bluetooth_le_advertising_manager_client.cc b/device/bluetooth/dbus/bluetooth_le_advertising_manager_client.cc
index a2eedf9..3c934e6 100644
--- a/chromeos/dbus/bluetooth_le_advertising_manager_client.cc
+++ b/device/bluetooth/dbus/bluetooth_le_advertising_manager_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_le_advertising_manager_client.h"
+#include "device/bluetooth/dbus/bluetooth_le_advertising_manager_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 {
const char BluetoothLEAdvertisingManagerClient::kNoResponseError[] =
"org.chromium.Error.NoResponse";
@@ -175,15 +175,13 @@ class BluetoothAdvertisementManagerClientImpl
DISALLOW_COPY_AND_ASSIGN(BluetoothAdvertisementManagerClientImpl);
};
-BluetoothLEAdvertisingManagerClient::BluetoothLEAdvertisingManagerClient() {
-}
+BluetoothLEAdvertisingManagerClient::BluetoothLEAdvertisingManagerClient() {}
-BluetoothLEAdvertisingManagerClient::~BluetoothLEAdvertisingManagerClient() {
-}
+BluetoothLEAdvertisingManagerClient::~BluetoothLEAdvertisingManagerClient() {}
BluetoothLEAdvertisingManagerClient*
BluetoothLEAdvertisingManagerClient::Create() {
return new BluetoothAdvertisementManagerClientImpl();
}
-} // namespace chromeos
+} // namespace bluez
diff --git a/chromeos/dbus/bluetooth_le_advertising_manager_client.h b/device/bluetooth/dbus/bluetooth_le_advertising_manager_client.h
index 5160a9f..f4e7b34c 100644
--- a/chromeos/dbus/bluetooth_le_advertising_manager_client.h
+++ b/device/bluetooth/dbus/bluetooth_le_advertising_manager_client.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_DBUS_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_
-#define CHROMEOS_DBUS_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_
+#ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_
+#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_
#include <string>
#include <vector>
@@ -11,15 +11,16 @@
#include "base/callback.h"
#include "base/memory/scoped_ptr.h"
#include "base/values.h"
-#include "chromeos/chromeos_export.h"
-#include "chromeos/dbus/dbus_client.h"
#include "dbus/object_path.h"
+#include "device/bluetooth/bluetooth_export.h"
+#include "device/bluetooth/dbus/bluez_dbus_client.h"
-namespace chromeos {
+namespace bluez {
// BluetoothAdvertisingManagerClient is used to communicate with the advertising
// manager object of the BlueZ daemon.
-class CHROMEOS_EXPORT BluetoothLEAdvertisingManagerClient : public DBusClient {
+class DEVICE_BLUETOOTH_EXPORT BluetoothLEAdvertisingManagerClient
+ : public BluezDBusClient {
public:
// Interface for observing changes to advertising managers.
class Observer {
@@ -78,6 +79,6 @@ class CHROMEOS_EXPORT BluetoothLEAdvertisingManagerClient : public DBusClient {
DISALLOW_COPY_AND_ASSIGN(BluetoothLEAdvertisingManagerClient);
};
-} // namespace chromeos
+} // namespace bluez
-#endif // CHROMEOS_DBUS_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_
+#endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_
diff --git a/chromeos/dbus/bluetooth_media_client.cc b/device/bluetooth/dbus/bluetooth_media_client.cc
index 5922753..0927d45 100644
--- a/chromeos/dbus/bluetooth_media_client.cc
+++ b/device/bluetooth/dbus/bluetooth_media_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_client.h"
+#include "device/bluetooth/dbus/bluetooth_media_client.h"
#include "base/bind.h"
#include "base/logging.h"
@@ -18,8 +18,7 @@ namespace {
// Since there is no property associated with Media objects, an empty callback
// is used.
-void DoNothing(const std::string& property_name) {
-}
+void DoNothing(const std::string& property_name) {}
// TODO(mcchou): Add these service constants into dbus/service_constants.h
// later.
@@ -36,7 +35,7 @@ const char kCapabilitiesEndpointProperty[] = "Capabilities";
} // namespace
-namespace chromeos {
+namespace bluez {
// static
const char BluetoothMediaClient::kNoResponseError[] =
@@ -46,14 +45,12 @@ const char BluetoothMediaClient::kNoResponseError[] =
const char BluetoothMediaClient::kBluetoothAudioSinkUUID[] =
"0000110b-0000-1000-8000-00805f9b34fb";
-BluetoothMediaClient::EndpointProperties::EndpointProperties() : codec(0x00) {
-}
+BluetoothMediaClient::EndpointProperties::EndpointProperties() : codec(0x00) {}
-BluetoothMediaClient::EndpointProperties::~EndpointProperties() {
-}
+BluetoothMediaClient::EndpointProperties::~EndpointProperties() {}
-class BluetoothMediaClientImpl
- : public BluetoothMediaClient, dbus::ObjectManager::Interface {
+class BluetoothMediaClientImpl : public BluetoothMediaClient,
+ dbus::ObjectManager::Interface {
public:
BluetoothMediaClientImpl()
: object_manager_(nullptr), weak_ptr_factory_(this) {}
@@ -145,8 +142,7 @@ class BluetoothMediaClientImpl
scoped_refptr<dbus::ObjectProxy> object_proxy(
object_manager_->GetObjectProxy(object_path));
object_proxy->CallMethodWithErrorCallback(
- &method_call,
- dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
+ &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
base::Bind(&BluetoothMediaClientImpl::OnSuccess,
weak_ptr_factory_.GetWeakPtr(), callback),
base::Bind(&BluetoothMediaClientImpl::OnError,
@@ -170,8 +166,7 @@ class BluetoothMediaClientImpl
scoped_refptr<dbus::ObjectProxy> object_proxy(
object_manager_->GetObjectProxy(object_path));
object_proxy->CallMethodWithErrorCallback(
- &method_call,
- dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
+ &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
base::Bind(&BluetoothMediaClientImpl::OnSuccess,
weak_ptr_factory_.GetWeakPtr(), callback),
base::Bind(&BluetoothMediaClientImpl::OnError,
@@ -190,8 +185,7 @@ class BluetoothMediaClientImpl
private:
// 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();
}
@@ -222,14 +216,12 @@ class BluetoothMediaClientImpl
DISALLOW_COPY_AND_ASSIGN(BluetoothMediaClientImpl);
};
-BluetoothMediaClient::BluetoothMediaClient() {
-}
+BluetoothMediaClient::BluetoothMediaClient() {}
-BluetoothMediaClient::~BluetoothMediaClient() {
-}
+BluetoothMediaClient::~BluetoothMediaClient() {}
BluetoothMediaClient* BluetoothMediaClient::Create() {
return new BluetoothMediaClientImpl();
}
-} // namespace chromeos
+} // namespace bluez
diff --git a/chromeos/dbus/bluetooth_media_client.h b/device/bluetooth/dbus/bluetooth_media_client.h
index 1bb5547..8c7050b 100644
--- a/chromeos/dbus/bluetooth_media_client.h
+++ b/device/bluetooth/dbus/bluetooth_media_client.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_DBUS_BLUETOOTH_MEDIA_CLIENT_H_
-#define CHROMEOS_DBUS_BLUETOOTH_MEDIA_CLIENT_H_
+#ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_MEDIA_CLIENT_H_
+#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_MEDIA_CLIENT_H_
#include <memory>
#include <string>
@@ -11,19 +11,19 @@
#include "base/callback.h"
#include "base/values.h"
-#include "chromeos/chromeos_export.h"
-#include "chromeos/dbus/dbus_client.h"
#include "dbus/object_path.h"
#include "dbus/property.h"
+#include "device/bluetooth/bluetooth_export.h"
+#include "device/bluetooth/dbus/bluez_dbus_client.h"
-namespace chromeos {
+namespace bluez {
// BluetoothMediaClient is used to communicate with the Media interface of a
// local Bluetooth adapter.
-class CHROMEOS_EXPORT BluetoothMediaClient : public DBusClient {
+class DEVICE_BLUETOOTH_EXPORT BluetoothMediaClient : public BluezDBusClient {
public:
// Properties used to register a Media Endpoint.
- struct CHROMEOS_EXPORT EndpointProperties {
+ struct DEVICE_BLUETOOTH_EXPORT EndpointProperties {
EndpointProperties();
~EndpointProperties();
@@ -102,6 +102,6 @@ class CHROMEOS_EXPORT BluetoothMediaClient : public DBusClient {
DISALLOW_COPY_AND_ASSIGN(BluetoothMediaClient);
};
-} // namespace chromeos
+} // namespace bluez
-#endif // CHROMEOS_DBUS_BLUETOOTH_MEDIA_CLIENT_H_
+#endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_MEDIA_CLIENT_H_
diff --git a/chromeos/dbus/bluetooth_media_endpoint_service_provider.cc b/device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.cc
index 3d2e03e..864a04d 100644
--- a/chromeos/dbus/bluetooth_media_endpoint_service_provider.cc
+++ b/device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.cc
@@ -2,17 +2,17 @@
// 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_endpoint_service_provider.h"
+#include "device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.h"
#include "base/bind.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/threading/platform_thread.h"
-#include "chromeos/dbus/bluetooth_media_transport_client.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/fake_bluetooth_media_endpoint_service_provider.h"
#include "dbus/exported_object.h"
+#include "device/bluetooth/dbus/bluetooth_media_transport_client.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
+#include "device/bluetooth/dbus/fake_bluetooth_media_endpoint_service_provider.h"
namespace {
@@ -31,10 +31,10 @@ const char kInvalidState[] = "unknown";
} // namespace
-namespace chromeos {
+namespace bluez {
// The BluetoothMediaEndopintServiceProvider implementation used in production.
-class CHROMEOS_EXPORT BluetoothMediaEndpointServiceProviderImpl
+class DEVICE_BLUETOOTH_EXPORT BluetoothMediaEndpointServiceProviderImpl
: public BluetoothMediaEndpointServiceProvider {
public:
BluetoothMediaEndpointServiceProviderImpl(dbus::Bus* bus,
@@ -53,17 +53,14 @@ class CHROMEOS_EXPORT BluetoothMediaEndpointServiceProviderImpl
exported_object_ = bus_->GetExportedObject(object_path_);
exported_object_->ExportMethod(
- kBluetoothMediaEndpointInterface,
- kSetConfiguration,
- base::Bind(
- &BluetoothMediaEndpointServiceProviderImpl::SetConfiguration,
- weak_ptr_factory_.GetWeakPtr()),
+ kBluetoothMediaEndpointInterface, kSetConfiguration,
+ base::Bind(&BluetoothMediaEndpointServiceProviderImpl::SetConfiguration,
+ weak_ptr_factory_.GetWeakPtr()),
base::Bind(&BluetoothMediaEndpointServiceProviderImpl::OnExported,
weak_ptr_factory_.GetWeakPtr()));
exported_object_->ExportMethod(
- kBluetoothMediaEndpointInterface,
- kSelectConfiguration,
+ kBluetoothMediaEndpointInterface, kSelectConfiguration,
base::Bind(
&BluetoothMediaEndpointServiceProviderImpl::SelectConfiguration,
weak_ptr_factory_.GetWeakPtr()),
@@ -71,8 +68,7 @@ class CHROMEOS_EXPORT BluetoothMediaEndpointServiceProviderImpl
weak_ptr_factory_.GetWeakPtr()));
exported_object_->ExportMethod(
- kBluetoothMediaEndpointInterface,
- kClearConfiguration,
+ kBluetoothMediaEndpointInterface, kClearConfiguration,
base::Bind(
&BluetoothMediaEndpointServiceProviderImpl::ClearConfiguration,
weak_ptr_factory_.GetWeakPtr()),
@@ -80,8 +76,7 @@ class CHROMEOS_EXPORT BluetoothMediaEndpointServiceProviderImpl
weak_ptr_factory_.GetWeakPtr()));
exported_object_->ExportMethod(
- kBluetoothMediaEndpointInterface,
- kRelease,
+ kBluetoothMediaEndpointInterface, kRelease,
base::Bind(&BluetoothMediaEndpointServiceProviderImpl::Release,
weak_ptr_factory_.GetWeakPtr()),
base::Bind(&BluetoothMediaEndpointServiceProviderImpl::OnExported,
@@ -89,8 +84,7 @@ class CHROMEOS_EXPORT BluetoothMediaEndpointServiceProviderImpl
}
~BluetoothMediaEndpointServiceProviderImpl() override {
- VLOG(1) << "Cleaning up Bluetooth Media Endpoint: "
- << object_path_.value();
+ VLOG(1) << "Cleaning up Bluetooth Media Endpoint: " << object_path_.value();
bus_->UnregisterExportedObject(object_path_);
}
@@ -198,9 +192,7 @@ class CHROMEOS_EXPORT BluetoothMediaEndpointServiceProviderImpl
// back via |callback|.
Delegate::SelectConfigurationCallback callback = base::Bind(
&BluetoothMediaEndpointServiceProviderImpl::OnConfiguration,
- weak_ptr_factory_.GetWeakPtr(),
- method_call,
- response_sender);
+ weak_ptr_factory_.GetWeakPtr(), method_call, response_sender);
delegate_->SelectConfiguration(configuration, callback);
}
@@ -293,33 +285,29 @@ class CHROMEOS_EXPORT BluetoothMediaEndpointServiceProviderImpl
BluetoothMediaEndpointServiceProvider::Delegate::TransportProperties::
TransportProperties()
- : codec(kInvalidCodec),
- state(kInvalidState) {
-}
+ : codec(kInvalidCodec), state(kInvalidState) {}
BluetoothMediaEndpointServiceProvider::Delegate::TransportProperties::
- ~TransportProperties() {
-}
+ ~TransportProperties() {}
BluetoothMediaEndpointServiceProvider::BluetoothMediaEndpointServiceProvider() {
}
BluetoothMediaEndpointServiceProvider::
- ~BluetoothMediaEndpointServiceProvider() {
-}
+ ~BluetoothMediaEndpointServiceProvider() {}
BluetoothMediaEndpointServiceProvider*
- BluetoothMediaEndpointServiceProvider::Create(
+BluetoothMediaEndpointServiceProvider::Create(
dbus::Bus* bus,
const dbus::ObjectPath& object_path,
Delegate* delegate) {
// Returns a real implementation.
- if (!DBusThreadManager::Get()->IsUsingStub(DBusClientBundle::BLUETOOTH)) {
- return new BluetoothMediaEndpointServiceProviderImpl(
- bus, object_path, delegate);
+ if (!bluez::BluezDBusManager::Get()->IsUsingStub()) {
+ return new BluetoothMediaEndpointServiceProviderImpl(bus, object_path,
+ delegate);
}
// Returns a fake implementation.
return new FakeBluetoothMediaEndpointServiceProvider(object_path, delegate);
}
-} // namespace chromeos
+} // namespace bluez
diff --git a/chromeos/dbus/bluetooth_media_endpoint_service_provider.h b/device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.h
index fffaa53..df17f09 100644
--- a/chromeos/dbus/bluetooth_media_endpoint_service_provider.h
+++ b/device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.h
@@ -2,19 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_DBUS_BLUETOOTH_MEDIA_ENDPOINT_SERVICE_PROVIDER_H_
-#define CHROMEOS_DBUS_BLUETOOTH_MEDIA_ENDPOINT_SERVICE_PROVIDER_H_
+#ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_MEDIA_ENDPOINT_SERVICE_PROVIDER_H_
+#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_MEDIA_ENDPOINT_SERVICE_PROVIDER_H_
#include <string>
#include <vector>
#include "base/callback.h"
-#include "chromeos/chromeos_export.h"
#include "dbus/bus.h"
#include "dbus/message.h"
#include "dbus/object_path.h"
+#include "device/bluetooth/bluetooth_export.h"
-namespace chromeos {
+namespace bluez {
// BluetoothMediaEndpointServiceProvider is used to provide a D-Bus object that
// the Bluetooth daemon can commuicate with to serve as a media source/sink.
@@ -27,7 +27,7 @@ namespace chromeos {
// Bluetooth daemon will make calls to this endpoint object and they will be
// passed to user's Delegate object for handling. For SelectConfiguration method
// the response is returned using the SelectConfiguration callback.
-class CHROMEOS_EXPORT BluetoothMediaEndpointServiceProvider {
+class DEVICE_BLUETOOTH_EXPORT BluetoothMediaEndpointServiceProvider {
public:
// Delegate is the interface for reacting to endpoint requests. User
// applications will implement this interface to handle either A2DP Sink or
@@ -35,7 +35,7 @@ class CHROMEOS_EXPORT BluetoothMediaEndpointServiceProvider {
class Delegate {
public:
// Transport-specific properties.
- struct CHROMEOS_EXPORT TransportProperties {
+ struct DEVICE_BLUETOOTH_EXPORT TransportProperties {
TransportProperties();
~TransportProperties();
@@ -128,6 +128,6 @@ class CHROMEOS_EXPORT BluetoothMediaEndpointServiceProvider {
DISALLOW_COPY_AND_ASSIGN(BluetoothMediaEndpointServiceProvider);
};
-} // namespace chromeos
+} // namespace bluez
-#endif // CHROMEOS_DBUS_BLUETOOTH_MEDIA_ENDPOINT_SERVICE_PROVIDER_H_
+#endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_MEDIA_ENDPOINT_SERVICE_PROVIDER_H_
diff --git a/chromeos/dbus/bluetooth_media_transport_client.cc b/device/bluetooth/dbus/bluetooth_media_transport_client.cc
index 5639930..7fc47d7 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
diff --git a/chromeos/dbus/bluetooth_media_transport_client.h b/device/bluetooth/dbus/bluetooth_media_transport_client.h
index 4476ae7..1314b26 100644
--- a/chromeos/dbus/bluetooth_media_transport_client.h
+++ b/device/bluetooth/dbus/bluetooth_media_transport_client.h
@@ -2,22 +2,23 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_DBUS_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_
-#define CHROMEOS_DBUS_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_
+#ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_
+#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_
#include <string>
#include <vector>
#include "base/callback.h"
-#include "chromeos/chromeos_export.h"
-#include "chromeos/dbus/dbus_client.h"
#include "dbus/file_descriptor.h"
#include "dbus/object_path.h"
#include "dbus/property.h"
+#include "device/bluetooth/bluetooth_export.h"
+#include "device/bluetooth/dbus/bluez_dbus_client.h"
-namespace chromeos {
+namespace bluez {
-class CHROMEOS_EXPORT BluetoothMediaTransportClient : public DBusClient {
+class DEVICE_BLUETOOTH_EXPORT BluetoothMediaTransportClient
+ : public BluezDBusClient {
public:
struct Properties : public dbus::PropertySet {
// The path to the device object which the transport is connected to.
@@ -137,6 +138,6 @@ class CHROMEOS_EXPORT BluetoothMediaTransportClient : public DBusClient {
DISALLOW_COPY_AND_ASSIGN(BluetoothMediaTransportClient);
};
-} // namespace chromeos
+} // namespace bluez
-#endif // CHROMEOS_DBUS_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_
+#endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_
diff --git a/chromeos/dbus/bluetooth_profile_manager_client.cc b/device/bluetooth/dbus/bluetooth_profile_manager_client.cc
index 85945bc..742988a 100644
--- a/chromeos/dbus/bluetooth_profile_manager_client.cc
+++ b/device/bluetooth/dbus/bluetooth_profile_manager_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_profile_manager_client.h"
+#include "device/bluetooth/dbus/bluetooth_profile_manager_client.h"
#include "base/bind.h"
#include "base/logging.h"
@@ -11,21 +11,17 @@
#include "dbus/object_proxy.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
-namespace chromeos {
+namespace bluez {
const char BluetoothProfileManagerClient::kNoResponseError[] =
"org.chromium.Error.NoResponse";
+BluetoothProfileManagerClient::Options::Options() {}
-BluetoothProfileManagerClient::Options::Options() {
-}
-
-BluetoothProfileManagerClient::Options::~Options() {
-}
+BluetoothProfileManagerClient::Options::~Options() {}
// The BluetoothProfileManagerClient implementation used in production.
-class BluetoothProfileManagerClientImpl
- : public BluetoothProfileManagerClient {
+class BluetoothProfileManagerClientImpl : public BluetoothProfileManagerClient {
public:
BluetoothProfileManagerClientImpl() : weak_ptr_factory_(this) {}
@@ -38,8 +34,8 @@ class BluetoothProfileManagerClientImpl
const base::Closure& callback,
const ErrorCallback& error_callback) override {
dbus::MethodCall method_call(
- bluetooth_profile_manager::kBluetoothProfileManagerInterface,
- bluetooth_profile_manager::kRegisterProfile);
+ bluetooth_profile_manager::kBluetoothProfileManagerInterface,
+ bluetooth_profile_manager::kRegisterProfile);
dbus::MessageWriter writer(&method_call);
writer.AppendObjectPath(profile_path);
@@ -122,8 +118,7 @@ class BluetoothProfileManagerClientImpl
// Send AutoConnect if provided.
if (options.auto_connect.get() != NULL) {
array_writer.OpenDictEntry(&dict_writer);
- dict_writer.AppendString(
- bluetooth_profile_manager::kAutoConnectOption);
+ dict_writer.AppendString(bluetooth_profile_manager::kAutoConnectOption);
dict_writer.AppendVariantOfBool(*(options.auto_connect));
array_writer.CloseContainer(&dict_writer);
}
@@ -158,8 +153,7 @@ class BluetoothProfileManagerClientImpl
writer.CloseContainer(&array_writer);
object_proxy_->CallMethodWithErrorCallback(
- &method_call,
- dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
+ &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
base::Bind(&BluetoothProfileManagerClientImpl::OnSuccess,
weak_ptr_factory_.GetWeakPtr(), callback),
base::Bind(&BluetoothProfileManagerClientImpl::OnError,
@@ -171,15 +165,14 @@ class BluetoothProfileManagerClientImpl
const base::Closure& callback,
const ErrorCallback& error_callback) override {
dbus::MethodCall method_call(
- bluetooth_profile_manager::kBluetoothProfileManagerInterface,
- bluetooth_profile_manager::kUnregisterProfile);
+ bluetooth_profile_manager::kBluetoothProfileManagerInterface,
+ bluetooth_profile_manager::kUnregisterProfile);
dbus::MessageWriter writer(&method_call);
writer.AppendObjectPath(profile_path);
object_proxy_->CallMethodWithErrorCallback(
- &method_call,
- dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
+ &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
base::Bind(&BluetoothProfileManagerClientImpl::OnSuccess,
weak_ptr_factory_.GetWeakPtr(), callback),
base::Bind(&BluetoothProfileManagerClientImpl::OnError,
@@ -197,8 +190,7 @@ class BluetoothProfileManagerClientImpl
private:
// 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();
}
@@ -231,14 +223,12 @@ class BluetoothProfileManagerClientImpl
DISALLOW_COPY_AND_ASSIGN(BluetoothProfileManagerClientImpl);
};
-BluetoothProfileManagerClient::BluetoothProfileManagerClient() {
-}
+BluetoothProfileManagerClient::BluetoothProfileManagerClient() {}
-BluetoothProfileManagerClient::~BluetoothProfileManagerClient() {
-}
+BluetoothProfileManagerClient::~BluetoothProfileManagerClient() {}
BluetoothProfileManagerClient* BluetoothProfileManagerClient::Create() {
return new BluetoothProfileManagerClientImpl();
}
-} // namespace chromeos
+} // namespace bluez
diff --git a/chromeos/dbus/bluetooth_profile_manager_client.h b/device/bluetooth/dbus/bluetooth_profile_manager_client.h
index 2fa48f6..31f7fef 100644
--- a/chromeos/dbus/bluetooth_profile_manager_client.h
+++ b/device/bluetooth/dbus/bluetooth_profile_manager_client.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_DBUS_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_
-#define CHROMEOS_DBUS_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_
+#ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_
+#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_
#include <string>
#include <vector>
@@ -11,27 +11,24 @@
#include "base/callback.h"
#include "base/memory/scoped_ptr.h"
#include "base/values.h"
-#include "chromeos/chromeos_export.h"
-#include "chromeos/dbus/dbus_client.h"
#include "dbus/object_path.h"
+#include "device/bluetooth/bluetooth_export.h"
+#include "device/bluetooth/dbus/bluez_dbus_client.h"
-namespace chromeos {
+namespace bluez {
// BluetoothProfileManagerClient is used to communicate with the profile
// manager object of the Bluetooth daemon.
-class CHROMEOS_EXPORT BluetoothProfileManagerClient : public DBusClient {
+class DEVICE_BLUETOOTH_EXPORT BluetoothProfileManagerClient
+ : public BluezDBusClient {
public:
// Species the role of the object within the profile. SYMMETRIC should be
// usually used unless the profile requires you specify as a CLIENT or as a
// SERVER.
- enum ProfileRole {
- SYMMETRIC,
- CLIENT,
- SERVER
- };
+ enum ProfileRole { SYMMETRIC, CLIENT, SERVER };
// Options used to register a Profile object.
- struct CHROMEOS_EXPORT Options {
+ struct DEVICE_BLUETOOTH_EXPORT Options {
Options();
~Options();
@@ -93,7 +90,6 @@ class CHROMEOS_EXPORT BluetoothProfileManagerClient : public DBusClient {
const base::Closure& callback,
const ErrorCallback& error_callback) = 0;
-
// Creates the instance.
static BluetoothProfileManagerClient* Create();
@@ -107,6 +103,6 @@ class CHROMEOS_EXPORT BluetoothProfileManagerClient : public DBusClient {
DISALLOW_COPY_AND_ASSIGN(BluetoothProfileManagerClient);
};
-} // namespace chromeos
+} // namespace bluez
-#endif // CHROMEOS_DBUS_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_
+#endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_
diff --git a/chromeos/dbus/bluetooth_profile_service_provider.cc b/device/bluetooth/dbus/bluetooth_profile_service_provider.cc
index c74da5d..a2a23bb 100644
--- a/chromeos/dbus/bluetooth_profile_service_provider.cc
+++ b/device/bluetooth/dbus/bluetooth_profile_service_provider.cc
@@ -2,20 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chromeos/dbus/bluetooth_profile_service_provider.h"
-
+#include "device/bluetooth/dbus/bluetooth_profile_service_provider.h"
#include "base/bind.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "base/threading/platform_thread.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/fake_bluetooth_profile_service_provider.h"
#include "dbus/exported_object.h"
#include "dbus/message.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
+#include "device/bluetooth/dbus/fake_bluetooth_profile_service_provider.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
-namespace chromeos {
+namespace bluez {
// The BluetoothProfileServiceProvider implementation used in production.
class BluetoothProfileServiceProviderImpl
@@ -128,9 +127,7 @@ class BluetoothProfileServiceProviderImpl
Delegate::ConfirmationCallback callback = base::Bind(
&BluetoothProfileServiceProviderImpl::OnConfirmation,
- weak_ptr_factory_.GetWeakPtr(),
- method_call,
- response_sender);
+ weak_ptr_factory_.GetWeakPtr(), method_call, response_sender);
delegate_->NewConnection(device_path, fd.Pass(), options, callback);
}
@@ -153,9 +150,7 @@ class BluetoothProfileServiceProviderImpl
Delegate::ConfirmationCallback callback = base::Bind(
&BluetoothProfileServiceProviderImpl::OnConfirmation,
- weak_ptr_factory_.GetWeakPtr(),
- method_call,
- response_sender);
+ weak_ptr_factory_.GetWeakPtr(), method_call, response_sender);
delegate_->RequestDisconnection(device_path, callback);
}
@@ -176,8 +171,8 @@ class BluetoothProfileServiceProviderImpl
void OnExported(const std::string& interface_name,
const std::string& method_name,
bool success) {
- LOG_IF(WARNING, !success) << "Failed to export "
- << interface_name << "." << method_name;
+ LOG_IF(WARNING, !success) << "Failed to export " << interface_name << "."
+ << method_name;
}
// Called by the Delegate in response to a method requiring confirmation.
@@ -234,22 +229,20 @@ class BluetoothProfileServiceProviderImpl
DISALLOW_COPY_AND_ASSIGN(BluetoothProfileServiceProviderImpl);
};
-BluetoothProfileServiceProvider::BluetoothProfileServiceProvider() {
-}
+BluetoothProfileServiceProvider::BluetoothProfileServiceProvider() {}
-BluetoothProfileServiceProvider::~BluetoothProfileServiceProvider() {
-}
+BluetoothProfileServiceProvider::~BluetoothProfileServiceProvider() {}
// static
BluetoothProfileServiceProvider* BluetoothProfileServiceProvider::Create(
dbus::Bus* bus,
const dbus::ObjectPath& object_path,
Delegate* delegate) {
- if (!DBusThreadManager::Get()->IsUsingStub(DBusClientBundle::BLUETOOTH)) {
+ if (!bluez::BluezDBusManager::Get()->IsUsingStub()) {
return new BluetoothProfileServiceProviderImpl(bus, object_path, delegate);
} else {
return new FakeBluetoothProfileServiceProvider(object_path, delegate);
}
}
-} // namespace chromeos
+} // namespace bluez
diff --git a/chromeos/dbus/bluetooth_profile_service_provider.h b/device/bluetooth/dbus/bluetooth_profile_service_provider.h
index de77b5d..f2db22c 100644
--- a/chromeos/dbus/bluetooth_profile_service_provider.h
+++ b/device/bluetooth/dbus/bluetooth_profile_service_provider.h
@@ -2,20 +2,20 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_DBUS_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_
-#define CHROMEOS_DBUS_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_
+#ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_
+#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_
#include <string>
#include "base/basictypes.h"
#include "base/callback.h"
#include "base/memory/scoped_ptr.h"
-#include "chromeos/chromeos_export.h"
#include "dbus/bus.h"
#include "dbus/file_descriptor.h"
#include "dbus/object_path.h"
+#include "device/bluetooth/bluetooth_export.h"
-namespace chromeos {
+namespace bluez {
// BluetoothProfileServiceProvider is used to provide a D-Bus object that the
// Bluetooth daemon can communicate with to connect application profiles.
@@ -29,7 +29,7 @@ namespace chromeos {
// Bluetooth daemon will make calls to this profile object and they will be
// passed on to your Delegate object for handling. Responses should be returned
// using the callbacks supplied to those methods.
-class CHROMEOS_EXPORT BluetoothProfileServiceProvider {
+class DEVICE_BLUETOOTH_EXPORT BluetoothProfileServiceProvider {
public:
// Interface for reacting to profile requests.
class Delegate {
@@ -40,14 +40,10 @@ class CHROMEOS_EXPORT BluetoothProfileServiceProvider {
// connection or a requested disconnection. Success indicates acceptance,
// reject indicates the user rejected or denied the request; cancelled
// means the user cancelled the request without confirming either way.
- enum Status {
- SUCCESS,
- REJECTED,
- CANCELLED
- };
+ enum Status { SUCCESS, REJECTED, CANCELLED };
// Connection-specific options.
- struct CHROMEOS_EXPORT Options {
+ struct DEVICE_BLUETOOTH_EXPORT Options {
Options() {}
~Options() {}
@@ -119,6 +115,6 @@ class CHROMEOS_EXPORT BluetoothProfileServiceProvider {
DISALLOW_COPY_AND_ASSIGN(BluetoothProfileServiceProvider);
};
-} // namespace chromeos
+} // namespace bluez
-#endif // CHROMEOS_DBUS_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_
+#endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_
diff --git a/device/bluetooth/dbus/bluez_dbus_client.h b/device/bluetooth/dbus/bluez_dbus_client.h
new file mode 100644
index 0000000..3dd0985
--- /dev/null
+++ b/device/bluetooth/dbus/bluez_dbus_client.h
@@ -0,0 +1,37 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef DEVICE_BLUETOOTH_DBUS_BLUEZ_DBUS_CLIENT_H_
+#define DEVICE_BLUETOOTH_DBUS_BLUEZ_DBUS_CLIENT_H_
+
+#include "base/basictypes.h"
+
+namespace dbus {
+class Bus;
+} // namespace dbus
+
+namespace bluez {
+
+// Interface for all Bluez DBus clients handled by BluezDBusManager. It
+// restricts
+// access to the Init function to BluezDBusManager only to prevent
+// incorrect calls. Stub clients may lift that restriction however.
+class BluezDBusClient {
+ protected:
+ virtual ~BluezDBusClient() {}
+
+ // This function is called by DBusThreadManager. Only in unit tests, which
+ // don't use DBusThreadManager, this function can be called through Stub
+ // implementations (they change Init's member visibility to public).
+ virtual void Init(dbus::Bus* bus) = 0;
+
+ private:
+ friend class BluezDBusManager;
+
+ DISALLOW_ASSIGN(BluezDBusClient);
+};
+
+} // namespace bluez
+
+#endif // DEVICE_BLUETOOTH_DBUS_BLUEZ_DBUS_CLIENT_H_
diff --git a/device/bluetooth/dbus/bluez_dbus_manager.cc b/device/bluetooth/dbus/bluez_dbus_manager.cc
new file mode 100644
index 0000000..376261d
--- /dev/null
+++ b/device/bluetooth/dbus/bluez_dbus_manager.cc
@@ -0,0 +1,250 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
+
+#include "base/command_line.h"
+#include "base/sys_info.h"
+#include "base/threading/thread.h"
+#include "dbus/bus.h"
+#include "dbus/dbus_statistics.h"
+#include "device/bluetooth/dbus/bluetooth_adapter_client.h"
+#include "device/bluetooth/dbus/bluetooth_agent_manager_client.h"
+#include "device/bluetooth/dbus/bluetooth_device_client.h"
+#include "device/bluetooth/dbus/bluetooth_gatt_characteristic_client.h"
+#include "device/bluetooth/dbus/bluetooth_gatt_descriptor_client.h"
+#include "device/bluetooth/dbus/bluetooth_gatt_manager_client.h"
+#include "device/bluetooth/dbus/bluetooth_gatt_service_client.h"
+#include "device/bluetooth/dbus/bluetooth_input_client.h"
+#include "device/bluetooth/dbus/bluetooth_le_advertising_manager_client.h"
+#include "device/bluetooth/dbus/bluetooth_media_client.h"
+#include "device/bluetooth/dbus/bluetooth_media_transport_client.h"
+#include "device/bluetooth/dbus/bluetooth_profile_manager_client.h"
+
+namespace bluez {
+
+static BluezDBusManager* g_bluez_dbus_manager = nullptr;
+static bool g_using_bluez_dbus_manager_for_testing = false;
+
+BluezDBusManager::BluezDBusManager(
+ dbus::Bus* bus,
+ scoped_ptr<BluetoothDBusClientBundle> client_bundle)
+ : bus_(bus), client_bundle_(client_bundle.Pass()) {}
+
+BluezDBusManager::~BluezDBusManager() {
+ // Delete all D-Bus clients before shutting down the system bus.
+ client_bundle_.reset();
+}
+
+dbus::Bus* bluez::BluezDBusManager::GetSystemBus() {
+ return bus_;
+}
+
+BluetoothAdapterClient* bluez::BluezDBusManager::GetBluetoothAdapterClient() {
+ return client_bundle_->bluetooth_adapter_client();
+}
+
+BluetoothLEAdvertisingManagerClient*
+bluez::BluezDBusManager::GetBluetoothLEAdvertisingManagerClient() {
+ return client_bundle_->bluetooth_le_advertising_manager_client();
+}
+
+BluetoothAgentManagerClient*
+bluez::BluezDBusManager::GetBluetoothAgentManagerClient() {
+ return client_bundle_->bluetooth_agent_manager_client();
+}
+
+BluetoothDeviceClient* bluez::BluezDBusManager::GetBluetoothDeviceClient() {
+ return client_bundle_->bluetooth_device_client();
+}
+
+BluetoothGattCharacteristicClient*
+bluez::BluezDBusManager::GetBluetoothGattCharacteristicClient() {
+ return client_bundle_->bluetooth_gatt_characteristic_client();
+}
+
+BluetoothGattDescriptorClient*
+bluez::BluezDBusManager::GetBluetoothGattDescriptorClient() {
+ return client_bundle_->bluetooth_gatt_descriptor_client();
+}
+
+BluetoothGattManagerClient*
+bluez::BluezDBusManager::GetBluetoothGattManagerClient() {
+ return client_bundle_->bluetooth_gatt_manager_client();
+}
+
+BluetoothGattServiceClient*
+bluez::BluezDBusManager::GetBluetoothGattServiceClient() {
+ return client_bundle_->bluetooth_gatt_service_client();
+}
+
+BluetoothInputClient* bluez::BluezDBusManager::GetBluetoothInputClient() {
+ return client_bundle_->bluetooth_input_client();
+}
+
+BluetoothMediaClient* bluez::BluezDBusManager::GetBluetoothMediaClient() {
+ return client_bundle_->bluetooth_media_client();
+}
+
+BluetoothMediaTransportClient*
+bluez::BluezDBusManager::GetBluetoothMediaTransportClient() {
+ return client_bundle_->bluetooth_media_transport_client();
+}
+
+BluetoothProfileManagerClient*
+bluez::BluezDBusManager::GetBluetoothProfileManagerClient() {
+ return client_bundle_->bluetooth_profile_manager_client();
+}
+
+void BluezDBusManager::InitializeClients() {
+ GetBluetoothAdapterClient()->Init(GetSystemBus());
+ GetBluetoothAgentManagerClient()->Init(GetSystemBus());
+ GetBluetoothDeviceClient()->Init(GetSystemBus());
+ GetBluetoothGattCharacteristicClient()->Init(GetSystemBus());
+ GetBluetoothGattDescriptorClient()->Init(GetSystemBus());
+ GetBluetoothGattManagerClient()->Init(GetSystemBus());
+ GetBluetoothGattServiceClient()->Init(GetSystemBus());
+ GetBluetoothInputClient()->Init(GetSystemBus());
+ GetBluetoothLEAdvertisingManagerClient()->Init(GetSystemBus());
+ GetBluetoothMediaClient()->Init(GetSystemBus());
+ GetBluetoothMediaTransportClient()->Init(GetSystemBus());
+ GetBluetoothProfileManagerClient()->Init(GetSystemBus());
+
+ // This must be called after the list of clients so they've each had a
+ // chance to register with their object g_dbus_thread_managers.
+ if (GetSystemBus())
+ GetSystemBus()->GetManagedObjects();
+}
+
+// static
+void BluezDBusManager::Initialize(dbus::Bus* bus, bool use_dbus_stub) {
+ // If we initialize BluezDBusManager twice we may also be shutting it down
+ // early; do not allow that.
+ if (g_using_bluez_dbus_manager_for_testing)
+ return;
+
+ CHECK(!g_bluez_dbus_manager);
+ CreateGlobalInstance(bus, use_dbus_stub);
+}
+
+// static
+scoped_ptr<BluezDBusManagerSetter>
+bluez::BluezDBusManager::GetSetterForTesting() {
+ if (!g_using_bluez_dbus_manager_for_testing) {
+ g_using_bluez_dbus_manager_for_testing = true;
+ CreateGlobalInstance(nullptr, true);
+ }
+
+ return make_scoped_ptr(new BluezDBusManagerSetter());
+}
+
+// static
+void BluezDBusManager::CreateGlobalInstance(dbus::Bus* bus, bool use_stubs) {
+ CHECK(!g_bluez_dbus_manager);
+ g_bluez_dbus_manager = new BluezDBusManager(
+ bus, make_scoped_ptr(new BluetoothDBusClientBundle(use_stubs)));
+ g_bluez_dbus_manager->InitializeClients();
+}
+
+// static
+bool BluezDBusManager::IsInitialized() {
+ return g_bluez_dbus_manager != nullptr;
+}
+
+// static
+void BluezDBusManager::Shutdown() {
+ // Ensure that we only shutdown BluezDBusManager once.
+ CHECK(g_bluez_dbus_manager);
+ BluezDBusManager* dbus_manager = g_bluez_dbus_manager;
+ g_bluez_dbus_manager = nullptr;
+ g_using_bluez_dbus_manager_for_testing = false;
+ delete dbus_manager;
+ VLOG(1) << "BluezDBusManager Shutdown completed";
+}
+
+// static
+BluezDBusManager* bluez::BluezDBusManager::Get() {
+ CHECK(g_bluez_dbus_manager)
+ << "bluez::BluezDBusManager::Get() called before Initialize()";
+ return g_bluez_dbus_manager;
+}
+
+BluezDBusManagerSetter::BluezDBusManagerSetter() {}
+
+BluezDBusManagerSetter::~BluezDBusManagerSetter() {}
+
+void BluezDBusManagerSetter::SetBluetoothAdapterClient(
+ scoped_ptr<BluetoothAdapterClient> client) {
+ bluez::BluezDBusManager::Get()->client_bundle_->bluetooth_adapter_client_ =
+ client.Pass();
+}
+
+void BluezDBusManagerSetter::SetBluetoothLEAdvertisingManagerClient(
+ scoped_ptr<BluetoothLEAdvertisingManagerClient> client) {
+ bluez::BluezDBusManager::Get()
+ ->client_bundle_->bluetooth_le_advertising_manager_client_ =
+ client.Pass();
+}
+
+void BluezDBusManagerSetter::SetBluetoothAgentManagerClient(
+ scoped_ptr<BluetoothAgentManagerClient> client) {
+ bluez::BluezDBusManager::Get()
+ ->client_bundle_->bluetooth_agent_manager_client_ = client.Pass();
+}
+
+void BluezDBusManagerSetter::SetBluetoothDeviceClient(
+ scoped_ptr<BluetoothDeviceClient> client) {
+ bluez::BluezDBusManager::Get()->client_bundle_->bluetooth_device_client_ =
+ client.Pass();
+}
+
+void BluezDBusManagerSetter::SetBluetoothGattCharacteristicClient(
+ scoped_ptr<BluetoothGattCharacteristicClient> client) {
+ bluez::BluezDBusManager::Get()
+ ->client_bundle_->bluetooth_gatt_characteristic_client_ = client.Pass();
+}
+
+void BluezDBusManagerSetter::SetBluetoothGattDescriptorClient(
+ scoped_ptr<BluetoothGattDescriptorClient> client) {
+ bluez::BluezDBusManager::Get()
+ ->client_bundle_->bluetooth_gatt_descriptor_client_ = client.Pass();
+}
+
+void BluezDBusManagerSetter::SetBluetoothGattManagerClient(
+ scoped_ptr<BluetoothGattManagerClient> client) {
+ bluez::BluezDBusManager::Get()
+ ->client_bundle_->bluetooth_gatt_manager_client_ = client.Pass();
+}
+
+void BluezDBusManagerSetter::SetBluetoothGattServiceClient(
+ scoped_ptr<BluetoothGattServiceClient> client) {
+ bluez::BluezDBusManager::Get()
+ ->client_bundle_->bluetooth_gatt_service_client_ = client.Pass();
+}
+
+void BluezDBusManagerSetter::SetBluetoothInputClient(
+ scoped_ptr<BluetoothInputClient> client) {
+ bluez::BluezDBusManager::Get()->client_bundle_->bluetooth_input_client_ =
+ client.Pass();
+}
+
+void BluezDBusManagerSetter::SetBluetoothMediaClient(
+ scoped_ptr<BluetoothMediaClient> client) {
+ bluez::BluezDBusManager::Get()->client_bundle_->bluetooth_media_client_ =
+ client.Pass();
+}
+
+void BluezDBusManagerSetter::SetBluetoothMediaTransportClient(
+ scoped_ptr<BluetoothMediaTransportClient> client) {
+ bluez::BluezDBusManager::Get()
+ ->client_bundle_->bluetooth_media_transport_client_ = client.Pass();
+}
+
+void BluezDBusManagerSetter::SetBluetoothProfileManagerClient(
+ scoped_ptr<BluetoothProfileManagerClient> client) {
+ bluez::BluezDBusManager::Get()
+ ->client_bundle_->bluetooth_profile_manager_client_ = client.Pass();
+}
+
+} // namespace bluez
diff --git a/device/bluetooth/dbus/bluez_dbus_manager.h b/device/bluetooth/dbus/bluez_dbus_manager.h
new file mode 100644
index 0000000..6f75f96
--- /dev/null
+++ b/device/bluetooth/dbus/bluez_dbus_manager.h
@@ -0,0 +1,157 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef DEVICE_BLUETOOTH_DBUS_BLUEZ_DBUS_MANAGER_H_
+#define DEVICE_BLUETOOTH_DBUS_BLUEZ_DBUS_MANAGER_H_
+
+#include <string>
+
+#include "base/callback.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "device/bluetooth/bluetooth_export.h"
+#include "device/bluetooth/dbus/bluetooth_dbus_client_bundle.h"
+
+namespace dbus {
+class Bus;
+class ObjectPath;
+} // namespace dbus
+
+namespace bluez {
+
+// Style Note: Clients are sorted by names.
+class BluetoothAdapterClient;
+class BluetoothAgentManagerClient;
+class BluetoothDeviceClient;
+class BluetoothGattCharacteristicClient;
+class BluetoothGattDescriptorClient;
+class BluetoothGattManagerClient;
+class BluetoothGattServiceClient;
+class BluetoothInputClient;
+class BluetoothLEAdvertisingManagerClient;
+class BluetoothMediaClient;
+class BluetoothMediaTransportClient;
+class BluetoothProfileManagerClient;
+class BluezDBusManagerSetter;
+
+// BluezDBusManager manages manages D-Bus connections and D-Bus clients, which
+// depend on the D-Bus thread to ensure the right order of shutdowns for
+// the D-Bus thread, the D-Bus connections, and the D-Bus clients.
+//
+// CALLBACKS IN D-BUS CLIENTS:
+//
+// D-Bus clients managed by BluezDBusManagerSetter are guaranteed to be deleted
+// after the D-Bus thread so the clients don't need to worry if new
+// incoming messages arrive from the D-Bus thread during shutdown of the
+// clients. The UI message loop is not running during the shutdown hence
+// the UI message loop won't post tasks to D-BUS clients during the
+// shutdown. However, to be extra cautious, clients should use
+// WeakPtrFactory when creating callbacks that run on UI thread. See
+// session_manager_client.cc for examples.
+//
+class DEVICE_BLUETOOTH_EXPORT BluezDBusManager {
+ public:
+ // Sets the global instance. Must be called before any calls to Get().
+ // We explicitly initialize and shut down the global object, rather than
+ // making it a Singleton, to ensure clean startup and shutdown.
+ // This will initialize real or stub DBusClients depending on command-line
+ // arguments and whether this process runs in a ChromeOS environment.
+ static void Initialize(dbus::Bus* bus, bool use_dbus_stub);
+
+ // Returns a BluezDBusManagerSetter instance that allows tests to
+ // replace individual D-Bus clients with their own implementations.
+ // Also initializes the main BluezDBusManager for testing if necessary.
+ static scoped_ptr<BluezDBusManagerSetter> GetSetterForTesting();
+
+ // Returns true if BluezDBusManager has been initialized. Call this to
+ // avoid initializing + shutting down BluezDBusManager more than once.
+ static bool IsInitialized();
+
+ // Destroys the global instance.
+ static void Shutdown();
+
+ // Gets the global instance. Initialize() must be called first.
+ static BluezDBusManager* Get();
+
+ // Returns true if |client| is stubbed.
+ bool IsUsingStub() { return client_bundle_->IsUsingStub(); }
+
+ // Returns various D-Bus bus instances, owned by BluezDBusManager.
+ dbus::Bus* GetSystemBus();
+
+ // All returned objects are owned by BluezDBusManager. Do not use these
+ // pointers after BluezDBusManager has been shut down.
+ BluetoothAdapterClient* GetBluetoothAdapterClient();
+ BluetoothLEAdvertisingManagerClient* GetBluetoothLEAdvertisingManagerClient();
+ BluetoothAgentManagerClient* GetBluetoothAgentManagerClient();
+ BluetoothDeviceClient* GetBluetoothDeviceClient();
+ BluetoothGattCharacteristicClient* GetBluetoothGattCharacteristicClient();
+ BluetoothGattDescriptorClient* GetBluetoothGattDescriptorClient();
+ BluetoothGattManagerClient* GetBluetoothGattManagerClient();
+ BluetoothGattServiceClient* GetBluetoothGattServiceClient();
+ BluetoothInputClient* GetBluetoothInputClient();
+ BluetoothMediaClient* GetBluetoothMediaClient();
+ BluetoothMediaTransportClient* GetBluetoothMediaTransportClient();
+ BluetoothProfileManagerClient* GetBluetoothProfileManagerClient();
+
+ private:
+ friend class BluezDBusManagerSetter;
+
+ // Creates a new BluezDBusManager using the DBusClients set in
+ // |client_bundle|.
+ explicit BluezDBusManager(
+ dbus::Bus* bus,
+ scoped_ptr<BluetoothDBusClientBundle> client_bundle);
+ ~BluezDBusManager();
+
+ // Creates a global instance of BluezDBusManager. Cannot be called more than
+ // once.
+ static void CreateGlobalInstance(dbus::Bus* bus, bool use_stubs);
+
+ // Initializes all currently stored DBusClients with the system bus and
+ // performs additional setup.
+ void InitializeClients();
+
+ dbus::Bus* bus_;
+ scoped_ptr<BluetoothDBusClientBundle> client_bundle_;
+
+ DISALLOW_COPY_AND_ASSIGN(BluezDBusManager);
+};
+
+class DEVICE_BLUETOOTH_EXPORT BluezDBusManagerSetter {
+ public:
+ ~BluezDBusManagerSetter();
+
+ void SetBluetoothAdapterClient(scoped_ptr<BluetoothAdapterClient> client);
+ void SetBluetoothLEAdvertisingManagerClient(
+ scoped_ptr<BluetoothLEAdvertisingManagerClient> client);
+ void SetBluetoothAgentManagerClient(
+ scoped_ptr<BluetoothAgentManagerClient> client);
+ void SetBluetoothDeviceClient(scoped_ptr<BluetoothDeviceClient> client);
+ void SetBluetoothGattCharacteristicClient(
+ scoped_ptr<BluetoothGattCharacteristicClient> client);
+ void SetBluetoothGattDescriptorClient(
+ scoped_ptr<BluetoothGattDescriptorClient> client);
+ void SetBluetoothGattManagerClient(
+ scoped_ptr<BluetoothGattManagerClient> client);
+ void SetBluetoothGattServiceClient(
+ scoped_ptr<BluetoothGattServiceClient> client);
+ void SetBluetoothInputClient(scoped_ptr<BluetoothInputClient> client);
+ void SetBluetoothMediaClient(scoped_ptr<BluetoothMediaClient> client);
+ void SetBluetoothMediaTransportClient(
+ scoped_ptr<BluetoothMediaTransportClient> client);
+ void SetBluetoothProfileManagerClient(
+ scoped_ptr<BluetoothProfileManagerClient> client);
+
+ private:
+ friend class BluezDBusManager;
+
+ BluezDBusManagerSetter();
+
+ DISALLOW_COPY_AND_ASSIGN(BluezDBusManagerSetter);
+};
+
+} // namespace bluez
+
+#endif // DEVICE_BLUETOOTH_DBUS_BLUEZ_DBUS_MANAGER_H_
diff --git a/chromeos/dbus/fake_bluetooth_adapter_client.cc b/device/bluetooth/dbus/fake_bluetooth_adapter_client.cc
index 054a691..f928768 100644
--- a/chromeos/dbus/fake_bluetooth_adapter_client.cc
+++ b/device/bluetooth/dbus/fake_bluetooth_adapter_client.cc
@@ -2,18 +2,18 @@
// 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_adapter_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_adapter_client.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/single_thread_task_runner.h"
#include "base/thread_task_runner_handle.h"
#include "base/time/time.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/fake_bluetooth_device_client.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
+#include "device/bluetooth/dbus/fake_bluetooth_device_client.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
-namespace chromeos {
+namespace bluez {
namespace {
@@ -22,15 +22,11 @@ const int kSimulationIntervalMs = 750;
} // namespace
-const char FakeBluetoothAdapterClient::kAdapterPath[] =
- "/fake/hci0";
-const char FakeBluetoothAdapterClient::kAdapterName[] =
- "Fake Adapter";
-const char FakeBluetoothAdapterClient::kAdapterAddress[] =
- "01:1A:2B:1A:2B:03";
+const char FakeBluetoothAdapterClient::kAdapterPath[] = "/fake/hci0";
+const char FakeBluetoothAdapterClient::kAdapterName[] = "Fake Adapter";
+const char FakeBluetoothAdapterClient::kAdapterAddress[] = "01:1A:2B:1A:2B:03";
-const char FakeBluetoothAdapterClient::kSecondAdapterPath[] =
- "/fake/hci1";
+const char FakeBluetoothAdapterClient::kSecondAdapterPath[] = "/fake/hci1";
const char FakeBluetoothAdapterClient::kSecondAdapterName[] =
"Second Fake Adapter";
const char FakeBluetoothAdapterClient::kSecondAdapterAddress[] =
@@ -39,13 +35,11 @@ const char FakeBluetoothAdapterClient::kSecondAdapterAddress[] =
FakeBluetoothAdapterClient::Properties::Properties(
const PropertyChangedCallback& callback)
: BluetoothAdapterClient::Properties(
- NULL,
- bluetooth_adapter::kBluetoothAdapterInterface,
- callback) {
-}
+ NULL,
+ bluetooth_adapter::kBluetoothAdapterInterface,
+ callback) {}
-FakeBluetoothAdapterClient::Properties::~Properties() {
-}
+FakeBluetoothAdapterClient::Properties::~Properties() {}
void FakeBluetoothAdapterClient::Properties::Get(
dbus::PropertyBase* property,
@@ -59,11 +53,10 @@ void FakeBluetoothAdapterClient::Properties::GetAll() {
}
void FakeBluetoothAdapterClient::Properties::Set(
- dbus::PropertyBase *property,
+ dbus::PropertyBase* property,
dbus::PropertySet::SetCallback callback) {
VLOG(1) << "Set " << property->name();
- if (property->name() == powered.name() ||
- property->name() == alias.name() ||
+ if (property->name() == powered.name() || property->name() == alias.name() ||
property->name() == discoverable.name() ||
property->name() == discoverable_timeout.name()) {
callback.Run(true);
@@ -96,11 +89,9 @@ FakeBluetoothAdapterClient::FakeBluetoothAdapterClient()
second_properties_->pairable.ReplaceValue(true);
}
-FakeBluetoothAdapterClient::~FakeBluetoothAdapterClient() {
-}
+FakeBluetoothAdapterClient::~FakeBluetoothAdapterClient() {}
-void FakeBluetoothAdapterClient::Init(dbus::Bus* bus) {
-}
+void FakeBluetoothAdapterClient::Init(dbus::Bus* bus) {}
void FakeBluetoothAdapterClient::AddObserver(Observer* observer) {
observers_.AddObserver(observer);
@@ -148,7 +139,7 @@ void FakeBluetoothAdapterClient::StartDiscovery(
FakeBluetoothDeviceClient* device_client =
static_cast<FakeBluetoothDeviceClient*>(
- DBusThreadManager::Get()->GetBluetoothDeviceClient());
+ bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient());
device_client->BeginDiscoverySimulation(dbus::ObjectPath(kAdapterPath));
}
}
@@ -176,7 +167,7 @@ void FakeBluetoothAdapterClient::StopDiscovery(
if (discovering_count_ == 0) {
FakeBluetoothDeviceClient* device_client =
static_cast<FakeBluetoothDeviceClient*>(
- DBusThreadManager::Get()->GetBluetoothDeviceClient());
+ bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient());
device_client->EndDiscoverySimulation(dbus::ObjectPath(kAdapterPath));
if (simulation_interval_ms_ > 100) {
@@ -199,13 +190,13 @@ void FakeBluetoothAdapterClient::RemoveDevice(
return;
}
- VLOG(1) << "RemoveDevice: " << object_path.value()
- << " " << device_path.value();
+ VLOG(1) << "RemoveDevice: " << object_path.value() << " "
+ << device_path.value();
callback.Run();
FakeBluetoothDeviceClient* device_client =
static_cast<FakeBluetoothDeviceClient*>(
- DBusThreadManager::Get()->GetBluetoothDeviceClient());
+ bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient());
device_client->RemoveDevice(dbus::ObjectPath(kAdapterPath), device_path);
}
@@ -244,8 +235,7 @@ FakeBluetoothAdapterClient::GetDiscoveryFilter() {
return discovery_filter_.get();
}
-void FakeBluetoothAdapterClient::SetVisible(
- bool visible) {
+void FakeBluetoothAdapterClient::SetVisible(bool visible) {
if (visible && !visible_) {
// Adapter becoming visible
visible_ = visible;
@@ -262,8 +252,7 @@ void FakeBluetoothAdapterClient::SetVisible(
}
}
-void FakeBluetoothAdapterClient::SetSecondVisible(
- bool visible) {
+void FakeBluetoothAdapterClient::SetSecondVisible(bool visible) {
if (visible && !second_visible_) {
// Second adapter becoming visible
second_visible_ = visible;
@@ -292,9 +281,9 @@ void FakeBluetoothAdapterClient::OnPropertyChanged(
}
}
- FOR_EACH_OBSERVER(BluetoothAdapterClient::Observer, observers_,
- AdapterPropertyChanged(dbus::ObjectPath(kAdapterPath),
- property_name));
+ FOR_EACH_OBSERVER(
+ BluetoothAdapterClient::Observer, observers_,
+ AdapterPropertyChanged(dbus::ObjectPath(kAdapterPath), property_name));
}
void FakeBluetoothAdapterClient::PostDelayedTask(
@@ -304,4 +293,4 @@ void FakeBluetoothAdapterClient::PostDelayedTask(
base::TimeDelta::FromMilliseconds(simulation_interval_ms_));
}
-} // namespace chromeos
+} // namespace bluez
diff --git a/chromeos/dbus/fake_bluetooth_adapter_client.h b/device/bluetooth/dbus/fake_bluetooth_adapter_client.h
index 987fc6f..51cd808 100644
--- a/chromeos/dbus/fake_bluetooth_adapter_client.h
+++ b/device/bluetooth/dbus/fake_bluetooth_adapter_client.h
@@ -10,17 +10,17 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/observer_list.h"
-#include "chromeos/chromeos_export.h"
-#include "chromeos/dbus/bluetooth_adapter_client.h"
#include "dbus/object_path.h"
#include "dbus/property.h"
+#include "device/bluetooth/bluetooth_export.h"
+#include "device/bluetooth/dbus/bluetooth_adapter_client.h"
-namespace chromeos {
+namespace bluez {
// FakeBluetoothAdapterClient simulates the behavior of the Bluetooth Daemon
// adapter objects and is used both in test cases in place of a mock and on
// the Linux desktop.
-class CHROMEOS_EXPORT FakeBluetoothAdapterClient
+class DEVICE_BLUETOOTH_EXPORT FakeBluetoothAdapterClient
: public BluetoothAdapterClient {
public:
struct Properties : public BluetoothAdapterClient::Properties {
@@ -113,6 +113,6 @@ class CHROMEOS_EXPORT FakeBluetoothAdapterClient
int simulation_interval_ms_;
};
-} // namespace chromeos
+} // namespace bluez
#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_ADAPTER_CLIENT_H_
diff --git a/chromeos/dbus/fake_bluetooth_agent_manager_client.cc b/device/bluetooth/dbus/fake_bluetooth_agent_manager_client.cc
index 1b8decc..5904441 100644
--- a/chromeos/dbus/fake_bluetooth_agent_manager_client.cc
+++ b/device/bluetooth/dbus/fake_bluetooth_agent_manager_client.cc
@@ -2,23 +2,20 @@
// 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_agent_manager_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_agent_manager_client.h"
#include "base/logging.h"
-#include "chromeos/dbus/fake_bluetooth_agent_service_provider.h"
+#include "device/bluetooth/dbus/fake_bluetooth_agent_service_provider.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
-namespace chromeos {
+namespace bluez {
FakeBluetoothAgentManagerClient::FakeBluetoothAgentManagerClient()
- : service_provider_(NULL) {
-}
+ : service_provider_(NULL) {}
-FakeBluetoothAgentManagerClient::~FakeBluetoothAgentManagerClient() {
-}
+FakeBluetoothAgentManagerClient::~FakeBluetoothAgentManagerClient() {}
-void FakeBluetoothAgentManagerClient::Init(dbus::Bus* bus) {
-}
+void FakeBluetoothAgentManagerClient::Init(dbus::Bus* bus) {}
void FakeBluetoothAgentManagerClient::RegisterAgent(
const dbus::ObjectPath& agent_path,
@@ -78,4 +75,4 @@ FakeBluetoothAgentManagerClient::GetAgentServiceProvider() {
return service_provider_;
}
-} // namespace chromeos
+} // namespace bluez
diff --git a/chromeos/dbus/fake_bluetooth_agent_manager_client.h b/device/bluetooth/dbus/fake_bluetooth_agent_manager_client.h
index 68c91202c3..8d7e30c 100644
--- a/chromeos/dbus/fake_bluetooth_agent_manager_client.h
+++ b/device/bluetooth/dbus/fake_bluetooth_agent_manager_client.h
@@ -8,19 +8,19 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/observer_list.h"
-#include "chromeos/chromeos_export.h"
-#include "chromeos/dbus/bluetooth_agent_manager_client.h"
#include "dbus/object_path.h"
#include "dbus/property.h"
+#include "device/bluetooth/bluetooth_export.h"
+#include "device/bluetooth/dbus/bluetooth_agent_manager_client.h"
-namespace chromeos {
+namespace bluez {
class FakeBluetoothAgentServiceProvider;
// FakeBluetoothAgentManagerClient simulates the behavior of the Bluetooth
// Daemon's agent manager object and is used both in test cases in place of a
// mock and on the Linux desktop.
-class CHROMEOS_EXPORT FakeBluetoothAgentManagerClient
+class DEVICE_BLUETOOTH_EXPORT FakeBluetoothAgentManagerClient
: public BluetoothAgentManagerClient {
public:
FakeBluetoothAgentManagerClient();
@@ -52,6 +52,6 @@ class CHROMEOS_EXPORT FakeBluetoothAgentManagerClient
FakeBluetoothAgentServiceProvider* service_provider_;
};
-} // namespace chromeos
+} // namespace bluez
#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_AGENT_MANAGER_CLIENT_H_
diff --git a/chromeos/dbus/fake_bluetooth_agent_service_provider.cc b/device/bluetooth/dbus/fake_bluetooth_agent_service_provider.cc
index caf2988..777deb0 100644
--- a/chromeos/dbus/fake_bluetooth_agent_service_provider.cc
+++ b/device/bluetooth/dbus/fake_bluetooth_agent_service_provider.cc
@@ -2,23 +2,22 @@
// 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_agent_service_provider.h"
+#include "device/bluetooth/dbus/fake_bluetooth_agent_service_provider.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/fake_bluetooth_agent_manager_client.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
+#include "device/bluetooth/dbus/fake_bluetooth_agent_manager_client.h"
-namespace chromeos {
+namespace bluez {
FakeBluetoothAgentServiceProvider::FakeBluetoothAgentServiceProvider(
const dbus::ObjectPath& object_path,
Delegate* delegate)
- : object_path_(object_path),
- delegate_(delegate) {
+ : object_path_(object_path), delegate_(delegate) {
VLOG(1) << "Creating Bluetooth Agent: " << object_path_.value();
FakeBluetoothAgentManagerClient* fake_bluetooth_agent_manager_client =
static_cast<FakeBluetoothAgentManagerClient*>(
- DBusThreadManager::Get()->GetBluetoothAgentManagerClient());
+ bluez::BluezDBusManager::Get()->GetBluetoothAgentManagerClient());
fake_bluetooth_agent_manager_client->RegisterAgentServiceProvider(this);
}
@@ -27,7 +26,7 @@ FakeBluetoothAgentServiceProvider::~FakeBluetoothAgentServiceProvider() {
FakeBluetoothAgentManagerClient* fake_bluetooth_agent_manager_client =
static_cast<FakeBluetoothAgentManagerClient*>(
- DBusThreadManager::Get()->GetBluetoothAgentManagerClient());
+ bluez::BluezDBusManager::Get()->GetBluetoothAgentManagerClient());
fake_bluetooth_agent_manager_client->UnregisterAgentServiceProvider(this);
}
@@ -62,9 +61,10 @@ void FakeBluetoothAgentServiceProvider::RequestPasskey(
void FakeBluetoothAgentServiceProvider::DisplayPasskey(
const dbus::ObjectPath& device_path,
- uint32 passkey, int16 entered) {
- VLOG(1) << object_path_.value() << ": DisplayPasskey " << passkey
- << " (" << entered << " entered) for "<< device_path.value();
+ uint32 passkey,
+ int16 entered) {
+ VLOG(1) << object_path_.value() << ": DisplayPasskey " << passkey << " ("
+ << entered << " entered) for " << device_path.value();
delegate_->DisplayPasskey(device_path, passkey, entered);
}
@@ -73,7 +73,7 @@ void FakeBluetoothAgentServiceProvider::RequestConfirmation(
uint32 passkey,
const Delegate::ConfirmationCallback& callback) {
VLOG(1) << object_path_.value() << ": RequestConfirmation " << passkey
- << " for "<< device_path.value();
+ << " for " << device_path.value();
delegate_->RequestConfirmation(device_path, passkey, callback);
}
@@ -99,4 +99,4 @@ void FakeBluetoothAgentServiceProvider::Cancel() {
delegate_->Cancel();
}
-} // namespace chromeos
+} // namespace bluez
diff --git a/chromeos/dbus/fake_bluetooth_agent_service_provider.h b/device/bluetooth/dbus/fake_bluetooth_agent_service_provider.h
index 9de89bf..37e1ce6 100644
--- a/chromeos/dbus/fake_bluetooth_agent_service_provider.h
+++ b/device/bluetooth/dbus/fake_bluetooth_agent_service_provider.h
@@ -8,23 +8,23 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/observer_list.h"
-#include "chromeos/chromeos_export.h"
-#include "chromeos/dbus/bluetooth_agent_service_provider.h"
#include "dbus/object_path.h"
#include "dbus/property.h"
+#include "device/bluetooth/bluetooth_export.h"
+#include "device/bluetooth/dbus/bluetooth_agent_service_provider.h"
-namespace chromeos {
+namespace bluez {
class FakeBluetoothAgentManagerClient;
// FakeBluetoothAgentServiceProvider simulates the behavior of a local
// Bluetooth agent object and is used both in test cases in place of a
// mock and on the Linux desktop.
-class CHROMEOS_EXPORT FakeBluetoothAgentServiceProvider
+class DEVICE_BLUETOOTH_EXPORT FakeBluetoothAgentServiceProvider
: public BluetoothAgentServiceProvider {
public:
FakeBluetoothAgentServiceProvider(const dbus::ObjectPath& object_path,
- Delegate *delegate);
+ Delegate* delegate);
~FakeBluetoothAgentServiceProvider() override;
// Each of these calls the equivalent BluetoothAgentServiceProvider::Delegate
@@ -37,7 +37,8 @@ class CHROMEOS_EXPORT FakeBluetoothAgentServiceProvider
virtual void RequestPasskey(const dbus::ObjectPath& device_path,
const Delegate::PasskeyCallback& callback);
virtual void DisplayPasskey(const dbus::ObjectPath& device_path,
- uint32 passkey, int16 entered);
+ uint32 passkey,
+ int16 entered);
virtual void RequestConfirmation(
const dbus::ObjectPath& device_path,
uint32 passkey,
@@ -45,10 +46,9 @@ class CHROMEOS_EXPORT FakeBluetoothAgentServiceProvider
virtual void RequestAuthorization(
const dbus::ObjectPath& device_path,
const Delegate::ConfirmationCallback& callback);
- virtual void AuthorizeService(
- const dbus::ObjectPath& device_path,
- const std::string& uuid,
- const Delegate::ConfirmationCallback& callback);
+ virtual void AuthorizeService(const dbus::ObjectPath& device_path,
+ const std::string& uuid,
+ const Delegate::ConfirmationCallback& callback);
virtual void Cancel();
private:
@@ -63,6 +63,6 @@ class CHROMEOS_EXPORT FakeBluetoothAgentServiceProvider
Delegate* delegate_;
};
-} // namespace chromeos
+} // namespace bluez
#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_
diff --git a/chromeos/dbus/fake_bluetooth_device_client.cc b/device/bluetooth/dbus/fake_bluetooth_device_client.cc
index 8e08656..5dd589b 100644
--- a/chromeos/dbus/fake_bluetooth_device_client.cc
+++ b/device/bluetooth/dbus/fake_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/fake_bluetooth_device_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_device_client.h"
#include <fcntl.h>
#include <sys/socket.h>
@@ -22,15 +22,15 @@
#include "base/thread_task_runner_handle.h"
#include "base/threading/worker_pool.h"
#include "base/time/time.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/fake_bluetooth_adapter_client.h"
-#include "chromeos/dbus/fake_bluetooth_agent_manager_client.h"
-#include "chromeos/dbus/fake_bluetooth_agent_service_provider.h"
-#include "chromeos/dbus/fake_bluetooth_gatt_service_client.h"
-#include "chromeos/dbus/fake_bluetooth_input_client.h"
-#include "chromeos/dbus/fake_bluetooth_profile_manager_client.h"
-#include "chromeos/dbus/fake_bluetooth_profile_service_provider.h"
#include "dbus/file_descriptor.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
+#include "device/bluetooth/dbus/fake_bluetooth_adapter_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_agent_manager_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_agent_service_provider.h"
+#include "device/bluetooth/dbus/fake_bluetooth_gatt_service_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_input_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_profile_manager_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_profile_service_provider.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
namespace {
@@ -94,7 +94,7 @@ void SimpleErrorCallback(const std::string& error_name,
} // namespace
-namespace chromeos {
+namespace bluez {
const char FakeBluetoothDeviceClient::kTestPinCode[] = "123456";
const int FakeBluetoothDeviceClient::kTestPassKey = 123456;
@@ -109,24 +109,20 @@ const char FakeBluetoothDeviceClient::kPairingActionDisplay[] = "Display";
const char FakeBluetoothDeviceClient::kPairingActionFail[] = "Fail";
const char FakeBluetoothDeviceClient::kPairingActionRequest[] = "Request";
-const char FakeBluetoothDeviceClient::kPairedDevicePath[] =
- "/fake/hci0/dev0";
+const char FakeBluetoothDeviceClient::kPairedDevicePath[] = "/fake/hci0/dev0";
const char FakeBluetoothDeviceClient::kPairedDeviceAddress[] =
"00:11:22:33:44:55";
-const char FakeBluetoothDeviceClient::kPairedDeviceName[] =
- "Fake Device";
+const char FakeBluetoothDeviceClient::kPairedDeviceName[] = "Fake Device";
const uint32 FakeBluetoothDeviceClient::kPairedDeviceClass = 0x000104;
-const char FakeBluetoothDeviceClient::kLegacyAutopairPath[] =
- "/fake/hci0/dev1";
+const char FakeBluetoothDeviceClient::kLegacyAutopairPath[] = "/fake/hci0/dev1";
const char FakeBluetoothDeviceClient::kLegacyAutopairAddress[] =
"28:CF:DA:00:00:00";
const char FakeBluetoothDeviceClient::kLegacyAutopairName[] =
"Bluetooth 2.0 Mouse";
const uint32 FakeBluetoothDeviceClient::kLegacyAutopairClass = 0x002580;
-const char FakeBluetoothDeviceClient::kDisplayPinCodePath[] =
- "/fake/hci0/dev2";
+const char FakeBluetoothDeviceClient::kDisplayPinCodePath[] = "/fake/hci0/dev2";
const char FakeBluetoothDeviceClient::kDisplayPinCodeAddress[] =
"28:37:37:00:00:00";
const char FakeBluetoothDeviceClient::kDisplayPinCodeName[] =
@@ -149,36 +145,29 @@ const char FakeBluetoothDeviceClient::kConnectUnpairableName[] =
"Unpairable Device";
const uint32 FakeBluetoothDeviceClient::kConnectUnpairableClass = 0x002580;
-const char FakeBluetoothDeviceClient::kDisplayPasskeyPath[] =
- "/fake/hci0/dev5";
+const char FakeBluetoothDeviceClient::kDisplayPasskeyPath[] = "/fake/hci0/dev5";
const char FakeBluetoothDeviceClient::kDisplayPasskeyAddress[] =
"00:0F:F6:00:00:00";
const char FakeBluetoothDeviceClient::kDisplayPasskeyName[] =
"Bluetooth 2.1+ Keyboard";
const uint32 FakeBluetoothDeviceClient::kDisplayPasskeyClass = 0x002540;
-const char FakeBluetoothDeviceClient::kRequestPinCodePath[] =
- "/fake/hci0/dev6";
+const char FakeBluetoothDeviceClient::kRequestPinCodePath[] = "/fake/hci0/dev6";
const char FakeBluetoothDeviceClient::kRequestPinCodeAddress[] =
"00:24:BE:00:00:00";
-const char FakeBluetoothDeviceClient::kRequestPinCodeName[] =
- "PIN Device";
+const char FakeBluetoothDeviceClient::kRequestPinCodeName[] = "PIN Device";
const uint32 FakeBluetoothDeviceClient::kRequestPinCodeClass = 0x240408;
-const char FakeBluetoothDeviceClient::kConfirmPasskeyPath[] =
- "/fake/hci0/dev7";
+const char FakeBluetoothDeviceClient::kConfirmPasskeyPath[] = "/fake/hci0/dev7";
const char FakeBluetoothDeviceClient::kConfirmPasskeyAddress[] =
"20:7D:74:00:00:00";
-const char FakeBluetoothDeviceClient::kConfirmPasskeyName[] =
- "Phone";
+const char FakeBluetoothDeviceClient::kConfirmPasskeyName[] = "Phone";
const uint32 FakeBluetoothDeviceClient::kConfirmPasskeyClass = 0x7a020c;
-const char FakeBluetoothDeviceClient::kRequestPasskeyPath[] =
- "/fake/hci0/dev8";
+const char FakeBluetoothDeviceClient::kRequestPasskeyPath[] = "/fake/hci0/dev8";
const char FakeBluetoothDeviceClient::kRequestPasskeyAddress[] =
"20:7D:74:00:00:01";
-const char FakeBluetoothDeviceClient::kRequestPasskeyName[] =
- "Passkey Device";
+const char FakeBluetoothDeviceClient::kRequestPasskeyName[] = "Passkey Device";
const uint32 FakeBluetoothDeviceClient::kRequestPasskeyClass = 0x7a020c;
const char FakeBluetoothDeviceClient::kUnconnectableDevicePath[] =
@@ -197,18 +186,13 @@ const char FakeBluetoothDeviceClient::kUnpairableDeviceName[] =
"Unpairable Device";
const uint32 FakeBluetoothDeviceClient::kUnpairableDeviceClass = 0x002540;
-const char FakeBluetoothDeviceClient::kJustWorksPath[] =
- "/fake/hci0/devB";
-const char FakeBluetoothDeviceClient::kJustWorksAddress[] =
- "00:0C:8A:00:00:00";
-const char FakeBluetoothDeviceClient::kJustWorksName[] =
- "Just-Works Device";
+const char FakeBluetoothDeviceClient::kJustWorksPath[] = "/fake/hci0/devB";
+const char FakeBluetoothDeviceClient::kJustWorksAddress[] = "00:0C:8A:00:00:00";
+const char FakeBluetoothDeviceClient::kJustWorksName[] = "Just-Works Device";
const uint32 FakeBluetoothDeviceClient::kJustWorksClass = 0x240428;
-const char FakeBluetoothDeviceClient::kLowEnergyPath[] =
- "/fake/hci0/devC";
-const char FakeBluetoothDeviceClient::kLowEnergyAddress[] =
- "00:1A:11:00:15:30";
+const char FakeBluetoothDeviceClient::kLowEnergyPath[] = "/fake/hci0/devC";
+const char FakeBluetoothDeviceClient::kLowEnergyAddress[] = "00:1A:11:00:15:30";
const char FakeBluetoothDeviceClient::kLowEnergyName[] =
"Bluetooth 4.0 Heart Rate Monitor";
const uint32 FakeBluetoothDeviceClient::kLowEnergyClass =
@@ -228,11 +212,9 @@ FakeBluetoothDeviceClient::Properties::Properties(
: BluetoothDeviceClient::Properties(
NULL,
bluetooth_device::kBluetoothDeviceInterface,
- callback) {
-}
+ callback) {}
-FakeBluetoothDeviceClient::Properties::~Properties() {
-}
+FakeBluetoothDeviceClient::Properties::~Properties() {}
void FakeBluetoothDeviceClient::Properties::Get(
dbus::PropertyBase* property,
@@ -246,7 +228,7 @@ void FakeBluetoothDeviceClient::Properties::GetAll() {
}
void FakeBluetoothDeviceClient::Properties::Set(
- dbus::PropertyBase *property,
+ dbus::PropertyBase* property,
dbus::PropertySet::SetCallback callback) {
VLOG(1) << "Set " << property->name();
if (property->name() == trusted.name()) {
@@ -320,11 +302,9 @@ FakeBluetoothDeviceClient::FakeBluetoothDeviceClient()
device_list_.push_back(dbus::ObjectPath(kPairedUnconnectableDevicePath));
}
-FakeBluetoothDeviceClient::~FakeBluetoothDeviceClient() {
-}
+FakeBluetoothDeviceClient::~FakeBluetoothDeviceClient() {}
-void FakeBluetoothDeviceClient::Init(dbus::Bus* bus) {
-}
+void FakeBluetoothDeviceClient::Init(dbus::Bus* bus) {}
void FakeBluetoothDeviceClient::AddObserver(Observer* observer) {
observers_.AddObserver(observer);
@@ -343,8 +323,8 @@ std::vector<dbus::ObjectPath> FakeBluetoothDeviceClient::GetDevicesForAdapter(
return std::vector<dbus::ObjectPath>();
}
-FakeBluetoothDeviceClient::Properties*
-FakeBluetoothDeviceClient::GetProperties(const dbus::ObjectPath& object_path) {
+FakeBluetoothDeviceClient::Properties* FakeBluetoothDeviceClient::GetProperties(
+ const dbus::ObjectPath& object_path) {
PropertiesMap::const_iterator iter = properties_map_.find(object_path);
if (iter != properties_map_.end())
return iter->second;
@@ -361,10 +341,9 @@ FakeBluetoothDeviceClient::GetPairingOptions(
return iter != pairing_options_map_.end() ? iter->second : nullptr;
}
-void FakeBluetoothDeviceClient::Connect(
- const dbus::ObjectPath& object_path,
- const base::Closure& callback,
- const ErrorCallback& error_callback) {
+void FakeBluetoothDeviceClient::Connect(const dbus::ObjectPath& object_path,
+ const base::Closure& callback,
+ const ErrorCallback& error_callback) {
VLOG(1) << "Connect: " << object_path.value();
Properties* properties = GetProperties(object_path);
@@ -398,7 +377,7 @@ void FakeBluetoothDeviceClient::Connect(
if (object_path == dbus::ObjectPath(kLowEnergyPath)) {
FakeBluetoothGattServiceClient* gatt_service_client =
static_cast<FakeBluetoothGattServiceClient*>(
- DBusThreadManager::Get()->GetBluetoothGattServiceClient());
+ bluez::BluezDBusManager::Get()->GetBluetoothGattServiceClient());
gatt_service_client->ExposeHeartRateService(
dbus::ObjectPath(kLowEnergyPath));
}
@@ -422,7 +401,7 @@ void FakeBluetoothDeviceClient::Disconnect(
if (object_path == dbus::ObjectPath(kLowEnergyPath)) {
FakeBluetoothGattServiceClient* gatt_service_client =
static_cast<FakeBluetoothGattServiceClient*>(
- DBusThreadManager::Get()->GetBluetoothGattServiceClient());
+ bluez::BluezDBusManager::Get()->GetBluetoothGattServiceClient());
gatt_service_client->HideHeartRateService();
}
@@ -439,7 +418,7 @@ void FakeBluetoothDeviceClient::ConnectProfile(
FakeBluetoothProfileManagerClient* fake_bluetooth_profile_manager_client =
static_cast<FakeBluetoothProfileManagerClient*>(
- DBusThreadManager::Get()->GetBluetoothProfileManagerClient());
+ bluez::BluezDBusManager::Get()->GetBluetoothProfileManagerClient());
FakeBluetoothProfileServiceProvider* profile_service_provider =
fake_bluetooth_profile_manager_client->GetProfileServiceProvider(uuid);
if (profile_service_provider == NULL) {
@@ -478,10 +457,8 @@ void FakeBluetoothDeviceClient::ConnectProfile(
return;
}
- base::WorkerPool::GetTaskRunner(false)->PostTask(
- FROM_HERE,
- base::Bind(&SimulatedProfileSocket,
- fds[0]));
+ base::WorkerPool::GetTaskRunner(false)
+ ->PostTask(FROM_HERE, base::Bind(&SimulatedProfileSocket, fds[0]));
scoped_ptr<dbus::FileDescriptor> fd(new dbus::FileDescriptor(fds[1]));
@@ -489,13 +466,9 @@ void FakeBluetoothDeviceClient::ConnectProfile(
BluetoothProfileServiceProvider::Delegate::Options options;
profile_service_provider->NewConnection(
- object_path,
- fd.Pass(),
- options,
+ object_path, fd.Pass(), options,
base::Bind(&FakeBluetoothDeviceClient::ConnectionCallback,
- base::Unretained(this),
- object_path,
- callback,
+ base::Unretained(this), object_path, callback,
error_callback));
}
@@ -508,7 +481,7 @@ void FakeBluetoothDeviceClient::DisconnectProfile(
FakeBluetoothProfileManagerClient* fake_bluetooth_profile_manager_client =
static_cast<FakeBluetoothProfileManagerClient*>(
- DBusThreadManager::Get()->GetBluetoothProfileManagerClient());
+ bluez::BluezDBusManager::Get()->GetBluetoothProfileManagerClient());
FakeBluetoothProfileServiceProvider* profile_service_provider =
fake_bluetooth_profile_manager_client->GetProfileServiceProvider(uuid);
if (profile_service_provider == NULL) {
@@ -517,18 +490,14 @@ void FakeBluetoothDeviceClient::DisconnectProfile(
}
profile_service_provider->RequestDisconnection(
- object_path,
- base::Bind(&FakeBluetoothDeviceClient::DisconnectionCallback,
- base::Unretained(this),
- object_path,
- callback,
- error_callback));
+ object_path, base::Bind(&FakeBluetoothDeviceClient::DisconnectionCallback,
+ base::Unretained(this), object_path, callback,
+ error_callback));
}
-void FakeBluetoothDeviceClient::Pair(
- const dbus::ObjectPath& object_path,
- const base::Closure& callback,
- const ErrorCallback& error_callback) {
+void FakeBluetoothDeviceClient::Pair(const dbus::ObjectPath& object_path,
+ const base::Closure& callback,
+ const ErrorCallback& error_callback) {
VLOG(1) << "Pair: " << object_path.value();
Properties* properties = GetProperties(object_path);
@@ -610,8 +579,8 @@ void FakeBluetoothDeviceClient::SetSimulationIntervalMs(int interval_ms) {
void FakeBluetoothDeviceClient::CreateDevice(
const dbus::ObjectPath& adapter_path,
const dbus::ObjectPath& device_path) {
- if (std::find(device_list_.begin(),
- device_list_.end(), device_path) != device_list_.end())
+ if (std::find(device_list_.begin(), device_list_.end(), device_path) !=
+ device_list_.end())
return;
scoped_ptr<Properties> properties(
@@ -713,7 +682,6 @@ void FakeBluetoothDeviceClient::CreateDevice(
} else {
NOTREACHED();
-
}
properties_map_.insert(device_path, properties.Pass());
@@ -994,13 +962,13 @@ void FakeBluetoothDeviceClient::RemoveDevice(
// BluetoothDeviceChromeOS object, including the device_path referenced here.
FakeBluetoothInputClient* fake_bluetooth_input_client =
static_cast<FakeBluetoothInputClient*>(
- DBusThreadManager::Get()->GetBluetoothInputClient());
+ bluez::BluezDBusManager::Get()->GetBluetoothInputClient());
fake_bluetooth_input_client->RemoveInputDevice(device_path);
if (device_path == dbus::ObjectPath(kLowEnergyPath)) {
FakeBluetoothGattServiceClient* gatt_service_client =
static_cast<FakeBluetoothGattServiceClient*>(
- DBusThreadManager::Get()->GetBluetoothGattServiceClient());
+ bluez::BluezDBusManager::Get()->GetBluetoothGattServiceClient());
gatt_service_client->HideHeartRateService();
}
@@ -1083,7 +1051,6 @@ void FakeBluetoothDeviceClient::DiscoverySimulationTimer() {
UpdateDeviceRSSI(dbus::ObjectPath(kLowEnergyPath),
base::RandInt(kMinRSSI, kMaxRSSI));
return;
-
}
++discovery_simulation_step_;
@@ -1165,7 +1132,7 @@ void FakeBluetoothDeviceClient::SimulatePairing(
FakeBluetoothAgentManagerClient* fake_bluetooth_agent_manager_client =
static_cast<FakeBluetoothAgentManagerClient*>(
- DBusThreadManager::Get()->GetBluetoothAgentManagerClient());
+ bluez::BluezDBusManager::Get()->GetBluetoothAgentManagerClient());
FakeBluetoothAgentServiceProvider* agent_service_provider =
fake_bluetooth_agent_manager_client->GetAgentServiceProvider();
CHECK(agent_service_provider != NULL);
@@ -1416,7 +1383,7 @@ void FakeBluetoothDeviceClient::AddInputDeviceIfNeeded(
// simulate the Input interface.
FakeBluetoothInputClient* fake_bluetooth_input_client =
static_cast<FakeBluetoothInputClient*>(
- DBusThreadManager::Get()->GetBluetoothInputClient());
+ bluez::BluezDBusManager::Get()->GetBluetoothInputClient());
if ((properties->bluetooth_class.value() & 0x001f03) == 0x000500)
fake_bluetooth_input_client->AddInputDevice(object_path);
@@ -1586,7 +1553,7 @@ void FakeBluetoothDeviceClient::SimulateKeypress(
FakeBluetoothAgentManagerClient* fake_bluetooth_agent_manager_client =
static_cast<FakeBluetoothAgentManagerClient*>(
- DBusThreadManager::Get()->GetBluetoothAgentManagerClient());
+ bluez::BluezDBusManager::Get()->GetBluetoothAgentManagerClient());
FakeBluetoothAgentServiceProvider* agent_service_provider =
fake_bluetooth_agent_manager_client->GetAgentServiceProvider();
@@ -1649,4 +1616,4 @@ void FakeBluetoothDeviceClient::DisconnectionCallback(
}
}
-} // namespace chromeos
+} // namespace bluez
diff --git a/chromeos/dbus/fake_bluetooth_device_client.h b/device/bluetooth/dbus/fake_bluetooth_device_client.h
index c19e965..edc8ee6 100644
--- a/chromeos/dbus/fake_bluetooth_device_client.h
+++ b/device/bluetooth/dbus/fake_bluetooth_device_client.h
@@ -12,23 +12,23 @@
#include "base/callback.h"
#include "base/containers/scoped_ptr_map.h"
#include "base/observer_list.h"
-#include "chromeos/chromeos_export.h"
-#include "chromeos/dbus/bluetooth_agent_service_provider.h"
-#include "chromeos/dbus/bluetooth_device_client.h"
-#include "chromeos/dbus/bluetooth_profile_service_provider.h"
#include "dbus/object_path.h"
#include "dbus/property.h"
+#include "device/bluetooth/bluetooth_export.h"
+#include "device/bluetooth/dbus/bluetooth_agent_service_provider.h"
+#include "device/bluetooth/dbus/bluetooth_device_client.h"
+#include "device/bluetooth/dbus/bluetooth_profile_service_provider.h"
-namespace chromeos {
+namespace bluez {
// FakeBluetoothDeviceClient simulates the behavior of the Bluetooth Daemon
// device objects and is used both in test cases in place of a mock and on
// the Linux desktop.
-class CHROMEOS_EXPORT FakeBluetoothDeviceClient
+class DEVICE_BLUETOOTH_EXPORT FakeBluetoothDeviceClient
: public BluetoothDeviceClient {
public:
struct Properties : public BluetoothDeviceClient::Properties {
- explicit Properties(const PropertyChangedCallback & callback);
+ explicit Properties(const PropertyChangedCallback& callback);
~Properties() override;
// dbus::PropertySet override
@@ -237,52 +237,43 @@ class CHROMEOS_EXPORT FakeBluetoothDeviceClient
void DiscoverySimulationTimer();
void IncomingPairingSimulationTimer();
- void CompleteSimulatedPairing(
- const dbus::ObjectPath& object_path,
- const base::Closure& callback,
- const ErrorCallback& error_callback);
- void TimeoutSimulatedPairing(
- const dbus::ObjectPath& object_path,
- const ErrorCallback& error_callback);
- void CancelSimulatedPairing(
- const dbus::ObjectPath& object_path,
- const ErrorCallback& error_callback);
- void RejectSimulatedPairing(
- const dbus::ObjectPath& object_path,
- const ErrorCallback& error_callback);
- void FailSimulatedPairing(
- const dbus::ObjectPath& object_path,
- const ErrorCallback& error_callback);
- void AddInputDeviceIfNeeded(
- const dbus::ObjectPath& object_path,
- Properties* properties);
+ void CompleteSimulatedPairing(const dbus::ObjectPath& object_path,
+ const base::Closure& callback,
+ const ErrorCallback& error_callback);
+ void TimeoutSimulatedPairing(const dbus::ObjectPath& object_path,
+ const ErrorCallback& error_callback);
+ void CancelSimulatedPairing(const dbus::ObjectPath& object_path,
+ const ErrorCallback& error_callback);
+ void RejectSimulatedPairing(const dbus::ObjectPath& object_path,
+ const ErrorCallback& error_callback);
+ void FailSimulatedPairing(const dbus::ObjectPath& object_path,
+ const ErrorCallback& error_callback);
+ void AddInputDeviceIfNeeded(const dbus::ObjectPath& object_path,
+ Properties* properties);
// Updates the inquiry RSSI property of fake device with object path
// |object_path| to |rssi|, if the fake device exists.
void UpdateDeviceRSSI(const dbus::ObjectPath& object_path, int16 rssi);
- void PinCodeCallback(
- const dbus::ObjectPath& object_path,
- const base::Closure& callback,
- const ErrorCallback& error_callback,
- BluetoothAgentServiceProvider::Delegate::Status status,
- const std::string& pincode);
- void PasskeyCallback(
- const dbus::ObjectPath& object_path,
- const base::Closure& callback,
- const ErrorCallback& error_callback,
- BluetoothAgentServiceProvider::Delegate::Status status,
- uint32 passkey);
+ void PinCodeCallback(const dbus::ObjectPath& object_path,
+ const base::Closure& callback,
+ const ErrorCallback& error_callback,
+ BluetoothAgentServiceProvider::Delegate::Status status,
+ const std::string& pincode);
+ void PasskeyCallback(const dbus::ObjectPath& object_path,
+ const base::Closure& callback,
+ const ErrorCallback& error_callback,
+ BluetoothAgentServiceProvider::Delegate::Status status,
+ uint32 passkey);
void ConfirmationCallback(
const dbus::ObjectPath& object_path,
const base::Closure& callback,
const ErrorCallback& error_callback,
BluetoothAgentServiceProvider::Delegate::Status status);
- void SimulateKeypress(
- uint16 entered,
- const dbus::ObjectPath& object_path,
- const base::Closure& callback,
- const ErrorCallback& error_callback);
+ void SimulateKeypress(uint16 entered,
+ const dbus::ObjectPath& object_path,
+ const base::Closure& callback,
+ const ErrorCallback& error_callback);
void ConnectionCallback(
const dbus::ObjectPath& object_path,
@@ -320,6 +311,6 @@ class CHROMEOS_EXPORT FakeBluetoothDeviceClient
int16 max_transmit_power_;
};
-} // namespace chromeos
+} // namespace bluez
#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_DEVICE_CLIENT_H_
diff --git a/chromeos/dbus/fake_bluetooth_gatt_characteristic_client.cc b/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.cc
index 61bbb8d..10f073a 100644
--- a/chromeos/dbus/fake_bluetooth_gatt_characteristic_client.cc
+++ b/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_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_gatt_characteristic_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.h"
#include "base/bind.h"
#include "base/location.h"
@@ -10,11 +10,11 @@
#include "base/single_thread_task_runner.h"
#include "base/thread_task_runner_handle.h"
#include "base/time/time.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/fake_bluetooth_gatt_descriptor_client.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
+#include "device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_client.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
-namespace chromeos {
+namespace bluez {
namespace {
@@ -26,17 +26,16 @@ const int kHeartRateMeasurementNotificationIntervalMs = 2000;
FakeBluetoothGattCharacteristicClient::DelayedCallback::DelayedCallback(
base::Closure callback,
size_t delay)
- : callback_(callback), delay_(delay) {
-}
+ : callback_(callback), delay_(delay) {}
-FakeBluetoothGattCharacteristicClient::DelayedCallback::~DelayedCallback() {
-}
+FakeBluetoothGattCharacteristicClient::DelayedCallback::~DelayedCallback() {}
// static
const char FakeBluetoothGattCharacteristicClient::
kHeartRateMeasurementPathComponent[] = "char0000";
-const char FakeBluetoothGattCharacteristicClient::
- kBodySensorLocationPathComponent[] = "char0001";
+const char
+ FakeBluetoothGattCharacteristicClient::kBodySensorLocationPathComponent[] =
+ "char0001";
const char FakeBluetoothGattCharacteristicClient::
kHeartRateControlPointPathComponent[] = "char0002";
@@ -53,11 +52,9 @@ FakeBluetoothGattCharacteristicClient::Properties::Properties(
: BluetoothGattCharacteristicClient::Properties(
NULL,
bluetooth_gatt_characteristic::kBluetoothGattCharacteristicInterface,
- callback) {
-}
+ callback) {}
-FakeBluetoothGattCharacteristicClient::Properties::~Properties() {
-}
+FakeBluetoothGattCharacteristicClient::Properties::~Properties() {}
void FakeBluetoothGattCharacteristicClient::Properties::Get(
dbus::PropertyBase* property,
@@ -83,8 +80,7 @@ FakeBluetoothGattCharacteristicClient::FakeBluetoothGattCharacteristicClient()
authenticated_(true),
calories_burned_(0),
extra_requests_(0),
- weak_ptr_factory_(this) {
-}
+ weak_ptr_factory_(this) {}
FakeBluetoothGattCharacteristicClient::
~FakeBluetoothGattCharacteristicClient() {
@@ -94,8 +90,7 @@ FakeBluetoothGattCharacteristicClient::
action_extra_requests_.clear();
}
-void FakeBluetoothGattCharacteristicClient::Init(dbus::Bus* bus) {
-}
+void FakeBluetoothGattCharacteristicClient::Init(dbus::Bus* bus) {}
void FakeBluetoothGattCharacteristicClient::AddObserver(Observer* observer) {
observers_.AddObserver(observer);
@@ -247,12 +242,11 @@ void FakeBluetoothGattCharacteristicClient::WriteValue(
}
base::Closure completed_callback;
if (value.size() != 1) {
- completed_callback = base::Bind(error_callback,
- "org.bluez.Error.InvalidValueLength",
- "Invalid length for write");
+ completed_callback =
+ base::Bind(error_callback, "org.bluez.Error.InvalidValueLength",
+ "Invalid length for write");
} else if (value[0] > 1) {
- completed_callback = base::Bind(error_callback,
- "org.bluez.Error.Failed",
+ completed_callback = base::Bind(error_callback, "org.bluez.Error.Failed",
"Invalid value given for write");
} else if (value[0] == 1) {
// TODO(jamuraa): make this happen when the callback happens
@@ -337,10 +331,10 @@ void FakeBluetoothGattCharacteristicClient::ExposeHeartRateCharacteristics(
// ==== Heart Rate Measurement Characteristic ====
heart_rate_measurement_path_ =
service_path.value() + "/" + kHeartRateMeasurementPathComponent;
- heart_rate_measurement_properties_.reset(new Properties(base::Bind(
- &FakeBluetoothGattCharacteristicClient::OnPropertyChanged,
- weak_ptr_factory_.GetWeakPtr(),
- dbus::ObjectPath(heart_rate_measurement_path_))));
+ heart_rate_measurement_properties_.reset(new Properties(
+ base::Bind(&FakeBluetoothGattCharacteristicClient::OnPropertyChanged,
+ weak_ptr_factory_.GetWeakPtr(),
+ dbus::ObjectPath(heart_rate_measurement_path_))));
heart_rate_measurement_properties_->uuid.ReplaceValue(
kHeartRateMeasurementUUID);
heart_rate_measurement_properties_->service.ReplaceValue(service_path);
@@ -350,10 +344,10 @@ void FakeBluetoothGattCharacteristicClient::ExposeHeartRateCharacteristics(
// ==== Body Sensor Location Characteristic ====
body_sensor_location_path_ =
service_path.value() + "/" + kBodySensorLocationPathComponent;
- body_sensor_location_properties_.reset(new Properties(base::Bind(
- &FakeBluetoothGattCharacteristicClient::OnPropertyChanged,
- weak_ptr_factory_.GetWeakPtr(),
- dbus::ObjectPath(body_sensor_location_path_))));
+ body_sensor_location_properties_.reset(new Properties(
+ base::Bind(&FakeBluetoothGattCharacteristicClient::OnPropertyChanged,
+ weak_ptr_factory_.GetWeakPtr(),
+ dbus::ObjectPath(body_sensor_location_path_))));
body_sensor_location_properties_->uuid.ReplaceValue(kBodySensorLocationUUID);
body_sensor_location_properties_->service.ReplaceValue(service_path);
flags.clear();
@@ -363,10 +357,10 @@ void FakeBluetoothGattCharacteristicClient::ExposeHeartRateCharacteristics(
// ==== Heart Rate Control Point Characteristic ====
heart_rate_control_point_path_ =
service_path.value() + "/" + kHeartRateControlPointPathComponent;
- heart_rate_control_point_properties_.reset(new Properties(base::Bind(
- &FakeBluetoothGattCharacteristicClient::OnPropertyChanged,
- weak_ptr_factory_.GetWeakPtr(),
- dbus::ObjectPath(heart_rate_control_point_path_))));
+ heart_rate_control_point_properties_.reset(new Properties(
+ base::Bind(&FakeBluetoothGattCharacteristicClient::OnPropertyChanged,
+ weak_ptr_factory_.GetWeakPtr(),
+ dbus::ObjectPath(heart_rate_control_point_path_))));
heart_rate_control_point_properties_->uuid.ReplaceValue(
kHeartRateControlPointUUID);
heart_rate_control_point_properties_->service.ReplaceValue(service_path);
@@ -383,7 +377,7 @@ void FakeBluetoothGattCharacteristicClient::ExposeHeartRateCharacteristics(
// Expose CCC descriptor for Heart Rate Measurement characteristic.
FakeBluetoothGattDescriptorClient* descriptor_client =
static_cast<FakeBluetoothGattDescriptorClient*>(
- DBusThreadManager::Get()->GetBluetoothGattDescriptorClient());
+ bluez::BluezDBusManager::Get()->GetBluetoothGattDescriptorClient());
dbus::ObjectPath ccc_path(descriptor_client->ExposeDescriptor(
dbus::ObjectPath(heart_rate_measurement_path_),
FakeBluetoothGattDescriptorClient::
@@ -403,7 +397,7 @@ void FakeBluetoothGattCharacteristicClient::HideHeartRateCharacteristics() {
// Hide the descriptors.
FakeBluetoothGattDescriptorClient* descriptor_client =
static_cast<FakeBluetoothGattDescriptorClient*>(
- DBusThreadManager::Get()->GetBluetoothGattDescriptorClient());
+ bluez::BluezDBusManager::Get()->GetBluetoothGattDescriptorClient());
descriptor_client->HideDescriptor(
dbus::ObjectPath(heart_rate_measurement_ccc_desc_path_));
@@ -459,12 +453,12 @@ FakeBluetoothGattCharacteristicClient::GetHeartRateControlPointPath() const {
void FakeBluetoothGattCharacteristicClient::OnPropertyChanged(
const dbus::ObjectPath& object_path,
const std::string& property_name) {
- VLOG(2) << "Characteristic property changed: " << object_path.value()
- << ": " << property_name;
+ VLOG(2) << "Characteristic property changed: " << object_path.value() << ": "
+ << property_name;
- FOR_EACH_OBSERVER(BluetoothGattCharacteristicClient::Observer, observers_,
- GattCharacteristicPropertyChanged(
- object_path, property_name));
+ FOR_EACH_OBSERVER(
+ BluetoothGattCharacteristicClient::Observer, observers_,
+ GattCharacteristicPropertyChanged(object_path, property_name));
}
void FakeBluetoothGattCharacteristicClient::NotifyCharacteristicAdded(
@@ -546,7 +540,7 @@ FakeBluetoothGattCharacteristicClient::GetHeartRateMeasurementValue() {
value.energy_expanded = calories_burned_++;
// Include one RR-Interval value, in seconds.
- value.rr_interval = 60/value.bpm;
+ value.rr_interval = 60 / value.bpm;
// Return the bytes in an array.
uint8* bytes = reinterpret_cast<uint8*>(&value);
@@ -565,4 +559,4 @@ bool FakeBluetoothGattCharacteristicClient::IsHeartRateVisible() const {
return heart_rate_visible_;
}
-} // namespace chromeos
+} // namespace bluez
diff --git a/chromeos/dbus/fake_bluetooth_gatt_characteristic_client.h b/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.h
index 8366169..dc5196d 100644
--- a/chromeos/dbus/fake_bluetooth_gatt_characteristic_client.h
+++ b/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.h
@@ -12,17 +12,17 @@
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
-#include "chromeos/chromeos_export.h"
-#include "chromeos/dbus/bluetooth_gatt_characteristic_client.h"
#include "dbus/object_path.h"
#include "dbus/property.h"
+#include "device/bluetooth/bluetooth_export.h"
+#include "device/bluetooth/dbus/bluetooth_gatt_characteristic_client.h"
-namespace chromeos {
+namespace bluez {
// FakeBluetoothGattCharacteristicClient simulates the behavior of the
// Bluetooth Daemon GATT characteristic objects and is used in test cases in
// place of a mock and on the Linux desktop.
-class CHROMEOS_EXPORT FakeBluetoothGattCharacteristicClient
+class DEVICE_BLUETOOTH_EXPORT FakeBluetoothGattCharacteristicClient
: public BluetoothGattCharacteristicClient {
public:
struct Properties : public BluetoothGattCharacteristicClient::Properties {
@@ -184,12 +184,11 @@ class CHROMEOS_EXPORT FakeBluetoothGattCharacteristicClient
// 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<FakeBluetoothGattCharacteristicClient>
- weak_ptr_factory_;
+ base::WeakPtrFactory<FakeBluetoothGattCharacteristicClient> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(FakeBluetoothGattCharacteristicClient);
};
-} // namespace chromeos
+} // namespace bluez
#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_CHARACTERISTIC_CLIENT_H_
diff --git a/chromeos/dbus/fake_bluetooth_gatt_characteristic_service_provider.cc b/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.cc
index 5a548de..03f06d0 100644
--- a/chromeos/dbus/fake_bluetooth_gatt_characteristic_service_provider.cc
+++ b/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.cc
@@ -2,14 +2,14 @@
// 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_gatt_characteristic_service_provider.h"
+#include "device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.h"
#include "base/logging.h"
#include "base/strings/string_util.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/fake_bluetooth_gatt_manager_client.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
+#include "device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.h"
-namespace chromeos {
+namespace bluez {
FakeBluetoothGattCharacteristicServiceProvider::
FakeBluetoothGattCharacteristicServiceProvider(
@@ -19,27 +19,26 @@ FakeBluetoothGattCharacteristicServiceProvider::
const std::vector<std::string>& flags,
const std::vector<std::string>& permissions,
const dbus::ObjectPath& service_path)
- : object_path_(object_path),
- uuid_(uuid),
- service_path_(service_path),
- delegate_(delegate) {
+ : object_path_(object_path),
+ uuid_(uuid),
+ service_path_(service_path),
+ delegate_(delegate) {
VLOG(1) << "Creating Bluetooth GATT characteristic: " << object_path_.value();
DCHECK(object_path_.IsValid());
DCHECK(service_path_.IsValid());
DCHECK(!uuid.empty());
DCHECK(delegate_);
- DCHECK(base::StartsWith(object_path_.value(),
- service_path_.value() + "/",
+ DCHECK(base::StartsWith(object_path_.value(), service_path_.value() + "/",
base::CompareCase::SENSITIVE));
// TODO(armansito): Do something with |flags| and |permissions|.
FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client =
static_cast<FakeBluetoothGattManagerClient*>(
- DBusThreadManager::Get()->GetBluetoothGattManagerClient());
- fake_bluetooth_gatt_manager_client->
- RegisterCharacteristicServiceProvider(this);
+ bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient());
+ fake_bluetooth_gatt_manager_client->RegisterCharacteristicServiceProvider(
+ this);
}
FakeBluetoothGattCharacteristicServiceProvider::
@@ -49,9 +48,9 @@ FakeBluetoothGattCharacteristicServiceProvider::
FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client =
static_cast<FakeBluetoothGattManagerClient*>(
- DBusThreadManager::Get()->GetBluetoothGattManagerClient());
- fake_bluetooth_gatt_manager_client->
- UnregisterCharacteristicServiceProvider(this);
+ bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient());
+ fake_bluetooth_gatt_manager_client->UnregisterCharacteristicServiceProvider(
+ this);
}
void FakeBluetoothGattCharacteristicServiceProvider::SendValueChanged(
@@ -69,7 +68,7 @@ void FakeBluetoothGattCharacteristicServiceProvider::GetValue(
// Check if this characteristic is registered.
FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client =
static_cast<FakeBluetoothGattManagerClient*>(
- DBusThreadManager::Get()->GetBluetoothGattManagerClient());
+ bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient());
if (!fake_bluetooth_gatt_manager_client->IsServiceRegistered(service_path_)) {
VLOG(1) << "GATT characteristic not registered.";
error_callback.Run();
@@ -91,7 +90,7 @@ void FakeBluetoothGattCharacteristicServiceProvider::SetValue(
// Check if this characteristic is registered.
FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client =
static_cast<FakeBluetoothGattManagerClient*>(
- DBusThreadManager::Get()->GetBluetoothGattManagerClient());
+ bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient());
if (!fake_bluetooth_gatt_manager_client->IsServiceRegistered(service_path_)) {
VLOG(1) << "GATT characteristic not registered.";
error_callback.Run();
@@ -103,4 +102,4 @@ void FakeBluetoothGattCharacteristicServiceProvider::SetValue(
delegate_->SetCharacteristicValue(value, callback, error_callback);
}
-} // namespace chromeos
+} // namespace bluez
diff --git a/chromeos/dbus/fake_bluetooth_gatt_characteristic_service_provider.h b/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.h
index 8a8440b..a67d6c95 100644
--- a/chromeos/dbus/fake_bluetooth_gatt_characteristic_service_provider.h
+++ b/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.h
@@ -8,16 +8,16 @@
#include <string>
#include <vector>
-#include "chromeos/chromeos_export.h"
-#include "chromeos/dbus/bluetooth_gatt_characteristic_service_provider.h"
#include "dbus/object_path.h"
+#include "device/bluetooth/bluetooth_export.h"
+#include "device/bluetooth/dbus/bluetooth_gatt_characteristic_service_provider.h"
-namespace chromeos {
+namespace bluez {
// FakeBluetoothGattCharacteristicServiceProvider simulates behavior of a local
// GATT characteristic object and is used both in test cases in place of a mock
// and on the Linux desktop.
-class CHROMEOS_EXPORT FakeBluetoothGattCharacteristicServiceProvider
+class DEVICE_BLUETOOTH_EXPORT FakeBluetoothGattCharacteristicServiceProvider
: public BluetoothGattCharacteristicServiceProvider {
public:
FakeBluetoothGattCharacteristicServiceProvider(
@@ -61,6 +61,6 @@ class CHROMEOS_EXPORT FakeBluetoothGattCharacteristicServiceProvider
DISALLOW_COPY_AND_ASSIGN(FakeBluetoothGattCharacteristicServiceProvider);
};
-} // namespace chromeos
+} // namespace bluez
#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_H_
diff --git a/chromeos/dbus/fake_bluetooth_gatt_descriptor_client.cc b/device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_client.cc
index 5ff9bf4..dcaf1ec 100644
--- a/chromeos/dbus/fake_bluetooth_gatt_descriptor_client.cc
+++ b/device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_client.cc
@@ -2,15 +2,15 @@
// 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_gatt_descriptor_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_client.h"
#include "base/bind.h"
#include "base/logging.h"
-#include "chromeos/dbus/bluetooth_gatt_characteristic_client.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
+#include "device/bluetooth/dbus/bluetooth_gatt_characteristic_client.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
-namespace chromeos {
+namespace bluez {
const char FakeBluetoothGattDescriptorClient::
kClientCharacteristicConfigurationPathComponent[] = "desc0000";
@@ -23,11 +23,9 @@ FakeBluetoothGattDescriptorClient::Properties::Properties(
: BluetoothGattDescriptorClient::Properties(
NULL,
bluetooth_gatt_descriptor::kBluetoothGattDescriptorInterface,
- callback) {
-}
+ callback) {}
-FakeBluetoothGattDescriptorClient::Properties::~Properties() {
-}
+FakeBluetoothGattDescriptorClient::Properties::~Properties() {}
void FakeBluetoothGattDescriptorClient::Properties::Get(
dbus::PropertyBase* property,
@@ -47,24 +45,20 @@ void FakeBluetoothGattDescriptorClient::Properties::Set(
callback.Run(false);
}
-FakeBluetoothGattDescriptorClient::DescriptorData::DescriptorData() {
-}
+FakeBluetoothGattDescriptorClient::DescriptorData::DescriptorData() {}
-FakeBluetoothGattDescriptorClient::DescriptorData::~DescriptorData() {
-}
+FakeBluetoothGattDescriptorClient::DescriptorData::~DescriptorData() {}
FakeBluetoothGattDescriptorClient::FakeBluetoothGattDescriptorClient()
- : weak_ptr_factory_(this) {
-}
+ : weak_ptr_factory_(this) {}
FakeBluetoothGattDescriptorClient::~FakeBluetoothGattDescriptorClient() {
- for(PropertiesMap::iterator iter = properties_.begin(); iter !=
- properties_.end(); iter++)
+ for (PropertiesMap::iterator iter = properties_.begin();
+ iter != properties_.end(); iter++)
delete iter->second;
}
-void FakeBluetoothGattDescriptorClient::Init(dbus::Bus* bus) {
-}
+void FakeBluetoothGattDescriptorClient::Init(dbus::Bus* bus) {}
void FakeBluetoothGattDescriptorClient::AddObserver(Observer* observer) {
observers_.AddObserver(observer);
@@ -107,7 +101,7 @@ void FakeBluetoothGattDescriptorClient::ReadValue(
Properties* properties = iter->second->properties.get();
if (properties->uuid.value() == kClientCharacteristicConfigurationUUID) {
BluetoothGattCharacteristicClient::Properties* chrc_props =
- DBusThreadManager::Get()
+ bluez::BluezDBusManager::Get()
->GetBluetoothGattCharacteristicClient()
->GetProperties(properties->characteristic.value());
DCHECK(chrc_props);
@@ -151,9 +145,8 @@ dbus::ObjectPath FakeBluetoothGattDescriptorClient::ExposeDescriptor(
// CCC descriptor is the only one supported at the moment.
DCHECK(characteristic_path.IsValid());
- dbus::ObjectPath object_path(
- characteristic_path.value() + "/" +
- kClientCharacteristicConfigurationPathComponent);
+ dbus::ObjectPath object_path(characteristic_path.value() + "/" +
+ kClientCharacteristicConfigurationPathComponent);
DCHECK(object_path.IsValid());
PropertiesMap::const_iterator iter = properties_.find(object_path);
if (iter != properties_.end()) {
@@ -161,10 +154,9 @@ dbus::ObjectPath FakeBluetoothGattDescriptorClient::ExposeDescriptor(
return dbus::ObjectPath();
}
- Properties* properties = new Properties(base::Bind(
- &FakeBluetoothGattDescriptorClient::OnPropertyChanged,
- weak_ptr_factory_.GetWeakPtr(),
- object_path));
+ Properties* properties = new Properties(
+ base::Bind(&FakeBluetoothGattDescriptorClient::OnPropertyChanged,
+ weak_ptr_factory_.GetWeakPtr(), object_path));
properties->uuid.ReplaceValue(uuid);
properties->characteristic.ReplaceValue(characteristic_path);
@@ -195,8 +187,8 @@ void FakeBluetoothGattDescriptorClient::HideDescriptor(
void FakeBluetoothGattDescriptorClient::OnPropertyChanged(
const dbus::ObjectPath& object_path,
const std::string& property_name) {
- VLOG(2) << "Descriptor property changed: " << object_path.value()
- << ": " << property_name;
+ VLOG(2) << "Descriptor property changed: " << object_path.value() << ": "
+ << property_name;
FOR_EACH_OBSERVER(BluetoothGattDescriptorClient::Observer, observers_,
GattDescriptorPropertyChanged(object_path, property_name));
@@ -214,4 +206,4 @@ void FakeBluetoothGattDescriptorClient::NotifyDescriptorRemoved(
GattDescriptorRemoved(object_path));
}
-} // namespace chromeos
+} // namespace bluez
diff --git a/chromeos/dbus/fake_bluetooth_gatt_descriptor_client.h b/device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_client.h
index fe405c7..e933664 100644
--- a/chromeos/dbus/fake_bluetooth_gatt_descriptor_client.h
+++ b/device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_client.h
@@ -10,16 +10,16 @@
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
-#include "chromeos/chromeos_export.h"
-#include "chromeos/dbus/bluetooth_gatt_descriptor_client.h"
#include "dbus/object_path.h"
+#include "device/bluetooth/bluetooth_export.h"
+#include "device/bluetooth/dbus/bluetooth_gatt_descriptor_client.h"
-namespace chromeos {
+namespace bluez {
// FakeBluetoothGattDescriptorClient simulates the behavior of the Bluetooth
// Daemon GATT characteristic descriptor objects and is used in test cases in
// place of a mock and on the Linux desktop.
-class CHROMEOS_EXPORT FakeBluetoothGattDescriptorClient
+class DEVICE_BLUETOOTH_EXPORT FakeBluetoothGattDescriptorClient
: public BluetoothGattDescriptorClient {
public:
struct Properties : public BluetoothGattDescriptorClient::Properties {
@@ -93,12 +93,11 @@ class CHROMEOS_EXPORT FakeBluetoothGattDescriptorClient
// 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<FakeBluetoothGattDescriptorClient>
- weak_ptr_factory_;
+ base::WeakPtrFactory<FakeBluetoothGattDescriptorClient> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(FakeBluetoothGattDescriptorClient);
};
-} // namespace chromeos
+} // namespace bluez
#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_CLIENT_H_
diff --git a/chromeos/dbus/fake_bluetooth_gatt_descriptor_service_provider.cc b/device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_service_provider.cc
index 9779c3a..4376ce9 100644
--- a/chromeos/dbus/fake_bluetooth_gatt_descriptor_service_provider.cc
+++ b/device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_service_provider.cc
@@ -2,15 +2,15 @@
// 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_gatt_descriptor_service_provider.h"
+#include "device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_service_provider.h"
#include "base/logging.h"
#include "base/strings/string_util.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/fake_bluetooth_gatt_characteristic_service_provider.h"
-#include "chromeos/dbus/fake_bluetooth_gatt_manager_client.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
+#include "device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.h"
+#include "device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.h"
-namespace chromeos {
+namespace bluez {
FakeBluetoothGattDescriptorServiceProvider::
FakeBluetoothGattDescriptorServiceProvider(
@@ -19,10 +19,10 @@ FakeBluetoothGattDescriptorServiceProvider::
const std::string& uuid,
const std::vector<std::string>& permissions,
const dbus::ObjectPath& characteristic_path)
- : object_path_(object_path),
- uuid_(uuid),
- characteristic_path_(characteristic_path),
- delegate_(delegate) {
+ : object_path_(object_path),
+ uuid_(uuid),
+ characteristic_path_(characteristic_path),
+ delegate_(delegate) {
VLOG(1) << "Creating Bluetooth GATT descriptor: " << object_path_.value();
DCHECK(object_path_.IsValid());
@@ -37,21 +37,18 @@ FakeBluetoothGattDescriptorServiceProvider::
FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client =
static_cast<FakeBluetoothGattManagerClient*>(
- DBusThreadManager::Get()->GetBluetoothGattManagerClient());
- fake_bluetooth_gatt_manager_client->
- RegisterDescriptorServiceProvider(this);
+ bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient());
+ fake_bluetooth_gatt_manager_client->RegisterDescriptorServiceProvider(this);
}
FakeBluetoothGattDescriptorServiceProvider::
~FakeBluetoothGattDescriptorServiceProvider() {
- VLOG(1) << "Cleaning up Bluetooth GATT descriptor: "
- << object_path_.value();
+ VLOG(1) << "Cleaning up Bluetooth GATT descriptor: " << object_path_.value();
FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client =
static_cast<FakeBluetoothGattManagerClient*>(
- DBusThreadManager::Get()->GetBluetoothGattManagerClient());
- fake_bluetooth_gatt_manager_client->
- UnregisterDescriptorServiceProvider(this);
+ bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient());
+ fake_bluetooth_gatt_manager_client->UnregisterDescriptorServiceProvider(this);
}
void FakeBluetoothGattDescriptorServiceProvider::SendValueChanged(
@@ -69,7 +66,7 @@ void FakeBluetoothGattDescriptorServiceProvider::GetValue(
// Check if this descriptor is registered.
FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client =
static_cast<FakeBluetoothGattManagerClient*>(
- DBusThreadManager::Get()->GetBluetoothGattManagerClient());
+ bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient());
FakeBluetoothGattCharacteristicServiceProvider* characteristic =
fake_bluetooth_gatt_manager_client->GetCharacteristicServiceProvider(
characteristic_path_);
@@ -100,7 +97,7 @@ void FakeBluetoothGattDescriptorServiceProvider::SetValue(
// Check if this descriptor is registered.
FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client =
static_cast<FakeBluetoothGattManagerClient*>(
- DBusThreadManager::Get()->GetBluetoothGattManagerClient());
+ bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient());
FakeBluetoothGattCharacteristicServiceProvider* characteristic =
fake_bluetooth_gatt_manager_client->GetCharacteristicServiceProvider(
characteristic_path_);
@@ -121,4 +118,4 @@ void FakeBluetoothGattDescriptorServiceProvider::SetValue(
delegate_->SetDescriptorValue(value, callback, error_callback);
}
-} // namespace chromeos
+} // namespace bluez
diff --git a/chromeos/dbus/fake_bluetooth_gatt_descriptor_service_provider.h b/device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_service_provider.h
index e9099b9..7e53625 100644
--- a/chromeos/dbus/fake_bluetooth_gatt_descriptor_service_provider.h
+++ b/device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_service_provider.h
@@ -8,16 +8,16 @@
#include <string>
#include <vector>
-#include "chromeos/chromeos_export.h"
-#include "chromeos/dbus/bluetooth_gatt_descriptor_service_provider.h"
#include "dbus/object_path.h"
+#include "device/bluetooth/bluetooth_export.h"
+#include "device/bluetooth/dbus/bluetooth_gatt_descriptor_service_provider.h"
-namespace chromeos {
+namespace bluez {
// FakeBluetoothGattDescriptorServiceProvider simulates behavior of a local
// GATT descriptor object and is used both in test cases in place of a mock
// and on the Linux desktop.
-class CHROMEOS_EXPORT FakeBluetoothGattDescriptorServiceProvider
+class DEVICE_BLUETOOTH_EXPORT FakeBluetoothGattDescriptorServiceProvider
: public BluetoothGattDescriptorServiceProvider {
public:
FakeBluetoothGattDescriptorServiceProvider(
@@ -43,7 +43,7 @@ class CHROMEOS_EXPORT FakeBluetoothGattDescriptorServiceProvider
const dbus::ObjectPath& object_path() const { return object_path_; }
const std::string& uuid() const { return uuid_; }
const dbus::ObjectPath& characteristic_path() const {
- return characteristic_path_;
+ return characteristic_path_;
}
private:
@@ -62,6 +62,6 @@ class CHROMEOS_EXPORT FakeBluetoothGattDescriptorServiceProvider
DISALLOW_COPY_AND_ASSIGN(FakeBluetoothGattDescriptorServiceProvider);
};
-} // namespace chromeos
+} // namespace bluez
#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_H_
diff --git a/chromeos/dbus/fake_bluetooth_gatt_manager_client.cc b/device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.cc
index c09232f..284a17c 100644
--- a/chromeos/dbus/fake_bluetooth_gatt_manager_client.cc
+++ b/device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.cc
@@ -2,25 +2,22 @@
// 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_gatt_manager_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.h"
#include "base/logging.h"
-#include "chromeos/dbus/fake_bluetooth_gatt_characteristic_service_provider.h"
-#include "chromeos/dbus/fake_bluetooth_gatt_descriptor_service_provider.h"
-#include "chromeos/dbus/fake_bluetooth_gatt_service_service_provider.h"
+#include "device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.h"
+#include "device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_service_provider.h"
+#include "device/bluetooth/dbus/fake_bluetooth_gatt_service_service_provider.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
-namespace chromeos {
+namespace bluez {
-FakeBluetoothGattManagerClient::FakeBluetoothGattManagerClient() {
-}
+FakeBluetoothGattManagerClient::FakeBluetoothGattManagerClient() {}
-FakeBluetoothGattManagerClient::~FakeBluetoothGattManagerClient() {
-}
+FakeBluetoothGattManagerClient::~FakeBluetoothGattManagerClient() {}
// DBusClient override.
-void FakeBluetoothGattManagerClient::Init(dbus::Bus* bus) {
-}
+void FakeBluetoothGattManagerClient::Init(dbus::Bus* bus) {}
// BluetoothGattManagerClient overrides.
void FakeBluetoothGattManagerClient::RegisterService(
@@ -69,9 +66,8 @@ void FakeBluetoothGattManagerClient::UnregisterService(
// Return error if the GATT service wasn't registered before.
ServiceProvider* provider = &iter->second;
if (!provider->first) {
- error_callback.Run(
- bluetooth_gatt_manager::kErrorDoesNotExist,
- "GATT service not registered: " + service_path.value());
+ error_callback.Run(bluetooth_gatt_manager::kErrorDoesNotExist,
+ "GATT service not registered: " + service_path.value());
return;
}
@@ -108,8 +104,7 @@ void FakeBluetoothGattManagerClient::RegisterCharacteristicServiceProvider(
void FakeBluetoothGattManagerClient::RegisterDescriptorServiceProvider(
FakeBluetoothGattDescriptorServiceProvider* provider) {
// Ignore, if a service provider is already registered for the object path.
- DescriptorMap::iterator iter =
- descriptor_map_.find(provider->object_path());
+ DescriptorMap::iterator iter = descriptor_map_.find(provider->object_path());
if (iter != descriptor_map_.end()) {
VLOG(1) << "GATT descriptor service provider already registered for "
<< "object path: " << provider->object_path().value();
@@ -120,8 +115,7 @@ void FakeBluetoothGattManagerClient::RegisterDescriptorServiceProvider(
void FakeBluetoothGattManagerClient::UnregisterServiceServiceProvider(
FakeBluetoothGattServiceServiceProvider* provider) {
- ServiceMap::iterator iter =
- service_map_.find(provider->object_path());
+ ServiceMap::iterator iter = service_map_.find(provider->object_path());
if (iter != service_map_.end() && iter->second.second == provider)
service_map_.erase(iter);
}
@@ -147,7 +141,7 @@ FakeBluetoothGattManagerClient::GetServiceServiceProvider(
FakeBluetoothGattCharacteristicServiceProvider*
FakeBluetoothGattManagerClient::GetCharacteristicServiceProvider(
- const dbus::ObjectPath& object_path) const {
+ const dbus::ObjectPath& object_path) const {
CharacteristicMap::const_iterator iter =
characteristic_map_.find(object_path);
if (iter == characteristic_map_.end())
@@ -172,4 +166,4 @@ bool FakeBluetoothGattManagerClient::IsServiceRegistered(
return iter->second.first;
}
-} // namespace chromeos
+} // namespace bluez
diff --git a/chromeos/dbus/fake_bluetooth_gatt_manager_client.h b/device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.h
index 9dccaac..32209df 100644
--- a/chromeos/dbus/fake_bluetooth_gatt_manager_client.h
+++ b/device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.h
@@ -10,11 +10,11 @@
#include <utility>
#include "base/callback.h"
-#include "chromeos/chromeos_export.h"
-#include "chromeos/dbus/bluetooth_gatt_manager_client.h"
#include "dbus/object_path.h"
+#include "device/bluetooth/bluetooth_export.h"
+#include "device/bluetooth/dbus/bluetooth_gatt_manager_client.h"
-namespace chromeos {
+namespace bluez {
class FakeBluetoothGattCharacteristicServiceProvider;
class FakeBluetoothGattDescriptorServiceProvider;
@@ -23,7 +23,7 @@ class FakeBluetoothGattServiceServiceProvider;
// FakeBluetoothGattManagerClient simulates the behavior of the Bluetooth
// daemon's GATT manager object and is used both in test cases in place of a
// mock and on the Linux desktop.
-class CHROMEOS_EXPORT FakeBluetoothGattManagerClient
+class DEVICE_BLUETOOTH_EXPORT FakeBluetoothGattManagerClient
: public BluetoothGattManagerClient {
public:
FakeBluetoothGattManagerClient();
@@ -60,13 +60,12 @@ class CHROMEOS_EXPORT FakeBluetoothGattManagerClient
// Return a pointer to the service provider that corresponds to the object
// path |object_path| if it exists.
- FakeBluetoothGattServiceServiceProvider*
- GetServiceServiceProvider(const dbus::ObjectPath& object_path) const;
+ FakeBluetoothGattServiceServiceProvider* GetServiceServiceProvider(
+ const dbus::ObjectPath& object_path) const;
FakeBluetoothGattCharacteristicServiceProvider*
- GetCharacteristicServiceProvider(
- const dbus::ObjectPath& object_path) const;
- FakeBluetoothGattDescriptorServiceProvider*
- GetDescriptorServiceProvider(const dbus::ObjectPath& object_path) const;
+ GetCharacteristicServiceProvider(const dbus::ObjectPath& object_path) const;
+ FakeBluetoothGattDescriptorServiceProvider* GetDescriptorServiceProvider(
+ const dbus::ObjectPath& object_path) const;
// Returns true, if a GATT service with object path |object_path| was
// registered with the GATT manager using RegisterService.
@@ -76,12 +75,11 @@ class CHROMEOS_EXPORT FakeBluetoothGattManagerClient
// Mappings for GATT service, characteristic, and descriptor service
// providers. The fake GATT manager stores references to all instances
// created so that they can be obtained by tests.
- typedef std::map<
- dbus::ObjectPath, FakeBluetoothGattCharacteristicServiceProvider*>
+ typedef std::map<dbus::ObjectPath,
+ FakeBluetoothGattCharacteristicServiceProvider*>
CharacteristicMap;
- typedef std::map<
- dbus::ObjectPath, FakeBluetoothGattDescriptorServiceProvider*>
- DescriptorMap;
+ typedef std::map<dbus::ObjectPath,
+ FakeBluetoothGattDescriptorServiceProvider*> DescriptorMap;
// The mapping for services is from object paths to pairs of boolean and
// service provider pointer, where the boolean denotes whether or not the
@@ -97,6 +95,6 @@ class CHROMEOS_EXPORT FakeBluetoothGattManagerClient
DISALLOW_COPY_AND_ASSIGN(FakeBluetoothGattManagerClient);
};
-} // namespace chromeos
+} // namespace bluez
#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_MANAGER_CLIENT_H_
diff --git a/chromeos/dbus/fake_bluetooth_gatt_service_client.cc b/device/bluetooth/dbus/fake_bluetooth_gatt_service_client.cc
index 1a56642..2e7aa0a 100644
--- a/chromeos/dbus/fake_bluetooth_gatt_service_client.cc
+++ b/device/bluetooth/dbus/fake_bluetooth_gatt_service_client.cc
@@ -2,18 +2,18 @@
// 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_gatt_service_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_gatt_service_client.h"
#include "base/bind.h"
#include "base/location.h"
#include "base/single_thread_task_runner.h"
#include "base/thread_task_runner_handle.h"
#include "base/time/time.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/fake_bluetooth_gatt_characteristic_client.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
+#include "device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
-namespace chromeos {
+namespace bluez {
namespace {
@@ -30,13 +30,11 @@ const char FakeBluetoothGattServiceClient::kHeartRateServiceUUID[] =
FakeBluetoothGattServiceClient::Properties::Properties(
const PropertyChangedCallback& callback)
: BluetoothGattServiceClient::Properties(
- NULL,
- bluetooth_gatt_service::kBluetoothGattServiceInterface,
- callback) {
-}
+ NULL,
+ bluetooth_gatt_service::kBluetoothGattServiceInterface,
+ callback) {}
-FakeBluetoothGattServiceClient::Properties::~Properties() {
-}
+FakeBluetoothGattServiceClient::Properties::~Properties() {}
void FakeBluetoothGattServiceClient::Properties::Get(
dbus::PropertyBase* property,
@@ -57,14 +55,11 @@ void FakeBluetoothGattServiceClient::Properties::Set(
}
FakeBluetoothGattServiceClient::FakeBluetoothGattServiceClient()
- : weak_ptr_factory_(this) {
-}
+ : weak_ptr_factory_(this) {}
-FakeBluetoothGattServiceClient::~FakeBluetoothGattServiceClient() {
-}
+FakeBluetoothGattServiceClient::~FakeBluetoothGattServiceClient() {}
-void FakeBluetoothGattServiceClient::Init(dbus::Bus* bus) {
-}
+void FakeBluetoothGattServiceClient::Init(dbus::Bus* bus) {}
void FakeBluetoothGattServiceClient::AddObserver(Observer* observer) {
observers_.AddObserver(observer);
@@ -103,8 +98,7 @@ void FakeBluetoothGattServiceClient::ExposeHeartRateService(
device_path.value() + "/" + kHeartRateServicePathComponent;
heart_rate_service_properties_.reset(new Properties(base::Bind(
&FakeBluetoothGattServiceClient::OnPropertyChanged,
- base::Unretained(this),
- dbus::ObjectPath(heart_rate_service_path_))));
+ base::Unretained(this), dbus::ObjectPath(heart_rate_service_path_))));
heart_rate_service_properties_->uuid.ReplaceValue(kHeartRateServiceUUID);
heart_rate_service_properties_->device.ReplaceValue(device_path);
heart_rate_service_properties_->primary.ReplaceValue(true);
@@ -128,7 +122,8 @@ void FakeBluetoothGattServiceClient::HideHeartRateService() {
VLOG(2) << "Hiding fake Heart Rate Service.";
FakeBluetoothGattCharacteristicClient* char_client =
static_cast<FakeBluetoothGattCharacteristicClient*>(
- DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient());
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothGattCharacteristicClient());
char_client->HideHeartRateCharacteristics();
// Notify observers before deleting the properties structure so that it
@@ -143,8 +138,8 @@ bool FakeBluetoothGattServiceClient::IsHeartRateVisible() const {
return !!heart_rate_service_properties_.get();
}
-dbus::ObjectPath
-FakeBluetoothGattServiceClient::GetHeartRateServicePath() const {
+dbus::ObjectPath FakeBluetoothGattServiceClient::GetHeartRateServicePath()
+ const {
return dbus::ObjectPath(heart_rate_service_path_);
}
@@ -160,17 +155,15 @@ void FakeBluetoothGattServiceClient::OnPropertyChanged(
void FakeBluetoothGattServiceClient::NotifyServiceAdded(
const dbus::ObjectPath& object_path) {
VLOG(2) << "GATT service added: " << object_path.value();
- FOR_EACH_OBSERVER(
- BluetoothGattServiceClient::Observer, observers_,
- GattServiceAdded(object_path));
+ FOR_EACH_OBSERVER(BluetoothGattServiceClient::Observer, observers_,
+ GattServiceAdded(object_path));
}
void FakeBluetoothGattServiceClient::NotifyServiceRemoved(
const dbus::ObjectPath& object_path) {
VLOG(2) << "GATT service removed: " << object_path.value();
- FOR_EACH_OBSERVER(
- BluetoothGattServiceClient::Observer, observers_,
- GattServiceRemoved(object_path));
+ FOR_EACH_OBSERVER(BluetoothGattServiceClient::Observer, observers_,
+ GattServiceRemoved(object_path));
}
void FakeBluetoothGattServiceClient::ExposeHeartRateCharacteristics() {
@@ -180,7 +173,8 @@ void FakeBluetoothGattServiceClient::ExposeHeartRateCharacteristics() {
}
FakeBluetoothGattCharacteristicClient* char_client =
static_cast<FakeBluetoothGattCharacteristicClient*>(
- DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient());
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothGattCharacteristicClient());
char_client->ExposeHeartRateCharacteristics(
dbus::ObjectPath(heart_rate_service_path_));
@@ -192,4 +186,4 @@ void FakeBluetoothGattServiceClient::ExposeHeartRateCharacteristics() {
heart_rate_service_properties_->characteristics.ReplaceValue(char_paths);
}
-} // namespace chromeos
+} // namespace bluez
diff --git a/chromeos/dbus/fake_bluetooth_gatt_service_client.h b/device/bluetooth/dbus/fake_bluetooth_gatt_service_client.h
index f719727..d25e9d2 100644
--- a/chromeos/dbus/fake_bluetooth_gatt_service_client.h
+++ b/device/bluetooth/dbus/fake_bluetooth_gatt_service_client.h
@@ -11,17 +11,17 @@
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
-#include "chromeos/chromeos_export.h"
-#include "chromeos/dbus/bluetooth_gatt_service_client.h"
#include "dbus/object_path.h"
#include "dbus/property.h"
+#include "device/bluetooth/bluetooth_export.h"
+#include "device/bluetooth/dbus/bluetooth_gatt_service_client.h"
-namespace chromeos {
+namespace bluez {
// FakeBluetoothGattServiceClient simulates the behavior of the Bluetooth Daemon
// GATT service objects and is used in test cases in place of a mock and on the
// Linux desktop.
-class CHROMEOS_EXPORT FakeBluetoothGattServiceClient
+class DEVICE_BLUETOOTH_EXPORT FakeBluetoothGattServiceClient
: public BluetoothGattServiceClient {
public:
struct Properties : public BluetoothGattServiceClient::Properties {
@@ -101,6 +101,6 @@ class CHROMEOS_EXPORT FakeBluetoothGattServiceClient
DISALLOW_COPY_AND_ASSIGN(FakeBluetoothGattServiceClient);
};
-} // namespace chromeos
+} // namespace bluez
#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_SERVICE_CLIENT_H_
diff --git a/chromeos/dbus/fake_bluetooth_gatt_service_service_provider.cc b/device/bluetooth/dbus/fake_bluetooth_gatt_service_service_provider.cc
index d06abd3..8d724058 100644
--- a/chromeos/dbus/fake_bluetooth_gatt_service_service_provider.cc
+++ b/device/bluetooth/dbus/fake_bluetooth_gatt_service_service_provider.cc
@@ -2,27 +2,25 @@
// 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_gatt_service_service_provider.h"
+#include "device/bluetooth/dbus/fake_bluetooth_gatt_service_service_provider.h"
#include "base/logging.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/fake_bluetooth_gatt_manager_client.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
+#include "device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.h"
-namespace chromeos {
+namespace bluez {
FakeBluetoothGattServiceServiceProvider::
FakeBluetoothGattServiceServiceProvider(
const dbus::ObjectPath& object_path,
const std::string& uuid,
const std::vector<dbus::ObjectPath>& includes)
- : object_path_(object_path),
- uuid_(uuid),
- includes_(includes) {
+ : object_path_(object_path), uuid_(uuid), includes_(includes) {
VLOG(1) << "Creating Bluetooth GATT service: " << object_path_.value();
FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client =
static_cast<FakeBluetoothGattManagerClient*>(
- DBusThreadManager::Get()->GetBluetoothGattManagerClient());
+ bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient());
fake_bluetooth_gatt_manager_client->RegisterServiceServiceProvider(this);
}
@@ -32,8 +30,8 @@ FakeBluetoothGattServiceServiceProvider::
FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client =
static_cast<FakeBluetoothGattManagerClient*>(
- DBusThreadManager::Get()->GetBluetoothGattManagerClient());
+ bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient());
fake_bluetooth_gatt_manager_client->UnregisterServiceServiceProvider(this);
}
-} // namespace chromeos
+} // namespace bluez
diff --git a/chromeos/dbus/fake_bluetooth_gatt_service_service_provider.h b/device/bluetooth/dbus/fake_bluetooth_gatt_service_service_provider.h
index a1a1253..69b71fd 100644
--- a/chromeos/dbus/fake_bluetooth_gatt_service_service_provider.h
+++ b/device/bluetooth/dbus/fake_bluetooth_gatt_service_service_provider.h
@@ -8,16 +8,16 @@
#include <string>
#include <vector>
-#include "chromeos/chromeos_export.h"
-#include "chromeos/dbus/bluetooth_gatt_service_service_provider.h"
#include "dbus/object_path.h"
+#include "device/bluetooth/bluetooth_export.h"
+#include "device/bluetooth/dbus/bluetooth_gatt_service_service_provider.h"
-namespace chromeos {
+namespace bluez {
// FakeBluetoothGattServiceServiceProvider simulates behavior of a local GATT
// service object and is used both in test cases in place of a mock and on the
// Linux desktop.
-class CHROMEOS_EXPORT FakeBluetoothGattServiceServiceProvider
+class DEVICE_BLUETOOTH_EXPORT FakeBluetoothGattServiceServiceProvider
: public BluetoothGattServiceServiceProvider {
public:
FakeBluetoothGattServiceServiceProvider(
@@ -42,6 +42,6 @@ class CHROMEOS_EXPORT FakeBluetoothGattServiceServiceProvider
DISALLOW_COPY_AND_ASSIGN(FakeBluetoothGattServiceServiceProvider);
};
-} // namespace chromeos
+} // namespace bluez
#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_SERVICE_SERVICE_PROVIDER_H_
diff --git a/chromeos/dbus/fake_bluetooth_input_client.cc b/device/bluetooth/dbus/fake_bluetooth_input_client.cc
index d32bbef..849c3be 100644
--- a/chromeos/dbus/fake_bluetooth_input_client.cc
+++ b/device/bluetooth/dbus/fake_bluetooth_input_client.cc
@@ -2,31 +2,29 @@
// 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_input_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_input_client.h"
#include <map>
#include "base/logging.h"
#include "base/stl_util.h"
-#include "chromeos/dbus/fake_bluetooth_device_client.h"
#include "dbus/bus.h"
#include "dbus/message.h"
#include "dbus/object_manager.h"
#include "dbus/object_proxy.h"
+#include "device/bluetooth/dbus/fake_bluetooth_device_client.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
-namespace chromeos {
+namespace bluez {
FakeBluetoothInputClient::Properties::Properties(
const PropertyChangedCallback& callback)
: BluetoothInputClient::Properties(
NULL,
bluetooth_input::kBluetoothInputInterface,
- callback) {
-}
+ callback) {}
-FakeBluetoothInputClient::Properties::~Properties() {
-}
+FakeBluetoothInputClient::Properties::~Properties() {}
void FakeBluetoothInputClient::Properties::Get(
dbus::PropertyBase* property,
@@ -40,23 +38,20 @@ void FakeBluetoothInputClient::Properties::GetAll() {
}
void FakeBluetoothInputClient::Properties::Set(
- dbus::PropertyBase *property,
+ dbus::PropertyBase* property,
dbus::PropertySet::SetCallback callback) {
VLOG(1) << "Set " << property->name();
callback.Run(false);
}
-
-FakeBluetoothInputClient::FakeBluetoothInputClient() {
-}
+FakeBluetoothInputClient::FakeBluetoothInputClient() {}
FakeBluetoothInputClient::~FakeBluetoothInputClient() {
// Clean up Properties structures
STLDeleteValues(&properties_map_);
}
-void FakeBluetoothInputClient::Init(dbus::Bus* bus) {
-}
+void FakeBluetoothInputClient::Init(dbus::Bus* bus) {}
void FakeBluetoothInputClient::AddObserver(Observer* observer) {
observers_.AddObserver(observer);
@@ -66,8 +61,8 @@ void FakeBluetoothInputClient::RemoveObserver(Observer* observer) {
observers_.RemoveObserver(observer);
}
-FakeBluetoothInputClient::Properties*
-FakeBluetoothInputClient::GetProperties(const dbus::ObjectPath& object_path) {
+FakeBluetoothInputClient::Properties* FakeBluetoothInputClient::GetProperties(
+ const dbus::ObjectPath& object_path) {
PropertiesMap::iterator iter = properties_map_.find(object_path);
if (iter != properties_map_.end())
return iter->second;
@@ -79,10 +74,9 @@ void FakeBluetoothInputClient::AddInputDevice(
if (properties_map_.find(object_path) != properties_map_.end())
return;
- Properties* properties = new Properties(base::Bind(
- &FakeBluetoothInputClient::OnPropertyChanged,
- base::Unretained(this),
- object_path));
+ Properties* properties =
+ new Properties(base::Bind(&FakeBluetoothInputClient::OnPropertyChanged,
+ base::Unretained(this), object_path));
// The LegacyAutopair and DisplayPinCode devices represent a typical mouse
// and keyboard respectively, so mark them as ReconnectMode "any". The
@@ -126,4 +120,4 @@ void FakeBluetoothInputClient::OnPropertyChanged(
InputPropertyChanged(object_path, property_name));
}
-} // namespace chromeos
+} // namespace bluez
diff --git a/chromeos/dbus/fake_bluetooth_input_client.h b/device/bluetooth/dbus/fake_bluetooth_input_client.h
index 56633ff..e7a3b0a 100644
--- a/chromeos/dbus/fake_bluetooth_input_client.h
+++ b/device/bluetooth/dbus/fake_bluetooth_input_client.h
@@ -7,21 +7,21 @@
#include "base/callback.h"
#include "base/observer_list.h"
-#include "chromeos/chromeos_export.h"
-#include "chromeos/dbus/bluetooth_input_client.h"
#include "dbus/object_path.h"
#include "dbus/property.h"
+#include "device/bluetooth/bluetooth_export.h"
+#include "device/bluetooth/dbus/bluetooth_input_client.h"
-namespace chromeos {
+namespace bluez {
// FakeBluetoothInputClient simulates the behavior of the Bluetooth Daemon
// input device objects and is used both in test cases in place of a mock and on
// the Linux desktop.
-class CHROMEOS_EXPORT FakeBluetoothInputClient
+class DEVICE_BLUETOOTH_EXPORT FakeBluetoothInputClient
: public BluetoothInputClient {
public:
struct Properties : public BluetoothInputClient::Properties {
- explicit Properties(const PropertyChangedCallback & callback);
+ explicit Properties(const PropertyChangedCallback& callback);
~Properties() override;
// dbus::PropertySet override
@@ -51,7 +51,7 @@ class CHROMEOS_EXPORT FakeBluetoothInputClient
const std::string& property_name);
// Static properties we return.
- typedef std::map<const dbus::ObjectPath, Properties *> PropertiesMap;
+ typedef std::map<const dbus::ObjectPath, Properties*> PropertiesMap;
PropertiesMap properties_map_;
// List of observers interested in event notifications from us.
@@ -60,6 +60,6 @@ class CHROMEOS_EXPORT FakeBluetoothInputClient
DISALLOW_COPY_AND_ASSIGN(FakeBluetoothInputClient);
};
-} // namespace chromeos
+} // namespace bluez
#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_INPUT_CLIENT_H_
diff --git a/chromeos/dbus/fake_bluetooth_le_advertisement_service_provider.cc b/device/bluetooth/dbus/fake_bluetooth_le_advertisement_service_provider.cc
index ce46e3d..043df05 100644
--- a/chromeos/dbus/fake_bluetooth_le_advertisement_service_provider.cc
+++ b/device/bluetooth/dbus/fake_bluetooth_le_advertisement_service_provider.cc
@@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/fake_bluetooth_le_advertisement_service_provider.h"
-#include "chromeos/dbus/fake_bluetooth_le_advertising_manager_client.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
+#include "device/bluetooth/dbus/fake_bluetooth_le_advertisement_service_provider.h"
+#include "device/bluetooth/dbus/fake_bluetooth_le_advertising_manager_client.h"
-namespace chromeos {
+namespace bluez {
FakeBluetoothLEAdvertisementServiceProvider::
FakeBluetoothLEAdvertisementServiceProvider(
@@ -19,7 +19,7 @@ FakeBluetoothLEAdvertisementServiceProvider::
FakeBluetoothLEAdvertisingManagerClient*
fake_bluetooth_profile_manager_client =
static_cast<FakeBluetoothLEAdvertisingManagerClient*>(
- DBusThreadManager::Get()
+ bluez::BluezDBusManager::Get()
->GetBluetoothLEAdvertisingManagerClient());
fake_bluetooth_profile_manager_client->RegisterAdvertisementServiceProvider(
this);
@@ -32,7 +32,7 @@ FakeBluetoothLEAdvertisementServiceProvider::
FakeBluetoothLEAdvertisingManagerClient*
fake_bluetooth_profile_manager_client =
static_cast<FakeBluetoothLEAdvertisingManagerClient*>(
- DBusThreadManager::Get()
+ bluez::BluezDBusManager::Get()
->GetBluetoothLEAdvertisingManagerClient());
fake_bluetooth_profile_manager_client->UnregisterAdvertisementServiceProvider(
this);
@@ -43,4 +43,4 @@ void FakeBluetoothLEAdvertisementServiceProvider::Release() {
delegate_->Released();
}
-} // namespace chromeos
+} // namespace bluez
diff --git a/chromeos/dbus/fake_bluetooth_le_advertisement_service_provider.h b/device/bluetooth/dbus/fake_bluetooth_le_advertisement_service_provider.h
index 5a19aee..66df2c2 100644
--- a/chromeos/dbus/fake_bluetooth_le_advertisement_service_provider.h
+++ b/device/bluetooth/dbus/fake_bluetooth_le_advertisement_service_provider.h
@@ -8,17 +8,17 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/memory/scoped_ptr.h"
-#include "chromeos/chromeos_export.h"
-#include "chromeos/dbus/bluetooth_le_advertisement_service_provider.h"
#include "dbus/file_descriptor.h"
#include "dbus/object_path.h"
+#include "device/bluetooth/bluetooth_export.h"
+#include "device/bluetooth/dbus/bluetooth_le_advertisement_service_provider.h"
-namespace chromeos {
+namespace bluez {
// FakeBluetoothAdvertisementServiceProvider simulates the behavior of a local
// Bluetooth agent object and is used both in test cases in place of a
// mock and on the Linux desktop.
-class CHROMEOS_EXPORT FakeBluetoothLEAdvertisementServiceProvider
+class DEVICE_BLUETOOTH_EXPORT FakeBluetoothLEAdvertisementServiceProvider
: public BluetoothLEAdvertisementServiceProvider {
public:
FakeBluetoothLEAdvertisementServiceProvider(
@@ -44,6 +44,6 @@ class CHROMEOS_EXPORT FakeBluetoothLEAdvertisementServiceProvider
DISALLOW_COPY_AND_ASSIGN(FakeBluetoothLEAdvertisementServiceProvider);
};
-} // namespace chromeos
+} // namespace bluez
#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_LE_ADVERTISEMENT_SERVICE_PROVIDER_H_
diff --git a/chromeos/dbus/fake_bluetooth_le_advertising_manager_client.cc b/device/bluetooth/dbus/fake_bluetooth_le_advertising_manager_client.cc
index 88dafcb..5b586d7 100644
--- a/chromeos/dbus/fake_bluetooth_le_advertising_manager_client.cc
+++ b/device/bluetooth/dbus/fake_bluetooth_le_advertising_manager_client.cc
@@ -13,28 +13,23 @@
#include "fake_bluetooth_le_advertising_manager_client.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
-namespace chromeos {
+namespace bluez {
const char FakeBluetoothLEAdvertisingManagerClient::kAdvertisingManagerPath[] =
"/fake/hci0";
FakeBluetoothLEAdvertisingManagerClient::
- FakeBluetoothLEAdvertisingManagerClient() {
-}
+ FakeBluetoothLEAdvertisingManagerClient() {}
FakeBluetoothLEAdvertisingManagerClient::
- ~FakeBluetoothLEAdvertisingManagerClient() {
-}
+ ~FakeBluetoothLEAdvertisingManagerClient() {}
-void FakeBluetoothLEAdvertisingManagerClient::Init(dbus::Bus* bus) {
-}
+void FakeBluetoothLEAdvertisingManagerClient::Init(dbus::Bus* bus) {}
-void FakeBluetoothLEAdvertisingManagerClient::AddObserver(Observer* observer) {
-}
+void FakeBluetoothLEAdvertisingManagerClient::AddObserver(Observer* observer) {}
void FakeBluetoothLEAdvertisingManagerClient::RemoveObserver(
- Observer* observer) {
-}
+ Observer* observer) {}
void FakeBluetoothLEAdvertisingManagerClient::RegisterAdvertisement(
const dbus::ObjectPath& manager_object_path,
@@ -103,4 +98,4 @@ void FakeBluetoothLEAdvertisingManagerClient::
service_provider_map_.erase(iter);
}
-} // namespace chromeos
+} // namespace bluez
diff --git a/chromeos/dbus/fake_bluetooth_le_advertising_manager_client.h b/device/bluetooth/dbus/fake_bluetooth_le_advertising_manager_client.h
index 5df129c..e3090e6 100644
--- a/chromeos/dbus/fake_bluetooth_le_advertising_manager_client.h
+++ b/device/bluetooth/dbus/fake_bluetooth_le_advertising_manager_client.h
@@ -11,12 +11,12 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/observer_list.h"
-#include "chromeos/chromeos_export.h"
-#include "chromeos/dbus/bluetooth_le_advertising_manager_client.h"
#include "dbus/object_path.h"
#include "dbus/property.h"
+#include "device/bluetooth/bluetooth_export.h"
+#include "device/bluetooth/dbus/bluetooth_le_advertising_manager_client.h"
-namespace chromeos {
+namespace bluez {
class FakeBluetoothLEAdvertisementServiceProvider;
@@ -24,7 +24,7 @@ class FakeBluetoothLEAdvertisementServiceProvider;
// Bluetooth
// Daemon's profile manager object and is used both in test cases in place of a
// mock and on the Linux desktop.
-class CHROMEOS_EXPORT FakeBluetoothLEAdvertisingManagerClient
+class DEVICE_BLUETOOTH_EXPORT FakeBluetoothLEAdvertisingManagerClient
: public BluetoothLEAdvertisingManagerClient {
public:
FakeBluetoothLEAdvertisingManagerClient();
@@ -74,6 +74,6 @@ class CHROMEOS_EXPORT FakeBluetoothLEAdvertisingManagerClient
DISALLOW_COPY_AND_ASSIGN(FakeBluetoothLEAdvertisingManagerClient);
};
-} // namespace chromeos
+} // namespace bluez
#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_
diff --git a/chromeos/dbus/fake_bluetooth_media_client.cc b/device/bluetooth/dbus/fake_bluetooth_media_client.cc
index 4c8f7fd..246a140 100644
--- a/chromeos/dbus/fake_bluetooth_media_client.cc
+++ b/device/bluetooth/dbus/fake_bluetooth_media_client.cc
@@ -2,15 +2,15 @@
// 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_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_media_client.h"
#include <string>
#include "base/stl_util.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/fake_bluetooth_adapter_client.h"
-#include "chromeos/dbus/fake_bluetooth_media_endpoint_service_provider.h"
-#include "chromeos/dbus/fake_bluetooth_media_transport_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_endpoint_service_provider.h"
+#include "device/bluetooth/dbus/fake_bluetooth_media_transport_client.h"
using dbus::ObjectPath;
@@ -23,21 +23,18 @@ const char kInvalidArgumentsError[] = "org.chromium.Error.InvalidArguments";
} // namespace
-namespace chromeos {
+namespace bluez {
// static
const uint8_t FakeBluetoothMediaClient::kDefaultCodec = 0x00;
FakeBluetoothMediaClient::FakeBluetoothMediaClient()
: visible_(true),
- object_path_(ObjectPath(FakeBluetoothAdapterClient::kAdapterPath)) {
-}
+ object_path_(ObjectPath(FakeBluetoothAdapterClient::kAdapterPath)) {}
-FakeBluetoothMediaClient::~FakeBluetoothMediaClient() {
-}
+FakeBluetoothMediaClient::~FakeBluetoothMediaClient() {}
-void FakeBluetoothMediaClient::Init(dbus::Bus* bus) {
-}
+void FakeBluetoothMediaClient::Init(dbus::Bus* bus) {}
void FakeBluetoothMediaClient::AddObserver(
BluetoothMediaClient::Observer* observer) {
@@ -122,7 +119,7 @@ void FakeBluetoothMediaClient::SetEndpointRegistered(
// transport.
FakeBluetoothMediaTransportClient* transport =
static_cast<FakeBluetoothMediaTransportClient*>(
- DBusThreadManager::Get()->GetBluetoothMediaTransportClient());
+ bluez::BluezDBusManager::Get()->GetBluetoothMediaTransportClient());
transport->SetValid(endpoint, false);
endpoints_.erase(endpoint->object_path());
@@ -134,4 +131,4 @@ bool FakeBluetoothMediaClient::IsRegistered(
return ContainsKey(endpoints_, endpoint_path);
}
-} // namespace chromeos
+} // namespace bluez
diff --git a/chromeos/dbus/fake_bluetooth_media_client.h b/device/bluetooth/dbus/fake_bluetooth_media_client.h
index 3b4f4a7..3d6d84e 100644
--- a/chromeos/dbus/fake_bluetooth_media_client.h
+++ b/device/bluetooth/dbus/fake_bluetooth_media_client.h
@@ -9,15 +9,16 @@
#include "base/callback.h"
#include "base/observer_list.h"
-#include "chromeos/chromeos_export.h"
-#include "chromeos/dbus/bluetooth_media_client.h"
#include "dbus/object_path.h"
+#include "device/bluetooth/bluetooth_export.h"
+#include "device/bluetooth/dbus/bluetooth_media_client.h"
-namespace chromeos {
+namespace bluez {
class FakeBluetoothMediaEndpointServiceProvider;
-class CHROMEOS_EXPORT FakeBluetoothMediaClient : public BluetoothMediaClient {
+class DEVICE_BLUETOOTH_EXPORT FakeBluetoothMediaClient
+ : public BluetoothMediaClient {
public:
// The default codec is SBC(0x00).
static const uint8_t kDefaultCodec;
@@ -71,6 +72,6 @@ class CHROMEOS_EXPORT FakeBluetoothMediaClient : public BluetoothMediaClient {
DISALLOW_COPY_AND_ASSIGN(FakeBluetoothMediaClient);
};
-} // namespace chromeos
+} // namespace bluez
#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_CLIENT_H_
diff --git a/chromeos/dbus/fake_bluetooth_media_endpoint_service_provider.cc b/device/bluetooth/dbus/fake_bluetooth_media_endpoint_service_provider.cc
index a275374..83a0822 100644
--- a/chromeos/dbus/fake_bluetooth_media_endpoint_service_provider.cc
+++ b/device/bluetooth/dbus/fake_bluetooth_media_endpoint_service_provider.cc
@@ -2,15 +2,15 @@
// 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_endpoint_service_provider.h"
+#include "device/bluetooth/dbus/fake_bluetooth_media_endpoint_service_provider.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/fake_bluetooth_media_client.h"
-#include "chromeos/dbus/fake_bluetooth_media_transport_client.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
+#include "device/bluetooth/dbus/fake_bluetooth_media_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_media_transport_client.h"
using dbus::ObjectPath;
-namespace chromeos {
+namespace bluez {
FakeBluetoothMediaEndpointServiceProvider::
FakeBluetoothMediaEndpointServiceProvider(const ObjectPath& object_path,
@@ -43,7 +43,7 @@ void FakeBluetoothMediaEndpointServiceProvider::SelectConfiguration(
// Makes the transport object valid for the given endpoint path.
FakeBluetoothMediaTransportClient* transport =
static_cast<FakeBluetoothMediaTransportClient*>(
- DBusThreadManager::Get()->GetBluetoothMediaTransportClient());
+ bluez::BluezDBusManager::Get()->GetBluetoothMediaTransportClient());
DCHECK(transport);
transport->SetValid(this, true);
}
@@ -62,4 +62,4 @@ void FakeBluetoothMediaEndpointServiceProvider::Released() {
delegate_->Released();
}
-} // namespace chromeos
+} // namespace bluez
diff --git a/chromeos/dbus/fake_bluetooth_media_endpoint_service_provider.h b/device/bluetooth/dbus/fake_bluetooth_media_endpoint_service_provider.h
index 5efe14f..1f4383f 100644
--- a/chromeos/dbus/fake_bluetooth_media_endpoint_service_provider.h
+++ b/device/bluetooth/dbus/fake_bluetooth_media_endpoint_service_provider.h
@@ -8,16 +8,16 @@
#include <vector>
#include "base/logging.h"
-#include "chromeos/chromeos_export.h"
-#include "chromeos/dbus/bluetooth_media_endpoint_service_provider.h"
#include "dbus/object_path.h"
+#include "device/bluetooth/bluetooth_export.h"
+#include "device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.h"
#include "testing/gtest/include/gtest/gtest_prod.h"
-namespace chromeos {
+namespace bluez {
// FakeBluetoothMediaEndpointServiceProvider simulates the behavior of a local
// Bluetooth Media Endpoint object.
-class CHROMEOS_EXPORT FakeBluetoothMediaEndpointServiceProvider
+class DEVICE_BLUETOOTH_EXPORT FakeBluetoothMediaEndpointServiceProvider
: public BluetoothMediaEndpointServiceProvider {
public:
FakeBluetoothMediaEndpointServiceProvider(const dbus::ObjectPath& object_path,
@@ -52,6 +52,6 @@ class CHROMEOS_EXPORT FakeBluetoothMediaEndpointServiceProvider
DISALLOW_COPY_AND_ASSIGN(FakeBluetoothMediaEndpointServiceProvider);
};
-} // namespace chromeos
+} // namespace bluez
#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_ENDPOINT_SERVICE_PROVIDER_H_
diff --git a/chromeos/dbus/fake_bluetooth_media_transport_client.cc b/device/bluetooth/dbus/fake_bluetooth_media_transport_client.cc
index 441a66b..b71aa10 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
diff --git a/chromeos/dbus/fake_bluetooth_media_transport_client.h b/device/bluetooth/dbus/fake_bluetooth_media_transport_client.h
index f1b2e53..8403c36 100644
--- a/chromeos/dbus/fake_bluetooth_media_transport_client.h
+++ b/device/bluetooth/dbus/fake_bluetooth_media_transport_client.h
@@ -12,15 +12,15 @@
#include "base/files/file.h"
#include "base/memory/scoped_ptr.h"
#include "base/observer_list.h"
-#include "chromeos/chromeos_export.h"
-#include "chromeos/dbus/bluetooth_media_transport_client.h"
#include "dbus/object_path.h"
+#include "device/bluetooth/bluetooth_export.h"
+#include "device/bluetooth/dbus/bluetooth_media_transport_client.h"
-namespace chromeos {
+namespace bluez {
class FakeBluetoothMediaEndpointServiceProvider;
-class CHROMEOS_EXPORT FakeBluetoothMediaTransportClient
+class DEVICE_BLUETOOTH_EXPORT FakeBluetoothMediaTransportClient
: public BluetoothMediaTransportClient {
public:
struct Properties : public BluetoothMediaTransportClient::Properties {
@@ -78,8 +78,7 @@ class CHROMEOS_EXPORT FakeBluetoothMediaTransportClient
// Set state/volume property to a certain value.
void SetState(const dbus::ObjectPath& endpoint_path,
const std::string& state);
- void SetVolume(const dbus::ObjectPath& endpoint_path,
- const uint16_t& volume);
+ void SetVolume(const dbus::ObjectPath& endpoint_path, const uint16_t& volume);
// Writes bytes to the input file descriptor, |input_fd|, associated with a
// transport object which is bound to |endpoint_path|.
@@ -143,6 +142,6 @@ class CHROMEOS_EXPORT FakeBluetoothMediaTransportClient
DISALLOW_COPY_AND_ASSIGN(FakeBluetoothMediaTransportClient);
};
-} // namespace chromeos
+} // namespace bluez
#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_
diff --git a/chromeos/dbus/fake_bluetooth_profile_manager_client.cc b/device/bluetooth/dbus/fake_bluetooth_profile_manager_client.cc
index bba54a87..96254a5 100644
--- a/chromeos/dbus/fake_bluetooth_profile_manager_client.cc
+++ b/device/bluetooth/dbus/fake_bluetooth_profile_manager_client.cc
@@ -2,19 +2,19 @@
// 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_profile_manager_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_profile_manager_client.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/single_thread_task_runner.h"
#include "base/thread_task_runner_handle.h"
-#include "chromeos/dbus/fake_bluetooth_profile_service_provider.h"
#include "dbus/bus.h"
#include "dbus/message.h"
#include "dbus/object_proxy.h"
+#include "device/bluetooth/dbus/fake_bluetooth_profile_service_provider.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
-namespace chromeos {
+namespace bluez {
const char FakeBluetoothProfileManagerClient::kL2capUuid[] =
"4d995052-33cc-4fdf-b446-75f32942a076";
@@ -23,14 +23,11 @@ const char FakeBluetoothProfileManagerClient::kRfcommUuid[] =
const char FakeBluetoothProfileManagerClient::kUnregisterableUuid[] =
"00000000-0000-0000-0000-000000000000";
-FakeBluetoothProfileManagerClient::FakeBluetoothProfileManagerClient() {
-}
+FakeBluetoothProfileManagerClient::FakeBluetoothProfileManagerClient() {}
-FakeBluetoothProfileManagerClient::~FakeBluetoothProfileManagerClient() {
-}
+FakeBluetoothProfileManagerClient::~FakeBluetoothProfileManagerClient() {}
-void FakeBluetoothProfileManagerClient::Init(dbus::Bus* bus) {
-}
+void FakeBluetoothProfileManagerClient::Init(dbus::Bus* bus) {}
void FakeBluetoothProfileManagerClient::RegisterProfile(
const dbus::ObjectPath& profile_path,
@@ -111,4 +108,4 @@ FakeBluetoothProfileManagerClient::GetProfileServiceProvider(
return service_provider_map_[iter->second];
}
-} // namespace chromeos
+} // namespace bluez
diff --git a/chromeos/dbus/fake_bluetooth_profile_manager_client.h b/device/bluetooth/dbus/fake_bluetooth_profile_manager_client.h
index c142606..62af0f1 100644
--- a/chromeos/dbus/fake_bluetooth_profile_manager_client.h
+++ b/device/bluetooth/dbus/fake_bluetooth_profile_manager_client.h
@@ -11,19 +11,19 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/observer_list.h"
-#include "chromeos/chromeos_export.h"
-#include "chromeos/dbus/bluetooth_profile_manager_client.h"
#include "dbus/object_path.h"
#include "dbus/property.h"
+#include "device/bluetooth/bluetooth_export.h"
+#include "device/bluetooth/dbus/bluetooth_profile_manager_client.h"
-namespace chromeos {
+namespace bluez {
class FakeBluetoothProfileServiceProvider;
// FakeBluetoothProfileManagerClient simulates the behavior of the Bluetooth
// Daemon's profile manager object and is used both in test cases in place of a
// mock and on the Linux desktop.
-class CHROMEOS_EXPORT FakeBluetoothProfileManagerClient
+class DEVICE_BLUETOOTH_EXPORT FakeBluetoothProfileManagerClient
: public BluetoothProfileManagerClient {
public:
FakeBluetoothProfileManagerClient();
@@ -69,6 +69,6 @@ class CHROMEOS_EXPORT FakeBluetoothProfileManagerClient
ProfileMap profile_map_;
};
-} // namespace chromeos
+} // namespace bluez
#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_
diff --git a/chromeos/dbus/fake_bluetooth_profile_service_provider.cc b/device/bluetooth/dbus/fake_bluetooth_profile_service_provider.cc
index a1f44eb..1089501 100644
--- a/chromeos/dbus/fake_bluetooth_profile_service_provider.cc
+++ b/device/bluetooth/dbus/fake_bluetooth_profile_service_provider.cc
@@ -2,23 +2,22 @@
// 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_profile_service_provider.h"
+#include "device/bluetooth/dbus/fake_bluetooth_profile_service_provider.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/fake_bluetooth_profile_manager_client.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
+#include "device/bluetooth/dbus/fake_bluetooth_profile_manager_client.h"
-namespace chromeos {
+namespace bluez {
FakeBluetoothProfileServiceProvider::FakeBluetoothProfileServiceProvider(
const dbus::ObjectPath& object_path,
Delegate* delegate)
- : object_path_(object_path),
- delegate_(delegate) {
+ : object_path_(object_path), delegate_(delegate) {
VLOG(1) << "Creating Bluetooth Profile: " << object_path_.value();
FakeBluetoothProfileManagerClient* fake_bluetooth_profile_manager_client =
static_cast<FakeBluetoothProfileManagerClient*>(
- DBusThreadManager::Get()->GetBluetoothProfileManagerClient());
+ bluez::BluezDBusManager::Get()->GetBluetoothProfileManagerClient());
fake_bluetooth_profile_manager_client->RegisterProfileServiceProvider(this);
}
@@ -27,7 +26,7 @@ FakeBluetoothProfileServiceProvider::~FakeBluetoothProfileServiceProvider() {
FakeBluetoothProfileManagerClient* fake_bluetooth_profile_manager_client =
static_cast<FakeBluetoothProfileManagerClient*>(
- DBusThreadManager::Get()->GetBluetoothProfileManagerClient());
+ bluez::BluezDBusManager::Get()->GetBluetoothProfileManagerClient());
fake_bluetooth_profile_manager_client->UnregisterProfileServiceProvider(this);
}
@@ -59,4 +58,4 @@ void FakeBluetoothProfileServiceProvider::Cancel() {
delegate_->Cancel();
}
-} // namespace chromeos
+} // namespace bluez
diff --git a/chromeos/dbus/fake_bluetooth_profile_service_provider.h b/device/bluetooth/dbus/fake_bluetooth_profile_service_provider.h
index 2c98048..1259927 100644
--- a/chromeos/dbus/fake_bluetooth_profile_service_provider.h
+++ b/device/bluetooth/dbus/fake_bluetooth_profile_service_provider.h
@@ -8,19 +8,19 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/memory/scoped_ptr.h"
-#include "chromeos/chromeos_export.h"
-#include "chromeos/dbus/bluetooth_profile_service_provider.h"
#include "dbus/file_descriptor.h"
#include "dbus/object_path.h"
+#include "device/bluetooth/bluetooth_export.h"
+#include "device/bluetooth/dbus/bluetooth_profile_service_provider.h"
-namespace chromeos {
+namespace bluez {
// FakeBluetoothProfileServiceProvider simulates the behavior of a local
// Bluetooth agent object and is used both in test cases in place of a
// mock and on the Linux desktop.
//
// This class is only called from the dbus origin thread and is not thread-safe.
-class CHROMEOS_EXPORT FakeBluetoothProfileServiceProvider
+class DEVICE_BLUETOOTH_EXPORT FakeBluetoothProfileServiceProvider
: public BluetoothProfileServiceProvider {
public:
FakeBluetoothProfileServiceProvider(const dbus::ObjectPath& object_path,
@@ -55,6 +55,6 @@ class CHROMEOS_EXPORT FakeBluetoothProfileServiceProvider
DISALLOW_COPY_AND_ASSIGN(FakeBluetoothProfileServiceProvider);
};
-} // namespace chromeos
+} // namespace bluez
#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_