diff options
author | rkc <rkc@chromium.org> | 2015-10-06 04:25:52 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-06 11:26:53 +0000 |
commit | c7eeff6a15962486725ac28b0ded7fd9296f1e77 (patch) | |
tree | 9658dfae6f757fab11e852a17427c43160399ad7 | |
parent | 6a4640a83d99484907275aac3bec32c474cb6c63 (diff) | |
download | chromium_src-c7eeff6a15962486725ac28b0ded7fd9296f1e77.zip chromium_src-c7eeff6a15962486725ac28b0ded7fd9296f1e77.tar.gz chromium_src-c7eeff6a15962486725ac28b0ded7fd9296f1e77.tar.bz2 |
Revert "Refactor DBusThreadManager to split away BT clients."
This reverts commit 5d3c8959a7aee861b6750fd734cad96bd24e1f9f.
This commit is breaking the valgrind tests.
R=rkc@chromium.org
TBR=armansito@chromium.org, stevenjb@chromium.org, sky@chromium.org
BUG=None.
Review URL: https://codereview.chromium.org/1382923003
Cr-Commit-Position: refs/heads/master@{#352581}
-rw-r--r-- | ash/test/ash_test_helper.cc | 7 | ||||
-rw-r--r-- | chrome/browser/chromeos/chrome_browser_main_chromeos.cc | 8 | ||||
-rw-r--r-- | chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api_chromeos_unittest.cc | 6 | ||||
-rw-r--r-- | chrome/browser/metrics/chromeos_metrics_provider_unittest.cc | 69 | ||||
-rw-r--r-- | chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.cc | 40 | ||||
-rw-r--r-- | chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.h | 7 | ||||
-rw-r--r-- | chrome/test/DEPS | 1 | ||||
-rw-r--r-- | chrome/test/base/testing_io_thread_state.cc | 6 | ||||
-rw-r--r-- | chrome/test/base/view_event_test_platform_part_chromeos.cc | 6 | ||||
-rw-r--r-- | chromeos/chromeos.gyp | 76 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_adapter_client.cc (renamed from device/bluetooth/dbus/bluetooth_adapter_client.cc) | 6 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_adapter_client.h (renamed from device/bluetooth/dbus/bluetooth_adapter_client.h) | 16 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_agent_manager_client.cc (renamed from device/bluetooth/dbus/bluetooth_agent_manager_client.cc) | 6 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_agent_manager_client.h (renamed from device/bluetooth/dbus/bluetooth_agent_manager_client.h) | 17 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_agent_service_provider.cc (renamed from device/bluetooth/dbus/bluetooth_agent_service_provider.cc) | 12 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_agent_service_provider.h (renamed from device/bluetooth/dbus/bluetooth_agent_service_provider.h) | 14 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_device_client.cc (renamed from device/bluetooth/dbus/bluetooth_device_client.cc) | 6 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_device_client.h (renamed from device/bluetooth/dbus/bluetooth_device_client.h) | 16 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_gatt_characteristic_client.cc (renamed from device/bluetooth/dbus/bluetooth_gatt_characteristic_client.cc) | 6 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_gatt_characteristic_client.h (renamed from device/bluetooth/dbus/bluetooth_gatt_characteristic_client.h) | 17 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_gatt_characteristic_service_provider.cc (renamed from device/bluetooth/dbus/bluetooth_gatt_characteristic_service_provider.cc) | 12 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_gatt_characteristic_service_provider.h (renamed from device/bluetooth/dbus/bluetooth_gatt_characteristic_service_provider.h) | 14 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_gatt_descriptor_client.cc (renamed from device/bluetooth/dbus/bluetooth_gatt_descriptor_client.cc) | 6 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_gatt_descriptor_client.h (renamed from device/bluetooth/dbus/bluetooth_gatt_descriptor_client.h) | 17 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_gatt_descriptor_service_provider.cc (renamed from device/bluetooth/dbus/bluetooth_gatt_descriptor_service_provider.cc) | 12 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_gatt_descriptor_service_provider.h (renamed from device/bluetooth/dbus/bluetooth_gatt_descriptor_service_provider.h) | 14 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_gatt_manager_client.cc (renamed from device/bluetooth/dbus/bluetooth_gatt_manager_client.cc) | 6 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_gatt_manager_client.h (renamed from device/bluetooth/dbus/bluetooth_gatt_manager_client.h) | 19 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_gatt_service_client.cc (renamed from device/bluetooth/dbus/bluetooth_gatt_service_client.cc) | 6 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_gatt_service_client.h (renamed from device/bluetooth/dbus/bluetooth_gatt_service_client.h) | 17 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_gatt_service_service_provider.cc (renamed from device/bluetooth/dbus/bluetooth_gatt_service_service_provider.cc) | 12 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_gatt_service_service_provider.h (renamed from device/bluetooth/dbus/bluetooth_gatt_service_service_provider.h) | 14 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_input_client.cc (renamed from device/bluetooth/dbus/bluetooth_input_client.cc) | 6 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_input_client.h (renamed from device/bluetooth/dbus/bluetooth_input_client.h) | 16 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_le_advertisement_service_provider.cc (renamed from device/bluetooth/dbus/bluetooth_le_advertisement_service_provider.cc) | 12 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_le_advertisement_service_provider.h (renamed from device/bluetooth/dbus/bluetooth_le_advertisement_service_provider.h) | 14 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_le_advertising_manager_client.cc (renamed from device/bluetooth/dbus/bluetooth_le_advertising_manager_client.cc) | 6 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_le_advertising_manager_client.h (renamed from device/bluetooth/dbus/bluetooth_le_advertising_manager_client.h) | 17 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_media_client.cc (renamed from device/bluetooth/dbus/bluetooth_media_client.cc) | 6 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_media_client.h (renamed from device/bluetooth/dbus/bluetooth_media_client.h) | 18 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_media_endpoint_service_provider.cc (renamed from device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.cc) | 16 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_media_endpoint_service_provider.h (renamed from device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.h) | 16 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_media_transport_client.cc (renamed from device/bluetooth/dbus/bluetooth_media_transport_client.cc) | 6 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_media_transport_client.h (renamed from device/bluetooth/dbus/bluetooth_media_transport_client.h) | 17 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_profile_manager_client.cc (renamed from device/bluetooth/dbus/bluetooth_profile_manager_client.cc) | 6 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_profile_manager_client.h (renamed from device/bluetooth/dbus/bluetooth_profile_manager_client.h) | 19 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_profile_service_provider.cc (renamed from device/bluetooth/dbus/bluetooth_profile_service_provider.cc) | 12 | ||||
-rw-r--r-- | chromeos/dbus/bluetooth_profile_service_provider.h (renamed from device/bluetooth/dbus/bluetooth_profile_service_provider.h) | 16 | ||||
-rw-r--r-- | chromeos/dbus/dbus_client_bundle.cc | 63 | ||||
-rw-r--r-- | chromeos/dbus/dbus_client_bundle.h | 75 | ||||
-rw-r--r-- | chromeos/dbus/dbus_thread_manager.cc | 151 | ||||
-rw-r--r-- | chromeos/dbus/dbus_thread_manager.h | 44 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_adapter_client.cc (renamed from device/bluetooth/dbus/fake_bluetooth_adapter_client.cc) | 16 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_adapter_client.h (renamed from device/bluetooth/dbus/fake_bluetooth_adapter_client.h) | 10 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_agent_manager_client.cc (renamed from device/bluetooth/dbus/fake_bluetooth_agent_manager_client.cc) | 8 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_agent_manager_client.h (renamed from device/bluetooth/dbus/fake_bluetooth_agent_manager_client.h) | 10 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_agent_service_provider.cc (renamed from device/bluetooth/dbus/fake_bluetooth_agent_service_provider.cc) | 14 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_agent_service_provider.h (renamed from device/bluetooth/dbus/fake_bluetooth_agent_service_provider.h) | 10 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_device_client.cc (renamed from device/bluetooth/dbus/fake_bluetooth_device_client.cc) | 40 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_device_client.h (renamed from device/bluetooth/dbus/fake_bluetooth_device_client.h) | 15 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_gatt_characteristic_client.cc (renamed from device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.cc) | 14 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_gatt_characteristic_client.h (renamed from device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.h) | 10 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_gatt_characteristic_service_provider.cc (renamed from device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.cc) | 18 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_gatt_characteristic_service_provider.h (renamed from device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.h) | 10 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_gatt_descriptor_client.cc (renamed from device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_client.cc) | 12 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_gatt_descriptor_client.h (renamed from device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_client.h) | 10 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_gatt_descriptor_service_provider.cc (renamed from device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_service_provider.cc) | 20 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_gatt_descriptor_service_provider.h (renamed from device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_service_provider.h) | 10 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_gatt_manager_client.cc (renamed from device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.cc) | 12 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_gatt_manager_client.h (renamed from device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.h) | 10 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_gatt_service_client.cc (renamed from device/bluetooth/dbus/fake_bluetooth_gatt_service_client.cc) | 16 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_gatt_service_client.h (renamed from device/bluetooth/dbus/fake_bluetooth_gatt_service_client.h) | 10 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_gatt_service_service_provider.cc (renamed from device/bluetooth/dbus/fake_bluetooth_gatt_service_service_provider.cc) | 14 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_gatt_service_service_provider.h (renamed from device/bluetooth/dbus/fake_bluetooth_gatt_service_service_provider.h) | 16 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_input_client.cc (renamed from device/bluetooth/dbus/fake_bluetooth_input_client.cc) | 8 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_input_client.h (renamed from device/bluetooth/dbus/fake_bluetooth_input_client.h) | 11 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_le_advertisement_service_provider.cc (renamed from device/bluetooth/dbus/fake_bluetooth_le_advertisement_service_provider.cc) | 14 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_le_advertisement_service_provider.h (renamed from device/bluetooth/dbus/fake_bluetooth_le_advertisement_service_provider.h) | 10 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_le_advertising_manager_client.cc (renamed from device/bluetooth/dbus/fake_bluetooth_le_advertising_manager_client.cc) | 4 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_le_advertising_manager_client.h (renamed from device/bluetooth/dbus/fake_bluetooth_le_advertising_manager_client.h) | 10 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_media_client.cc (renamed from device/bluetooth/dbus/fake_bluetooth_media_client.cc) | 16 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_media_client.h (renamed from device/bluetooth/dbus/fake_bluetooth_media_client.h) | 11 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_media_endpoint_service_provider.cc (renamed from device/bluetooth/dbus/fake_bluetooth_media_endpoint_service_provider.cc) | 14 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_media_endpoint_service_provider.h (renamed from device/bluetooth/dbus/fake_bluetooth_media_endpoint_service_provider.h) | 10 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_media_transport_client.cc (renamed from device/bluetooth/dbus/fake_bluetooth_media_transport_client.cc) | 22 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_media_transport_client.h (renamed from device/bluetooth/dbus/fake_bluetooth_media_transport_client.h) | 16 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_profile_manager_client.cc (renamed from device/bluetooth/dbus/fake_bluetooth_profile_manager_client.cc) | 8 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_profile_manager_client.h (renamed from device/bluetooth/dbus/fake_bluetooth_profile_manager_client.h) | 10 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_profile_service_provider.cc (renamed from device/bluetooth/dbus/fake_bluetooth_profile_service_provider.cc) | 14 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_profile_service_provider.h (renamed from device/bluetooth/dbus/fake_bluetooth_profile_service_provider.h) | 10 | ||||
-rw-r--r-- | device/bluetooth/BUILD.gn | 89 | ||||
-rw-r--r-- | device/bluetooth/bluetooth.gyp | 90 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_adapter_chromeos.cc | 179 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_adapter_chromeos.h | 45 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_adapter_profile_chromeos.cc | 30 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_adapter_profile_chromeos.h | 22 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_adapter_profile_chromeos_unittest.cc | 91 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_advertisement_chromeos.cc | 22 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_advertisement_chromeos.h | 15 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_advertisement_chromeos_unittest.cc | 12 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_audio_sink_chromeos.cc | 55 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_audio_sink_chromeos.h | 22 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_audio_sink_chromeos_unittest.cc | 40 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_chromeos_unittest.cc | 545 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_device_chromeos.cc | 88 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_device_chromeos.h | 8 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_gatt_chromeos_unittest.cc | 209 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_gatt_connection_chromeos.cc | 15 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_gatt_connection_chromeos.h | 9 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_gatt_notify_session_chromeos.cc | 20 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_gatt_notify_session_chromeos.h | 6 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_pairing_chromeos.cc | 34 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_pairing_chromeos.h | 32 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.cc | 92 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h | 6 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.cc | 23 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_remote_gatt_service_chromeos.cc | 48 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_remote_gatt_service_chromeos.h | 12 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_socket_chromeos.cc | 20 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_socket_chromeos.h | 20 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_socket_chromeos_unittest.cc | 119 | ||||
-rw-r--r-- | device/bluetooth/dbus/bluetooth_dbus_client_bundle.cc | 84 | ||||
-rw-r--r-- | device/bluetooth/dbus/bluetooth_dbus_client_bundle.h | 113 | ||||
-rw-r--r-- | device/bluetooth/dbus/bluez_dbus_client.h | 37 | ||||
-rw-r--r-- | device/bluetooth/dbus/bluez_dbus_manager.cc | 250 | ||||
-rw-r--r-- | device/bluetooth/dbus/bluez_dbus_manager.h | 157 |
126 files changed, 1809 insertions, 2370 deletions
diff --git a/ash/test/ash_test_helper.cc b/ash/test/ash_test_helper.cc index 336d9c7..a01da66 100644 --- a/ash/test/ash_test_helper.cc +++ b/ash/test/ash_test_helper.cc @@ -32,7 +32,6 @@ #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) @@ -89,13 +88,8 @@ 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(); @@ -138,7 +132,6 @@ 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 91005c4..efe91c5 100644 --- a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc +++ b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc @@ -119,7 +119,6 @@ #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" @@ -185,12 +184,6 @@ 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()); @@ -257,7 +250,6 @@ 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 fc1c8c8..912bd70 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,7 +26,6 @@ #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" @@ -128,10 +127,6 @@ 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(); @@ -140,7 +135,6 @@ 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 1eeb373..f47b5d9 100644 --- a/chrome/browser/metrics/chromeos_metrics_provider_unittest.cc +++ b/chrome/browser/metrics/chromeos_metrics_provider_unittest.cc @@ -11,44 +11,41 @@ #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; @@ -63,39 +60,37 @@ class ChromeOSMetricsProviderTest : public testing::Test { #endif // Set up the fake Bluetooth environment, - scoped_ptr<BluezDBusManagerSetter> bluez_dbus_setter = - BluezDBusManager::GetSetterForTesting(); - bluez_dbus_setter->SetBluetoothAdapterClient( + scoped_ptr<DBusThreadManagerSetter> dbus_setter = + DBusThreadManager::GetSetterForTesting(); + dbus_setter->SetBluetoothAdapterClient( scoped_ptr<BluetoothAdapterClient>(new FakeBluetoothAdapterClient)); - bluez_dbus_setter->SetBluetoothDeviceClient( + dbus_setter->SetBluetoothDeviceClient( scoped_ptr<BluetoothDeviceClient>(new FakeBluetoothDeviceClient)); - bluez_dbus_setter->SetBluetoothGattCharacteristicClient( + dbus_setter->SetBluetoothGattCharacteristicClient( scoped_ptr<BluetoothGattCharacteristicClient>( new FakeBluetoothGattCharacteristicClient)); - bluez_dbus_setter->SetBluetoothGattDescriptorClient( + dbus_setter->SetBluetoothGattDescriptorClient( scoped_ptr<BluetoothGattDescriptorClient>( new FakeBluetoothGattDescriptorClient)); - bluez_dbus_setter->SetBluetoothGattServiceClient( + dbus_setter->SetBluetoothGattServiceClient( scoped_ptr<BluetoothGattServiceClient>( new FakeBluetoothGattServiceClient)); - bluez_dbus_setter->SetBluetoothInputClient( + dbus_setter->SetBluetoothInputClient( scoped_ptr<BluetoothInputClient>(new FakeBluetoothInputClient)); - bluez_dbus_setter->SetBluetoothAgentManagerClient( + 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*>( - BluezDBusManager::Get()->GetBluetoothAdapterClient()); + DBusThreadManager::Get()->GetBluetoothAdapterClient()); fake_bluetooth_device_client_ = static_cast<FakeBluetoothDeviceClient*>( - BluezDBusManager::Get()->GetBluetoothDeviceClient()); + DBusThreadManager::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 932d7a9..260b2f6 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,13 +10,12 @@ #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 { @@ -64,7 +63,7 @@ const char kPairedPropertyName[] = "Paired"; namespace chromeos { class DeviceEmulatorMessageHandler::BluetoothObserver - : public bluez::BluetoothDeviceClient::Observer { + : public BluetoothDeviceClient::Observer { public: explicit BluetoothObserver(DeviceEmulatorMessageHandler* owner) : owner_(owner) { @@ -180,8 +179,8 @@ void DeviceEmulatorMessageHandler::PowerObserver::PowerChanged( DeviceEmulatorMessageHandler::DeviceEmulatorMessageHandler() : fake_bluetooth_device_client_( - static_cast<bluez::FakeBluetoothDeviceClient*>( - bluez::BluezDBusManager::Get() + static_cast<chromeos::FakeBluetoothDeviceClient*>( + chromeos::DBusThreadManager::Get() ->GetBluetoothDeviceClient())), fake_cras_audio_client_(static_cast<chromeos::FakeCrasAudioClient*>( chromeos::DBusThreadManager::Get() @@ -209,7 +208,7 @@ void DeviceEmulatorMessageHandler::HandleRemoveBluetoothDevice( std::string path; CHECK(args->GetString(0, &path)); fake_bluetooth_device_client_->RemoveDevice( - dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath), + dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), dbus::ObjectPath(path)); } @@ -224,7 +223,7 @@ void DeviceEmulatorMessageHandler::HandleRequestBluetoothInfo( // the main adapter. std::vector<dbus::ObjectPath> paths = fake_bluetooth_device_client_->GetDevicesForAdapter( - dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath)); + dbus::ObjectPath(chromeos::FakeBluetoothAdapterClient::kAdapterPath)); base::ListValue devices; // Get each device's properties. @@ -238,21 +237,21 @@ void DeviceEmulatorMessageHandler::HandleRequestBluetoothInfo( base::ListValue pairing_method_options; pairing_method_options.AppendString( - bluez::FakeBluetoothDeviceClient::kPairingMethodNone); + FakeBluetoothDeviceClient::kPairingMethodNone); pairing_method_options.AppendString( - bluez::FakeBluetoothDeviceClient::kPairingMethodPinCode); + FakeBluetoothDeviceClient::kPairingMethodPinCode); pairing_method_options.AppendString( - bluez::FakeBluetoothDeviceClient::kPairingMethodPassKey); + FakeBluetoothDeviceClient::kPairingMethodPassKey); base::ListValue pairing_action_options; pairing_action_options.AppendString( - bluez::FakeBluetoothDeviceClient::kPairingActionDisplay); + FakeBluetoothDeviceClient::kPairingActionDisplay); pairing_action_options.AppendString( - bluez::FakeBluetoothDeviceClient::kPairingActionRequest); + FakeBluetoothDeviceClient::kPairingActionRequest); pairing_action_options.AppendString( - bluez::FakeBluetoothDeviceClient::kPairingActionConfirmation); + FakeBluetoothDeviceClient::kPairingActionConfirmation); pairing_action_options.AppendString( - bluez::FakeBluetoothDeviceClient::kPairingActionFail); + FakeBluetoothDeviceClient::kPairingActionFail); // Send the list of devices to the view. web_ui()->CallJavascriptFunction(kUpdateBluetoothInfoJSCallback, @@ -264,7 +263,7 @@ void DeviceEmulatorMessageHandler::HandleRequestBluetoothPair( const base::ListValue* args) { // Create the device if it does not already exist. std::string path = CreateBluetoothDeviceFromListValue(args); - bluez::FakeBluetoothDeviceClient::Properties* props = + chromeos::FakeBluetoothDeviceClient::Properties* props = fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(path)); // Try to pair the device with the main adapter. The device is identified @@ -443,7 +442,7 @@ void DeviceEmulatorMessageHandler::RegisterMessages() { std::string DeviceEmulatorMessageHandler::CreateBluetoothDeviceFromListValue( const base::ListValue* args) { const base::DictionaryValue* device_dict = nullptr; - bluez::FakeBluetoothDeviceClient::IncomingDeviceProperties props; + FakeBluetoothDeviceClient::IncomingDeviceProperties props; CHECK(args->GetDictionary(0, &device_dict)); CHECK(device_dict->GetString("path", &props.device_path)); @@ -460,7 +459,8 @@ 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(bluez::FakeBluetoothAdapterClient::kAdapterPath), props); + dbus::ObjectPath(chromeos::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. - bluez::FakeBluetoothDeviceClient::Properties* props = + chromeos::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); - bluez::FakeBluetoothDeviceClient::SimulatedPairingOptions* options = + chromeos::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 882af77..840111b 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,12 +17,9 @@ namespace dbus { class ObjectPath; } // namespace dbus -namespace bluez { -class FakeBluetoothDeviceClient; -} - namespace chromeos { +class FakeBluetoothDeviceClient; class FakeCrasAudioClient; class FakePowerManagerClient; @@ -102,7 +99,7 @@ class DeviceEmulatorMessageHandler scoped_ptr<base::DictionaryValue> GetDeviceInfo( const dbus::ObjectPath& object_path); - bluez::FakeBluetoothDeviceClient* fake_bluetooth_device_client_; + 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 2167a41..2d596c8 100644 --- a/chrome/test/DEPS +++ b/chrome/test/DEPS @@ -6,7 +6,6 @@ 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 09b07f2..8ebd202 100644 --- a/chrome/test/base/testing_io_thread_state.cc +++ b/chrome/test/base/testing_io_thread_state.cc @@ -16,7 +16,6 @@ #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; @@ -43,10 +42,6 @@ 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 @@ -80,7 +75,6 @@ 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 16a678e..2cf14ef 100644 --- a/chrome/test/base/view_event_test_platform_part_chromeos.cc +++ b/chrome/test/base/view_event_test_platform_part_chromeos.cc @@ -15,7 +15,6 @@ #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" @@ -47,10 +46,6 @@ 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(); @@ -75,7 +70,6 @@ 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 abda945..4ccdfca 100644 --- a/chromeos/chromeos.gyp +++ b/chromeos/chromeos.gyp @@ -59,6 +59,44 @@ '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', @@ -82,6 +120,44 @@ '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/device/bluetooth/dbus/bluetooth_adapter_client.cc b/chromeos/dbus/bluetooth_adapter_client.cc index 26081ea..064262e 100644 --- a/device/bluetooth/dbus/bluetooth_adapter_client.cc +++ b/chromeos/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 "device/bluetooth/dbus/bluetooth_adapter_client.h" +#include "chromeos/dbus/bluetooth_adapter_client.h" #include "base/bind.h" #include "base/logging.h" @@ -12,7 +12,7 @@ #include "dbus/object_proxy.h" #include "third_party/cros_system_api/dbus/service_constants.h" -namespace bluez { +namespace chromeos { BluetoothAdapterClient::DiscoveryFilter::DiscoveryFilter() {} @@ -347,4 +347,4 @@ BluetoothAdapterClient* BluetoothAdapterClient::Create() { return new BluetoothAdapterClientImpl; } -} // namespace bluez +} // namespace chromeos diff --git a/device/bluetooth/dbus/bluetooth_adapter_client.h b/chromeos/dbus/bluetooth_adapter_client.h index 5a024eb..c7237d7 100644 --- a/device/bluetooth/dbus/bluetooth_adapter_client.h +++ b/chromeos/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 DEVICE_BLUETOOTH_DBUS_BLUETOOTH_ADAPTER_CLIENT_H_ -#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_ADAPTER_CLIENT_H_ +#ifndef CHROMEOS_DBUS_BLUETOOTH_ADAPTER_CLIENT_H_ +#define CHROMEOS_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 bluez { +namespace chromeos { // BluetoothAdapterClient is used to communicate with objects representing // local Bluetooth Adapters. -class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterClient : public BluezDBusClient { +class CHROMEOS_EXPORT BluetoothAdapterClient : public DBusClient { public: // A DiscoveryFilter represents a filter passed to the SetDiscoveryFilter // method. @@ -179,6 +179,6 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterClient : public BluezDBusClient { DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterClient); }; -} // namespace bluez +} // namespace chromeos -#endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_ADAPTER_CLIENT_H_ +#endif // CHROMEOS_DBUS_BLUETOOTH_ADAPTER_CLIENT_H_ diff --git a/device/bluetooth/dbus/bluetooth_agent_manager_client.cc b/chromeos/dbus/bluetooth_agent_manager_client.cc index 6caee9b..a5606a9 100644 --- a/device/bluetooth/dbus/bluetooth_agent_manager_client.cc +++ b/chromeos/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 "device/bluetooth/dbus/bluetooth_agent_manager_client.h" +#include "chromeos/dbus/bluetooth_agent_manager_client.h" #include "base/bind.h" #include "base/logging.h" @@ -11,7 +11,7 @@ #include "dbus/object_proxy.h" #include "third_party/cros_system_api/dbus/service_constants.h" -namespace bluez { +namespace chromeos { const char BluetoothAgentManagerClient::kNoResponseError[] = "org.chromium.Error.NoResponse"; @@ -134,4 +134,4 @@ BluetoothAgentManagerClient* BluetoothAgentManagerClient::Create() { return new BluetoothAgentManagerClientImpl(); } -} // namespace bluez +} // namespace chromeos diff --git a/device/bluetooth/dbus/bluetooth_agent_manager_client.h b/chromeos/dbus/bluetooth_agent_manager_client.h index c43568a..f43f4f8 100644 --- a/device/bluetooth/dbus/bluetooth_agent_manager_client.h +++ b/chromeos/dbus/bluetooth_agent_manager_client.h @@ -2,24 +2,23 @@ // 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_AGENT_MANAGER_CLIENT_H_ -#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_AGENT_MANAGER_CLIENT_H_ +#ifndef CHROMEOS_DBUS_BLUETOOTH_AGENT_MANAGER_CLIENT_H_ +#define CHROMEOS_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 bluez { +namespace chromeos { // BluetoothAgentManagerClient is used to communicate with the agent manager // object of the Bluetooth daemon. -class DEVICE_BLUETOOTH_EXPORT BluetoothAgentManagerClient - : public BluezDBusClient { +class CHROMEOS_EXPORT BluetoothAgentManagerClient : public DBusClient { public: ~BluetoothAgentManagerClient() override; @@ -64,6 +63,6 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAgentManagerClient DISALLOW_COPY_AND_ASSIGN(BluetoothAgentManagerClient); }; -} // namespace bluez +} // namespace chromeos -#endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_AGENT_MANAGER_CLIENT_H_ +#endif // CHROMEOS_DBUS_BLUETOOTH_AGENT_MANAGER_CLIENT_H_ diff --git a/device/bluetooth/dbus/bluetooth_agent_service_provider.cc b/chromeos/dbus/bluetooth_agent_service_provider.cc index 7392f2b..54ebeb3 100644 --- a/device/bluetooth/dbus/bluetooth_agent_service_provider.cc +++ b/chromeos/dbus/bluetooth_agent_service_provider.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 "device/bluetooth/dbus/bluetooth_agent_service_provider.h" +#include "chromeos/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 bluez { +namespace chromeos { // The BluetoothAgentServiceProvider implementation used in production. class BluetoothAgentServiceProviderImpl : public BluetoothAgentServiceProvider { @@ -434,11 +434,11 @@ BluetoothAgentServiceProvider* BluetoothAgentServiceProvider::Create( dbus::Bus* bus, const dbus::ObjectPath& object_path, Delegate* delegate) { - if (!bluez::BluezDBusManager::Get()->IsUsingStub()) { + if (!DBusThreadManager::Get()->IsUsingStub(DBusClientBundle::BLUETOOTH)) { return new BluetoothAgentServiceProviderImpl(bus, object_path, delegate); } else { return new FakeBluetoothAgentServiceProvider(object_path, delegate); } } -} // namespace bluez +} // namespace chromeos diff --git a/device/bluetooth/dbus/bluetooth_agent_service_provider.h b/chromeos/dbus/bluetooth_agent_service_provider.h index e31ef8f..8e84fa5 100644 --- a/device/bluetooth/dbus/bluetooth_agent_service_provider.h +++ b/chromeos/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 DEVICE_BLUETOOTH_DBUS_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_ -#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_ +#ifndef CHROMEOS_DBUS_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_ +#define CHROMEOS_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 bluez { +namespace chromeos { // 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 bluez { // 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 DEVICE_BLUETOOTH_EXPORT BluetoothAgentServiceProvider { +class CHROMEOS_EXPORT BluetoothAgentServiceProvider { public: // Interface for reacting to agent requests. class Delegate { @@ -173,6 +173,6 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAgentServiceProvider { DISALLOW_COPY_AND_ASSIGN(BluetoothAgentServiceProvider); }; -} // namespace bluez +} // namespace chromeos -#endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_ +#endif // CHROMEOS_DBUS_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_ diff --git a/device/bluetooth/dbus/bluetooth_device_client.cc b/chromeos/dbus/bluetooth_device_client.cc index 65059c6..7b1d590 100644 --- a/device/bluetooth/dbus/bluetooth_device_client.cc +++ b/chromeos/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 "device/bluetooth/dbus/bluetooth_device_client.h" +#include "chromeos/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 bluez { +namespace chromeos { namespace { @@ -375,4 +375,4 @@ BluetoothDeviceClient* BluetoothDeviceClient::Create() { return new BluetoothDeviceClientImpl(); } -} // namespace bluez +} // namespace chromeos diff --git a/device/bluetooth/dbus/bluetooth_device_client.h b/chromeos/dbus/bluetooth_device_client.h index b0991dc..6768b3e 100644 --- a/device/bluetooth/dbus/bluetooth_device_client.h +++ b/chromeos/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 DEVICE_BLUETOOTH_DBUS_BLUETOOTH_DEVICE_CLIENT_H_ -#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_DEVICE_CLIENT_H_ +#ifndef CHROMEOS_DBUS_BLUETOOTH_DEVICE_CLIENT_H_ +#define CHROMEOS_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 bluez { +namespace chromeos { // BluetoothDeviceClient is used to communicate with objects representing // remote Bluetooth Devices. -class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceClient : public BluezDBusClient { +class CHROMEOS_EXPORT BluetoothDeviceClient : public DBusClient { public: // Structure of properties associated with bluetooth devices. struct Properties : public dbus::PropertySet { @@ -201,6 +201,6 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceClient : public BluezDBusClient { DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceClient); }; -} // namespace bluez +} // namespace chromeos -#endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_DEVICE_CLIENT_H_ +#endif // CHROMEOS_DBUS_BLUETOOTH_DEVICE_CLIENT_H_ diff --git a/device/bluetooth/dbus/bluetooth_gatt_characteristic_client.cc b/chromeos/dbus/bluetooth_gatt_characteristic_client.cc index 6000a52..8e241e6 100644 --- a/device/bluetooth/dbus/bluetooth_gatt_characteristic_client.cc +++ b/chromeos/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 "device/bluetooth/dbus/bluetooth_gatt_characteristic_client.h" +#include "chromeos/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 bluez { +namespace chromeos { namespace { @@ -300,4 +300,4 @@ BluetoothGattCharacteristicClient* BluetoothGattCharacteristicClient::Create() { return new BluetoothGattCharacteristicClientImpl(); } -} // namespace bluez +} // namespace chromeos diff --git a/device/bluetooth/dbus/bluetooth_gatt_characteristic_client.h b/chromeos/dbus/bluetooth_gatt_characteristic_client.h index 3c476eb..b040b56 100644 --- a/device/bluetooth/dbus/bluetooth_gatt_characteristic_client.h +++ b/chromeos/dbus/bluetooth_gatt_characteristic_client.h @@ -2,25 +2,24 @@ // 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_GATT_CHARACTERISTIC_CLIENT_H_ -#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_CLIENT_H_ +#ifndef CHROMEOS_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_CLIENT_H_ +#define CHROMEOS_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 bluez { +namespace chromeos { // BluetoothGattCharacteristicClient is used to communicate with remote GATT // characteristic objects exposed by the Bluetooth daemon. -class DEVICE_BLUETOOTH_EXPORT BluetoothGattCharacteristicClient - : public BluezDBusClient { +class CHROMEOS_EXPORT BluetoothGattCharacteristicClient : public DBusClient { public: // Structure of properties associated with GATT characteristics. struct Properties : public dbus::PropertySet { @@ -139,6 +138,6 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothGattCharacteristicClient DISALLOW_COPY_AND_ASSIGN(BluetoothGattCharacteristicClient); }; -} // namespace bluez +} // namespace chromeos -#endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_CLIENT_H_ +#endif // CHROMEOS_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_CLIENT_H_ diff --git a/device/bluetooth/dbus/bluetooth_gatt_characteristic_service_provider.cc b/chromeos/dbus/bluetooth_gatt_characteristic_service_provider.cc index 4decdf0..856e60d 100644 --- a/device/bluetooth/dbus/bluetooth_gatt_characteristic_service_provider.cc +++ b/chromeos/dbus/bluetooth_gatt_characteristic_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 "device/bluetooth/dbus/bluetooth_gatt_characteristic_service_provider.h" +#include "chromeos/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 bluez { +namespace chromeos { namespace { const char kErrorInvalidArgs[] = "org.freedesktop.DBus.Error.InvalidArgs"; const char kErrorPropertyReadOnly[] = @@ -453,7 +453,7 @@ BluetoothGattCharacteristicServiceProvider::Create( const std::vector<std::string>& flags, const std::vector<std::string>& permissions, const dbus::ObjectPath& service_path) { - if (!bluez::BluezDBusManager::Get()->IsUsingStub()) { + if (!DBusThreadManager::Get()->IsUsingStub(DBusClientBundle::BLUETOOTH)) { return new BluetoothGattCharacteristicServiceProviderImpl( bus, object_path, delegate, uuid, flags, permissions, service_path); } @@ -461,4 +461,4 @@ BluetoothGattCharacteristicServiceProvider::Create( object_path, delegate, uuid, flags, permissions, service_path); } -} // namespace bluez +} // namespace chromeos diff --git a/device/bluetooth/dbus/bluetooth_gatt_characteristic_service_provider.h b/chromeos/dbus/bluetooth_gatt_characteristic_service_provider.h index ad5d999..174a908 100644 --- a/device/bluetooth/dbus/bluetooth_gatt_characteristic_service_provider.h +++ b/chromeos/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 DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_H_ -#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_H_ +#ifndef CHROMEOS_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_H_ +#define CHROMEOS_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 bluez { +namespace chromeos { // 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 bluez { // mandatory during initialization. In addition, a "SendValueChanged" method is // provided, which emits a DBus.Properties.PropertyChanged signal for the // "Value" property. -class DEVICE_BLUETOOTH_EXPORT BluetoothGattCharacteristicServiceProvider { +class CHROMEOS_EXPORT BluetoothGattCharacteristicServiceProvider { public: // Interface for reacting to GATT characteristic value requests. class Delegate { @@ -108,6 +108,6 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothGattCharacteristicServiceProvider { DISALLOW_COPY_AND_ASSIGN(BluetoothGattCharacteristicServiceProvider); }; -} // namespace bluez +} // namespace chromeos -#endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_H_ +#endif // CHROMEOS_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_H_ diff --git a/device/bluetooth/dbus/bluetooth_gatt_descriptor_client.cc b/chromeos/dbus/bluetooth_gatt_descriptor_client.cc index f3ba343..4d97415 100644 --- a/device/bluetooth/dbus/bluetooth_gatt_descriptor_client.cc +++ b/chromeos/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 "device/bluetooth/dbus/bluetooth_gatt_descriptor_client.h" +#include "chromeos/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 bluez { +namespace chromeos { namespace { @@ -248,4 +248,4 @@ BluetoothGattDescriptorClient* BluetoothGattDescriptorClient::Create() { return new BluetoothGattDescriptorClientImpl(); } -} // namespace bluez +} // namespace chromeos diff --git a/device/bluetooth/dbus/bluetooth_gatt_descriptor_client.h b/chromeos/dbus/bluetooth_gatt_descriptor_client.h index 364331e..15d3d9c 100644 --- a/device/bluetooth/dbus/bluetooth_gatt_descriptor_client.h +++ b/chromeos/dbus/bluetooth_gatt_descriptor_client.h @@ -2,25 +2,24 @@ // 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_GATT_DESCRIPTOR_CLIENT_H_ -#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_DESCRIPTOR_CLIENT_H_ +#ifndef CHROMEOS_DBUS_BLUETOOTH_GATT_DESCRIPTOR_CLIENT_H_ +#define CHROMEOS_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 bluez { +namespace chromeos { // BluetoothGattDescriptorClient is used to communicate with remote GATT // characteristic descriptor objects exposed by the Bluetooth daemon. -class DEVICE_BLUETOOTH_EXPORT BluetoothGattDescriptorClient - : public BluezDBusClient { +class CHROMEOS_EXPORT BluetoothGattDescriptorClient : public DBusClient { public: // Structure of properties associated with GATT descriptors. struct Properties : public dbus::PropertySet { @@ -111,6 +110,6 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothGattDescriptorClient DISALLOW_COPY_AND_ASSIGN(BluetoothGattDescriptorClient); }; -} // namespace bluez +} // namespace chromeos -#endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_DESCRIPTOR_CLIENT_H_ +#endif // CHROMEOS_DBUS_BLUETOOTH_GATT_DESCRIPTOR_CLIENT_H_ diff --git a/device/bluetooth/dbus/bluetooth_gatt_descriptor_service_provider.cc b/chromeos/dbus/bluetooth_gatt_descriptor_service_provider.cc index e4aa245..1fe1657 100644 --- a/device/bluetooth/dbus/bluetooth_gatt_descriptor_service_provider.cc +++ b/chromeos/dbus/bluetooth_gatt_descriptor_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 "device/bluetooth/dbus/bluetooth_gatt_descriptor_service_provider.h" +#include "chromeos/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 bluez { +namespace chromeos { namespace { const char kErrorInvalidArgs[] = "org.freedesktop.DBus.Error.InvalidArgs"; const char kErrorPropertyReadOnly[] = @@ -446,7 +446,7 @@ BluetoothGattDescriptorServiceProvider::Create( const std::string& uuid, const std::vector<std::string>& permissions, const dbus::ObjectPath& characteristic_path) { - if (!bluez::BluezDBusManager::Get()->IsUsingStub()) { + if (!DBusThreadManager::Get()->IsUsingStub(DBusClientBundle::BLUETOOTH)) { return new BluetoothGattDescriptorServiceProviderImpl( bus, object_path, delegate, uuid, permissions, characteristic_path); } @@ -454,4 +454,4 @@ BluetoothGattDescriptorServiceProvider::Create( object_path, delegate, uuid, permissions, characteristic_path); } -} // namespace bluez +} // namespace chromeos diff --git a/device/bluetooth/dbus/bluetooth_gatt_descriptor_service_provider.h b/chromeos/dbus/bluetooth_gatt_descriptor_service_provider.h index e4925ff..4b5fef8 100644 --- a/device/bluetooth/dbus/bluetooth_gatt_descriptor_service_provider.h +++ b/chromeos/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 DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_H_ -#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_H_ +#ifndef CHROMEOS_DBUS_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_H_ +#define CHROMEOS_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 bluez { +namespace chromeos { // 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 bluez { // mandatory during initialization. In addition, a "SendValueChanged" method is // provided, which emits a DBus.Properties.PropertyChanged signal for the // "Value" property. -class DEVICE_BLUETOOTH_EXPORT BluetoothGattDescriptorServiceProvider { +class CHROMEOS_EXPORT BluetoothGattDescriptorServiceProvider { public: // Interface for reacting to GATT characteristic descriptor value requests. class Delegate { @@ -104,6 +104,6 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothGattDescriptorServiceProvider { DISALLOW_COPY_AND_ASSIGN(BluetoothGattDescriptorServiceProvider); }; -} // namespace bluez +} // namespace chromeos -#endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_H_ +#endif // CHROMEOS_DBUS_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_H_ diff --git a/device/bluetooth/dbus/bluetooth_gatt_manager_client.cc b/chromeos/dbus/bluetooth_gatt_manager_client.cc index 7e471a5..b3e98c6 100644 --- a/device/bluetooth/dbus/bluetooth_gatt_manager_client.cc +++ b/chromeos/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 "device/bluetooth/dbus/bluetooth_gatt_manager_client.h" +#include "chromeos/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 bluez { +namespace chromeos { const char BluetoothGattManagerClient::kNoResponseError[] = "org.chromium.Error.NoResponse"; @@ -126,4 +126,4 @@ BluetoothGattManagerClient* BluetoothGattManagerClient::Create() { return new BluetoothGattManagerClientImpl(); } -} // namespace bluez +} // namespace chromeos diff --git a/device/bluetooth/dbus/bluetooth_gatt_manager_client.h b/chromeos/dbus/bluetooth_gatt_manager_client.h index 3fab5c3..7a16a0b 100644 --- a/device/bluetooth/dbus/bluetooth_gatt_manager_client.h +++ b/chromeos/dbus/bluetooth_gatt_manager_client.h @@ -2,25 +2,24 @@ // 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_GATT_MANAGER_CLIENT_H_ -#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_MANAGER_CLIENT_H_ +#ifndef CHROMEOS_DBUS_BLUETOOTH_GATT_MANAGER_CLIENT_H_ +#define CHROMEOS_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 bluez { +namespace chromeos { // BluetoothGattManagerClient is used to communicate with the GATT Service // manager object of the Bluetooth daemon. -class DEVICE_BLUETOOTH_EXPORT BluetoothGattManagerClient - : public BluezDBusClient { +class CHROMEOS_EXPORT BluetoothGattManagerClient : public DBusClient { public: // Options used to register a GATT service hierarchy. - struct DEVICE_BLUETOOTH_EXPORT Options { + struct CHROMEOS_EXPORT Options { // TODO(armansito): This parameter is not yet clearly defined. Add fields // later as we know more about how this will be used. }; @@ -68,6 +67,6 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothGattManagerClient DISALLOW_COPY_AND_ASSIGN(BluetoothGattManagerClient); }; -} // namespace bluez +} // namespace chromeos -#endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_MANAGER_CLIENT_H_ +#endif // CHROMEOS_DBUS_BLUETOOTH_GATT_MANAGER_CLIENT_H_ diff --git a/device/bluetooth/dbus/bluetooth_gatt_service_client.cc b/chromeos/dbus/bluetooth_gatt_service_client.cc index dc3ef5a..53572f0 100644 --- a/device/bluetooth/dbus/bluetooth_gatt_service_client.cc +++ b/chromeos/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 "device/bluetooth/dbus/bluetooth_gatt_service_client.h" +#include "chromeos/dbus/bluetooth_gatt_service_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 bluez { +namespace chromeos { BluetoothGattServiceClient::Properties::Properties( dbus::ObjectProxy* object_proxy, @@ -140,4 +140,4 @@ BluetoothGattServiceClient* BluetoothGattServiceClient::Create() { return new BluetoothGattServiceClientImpl(); } -} // namespace bluez +} // namespace chromeos diff --git a/device/bluetooth/dbus/bluetooth_gatt_service_client.h b/chromeos/dbus/bluetooth_gatt_service_client.h index 5828c50..9c96bb8 100644 --- a/device/bluetooth/dbus/bluetooth_gatt_service_client.h +++ b/chromeos/dbus/bluetooth_gatt_service_client.h @@ -2,23 +2,22 @@ // 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_GATT_SERVICE_CLIENT_H_ -#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_SERVICE_CLIENT_H_ +#ifndef CHROMEOS_DBUS_BLUETOOTH_GATT_SERVICE_CLIENT_H_ +#define CHROMEOS_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 bluez { +namespace chromeos { // BluetoothGattServiceClient is used to communicate with remote GATT service // objects exposed by the Bluetooth daemon. -class DEVICE_BLUETOOTH_EXPORT BluetoothGattServiceClient - : public BluezDBusClient { +class CHROMEOS_EXPORT BluetoothGattServiceClient : public DBusClient { public: // Structure of properties associated with GATT services. struct Properties : public dbus::PropertySet { @@ -89,6 +88,6 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothGattServiceClient DISALLOW_COPY_AND_ASSIGN(BluetoothGattServiceClient); }; -} // namespace bluez +} // namespace chromeos -#endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_SERVICE_CLIENT_H_ +#endif // CHROMEOS_DBUS_BLUETOOTH_GATT_SERVICE_CLIENT_H_ diff --git a/device/bluetooth/dbus/bluetooth_gatt_service_service_provider.cc b/chromeos/dbus/bluetooth_gatt_service_service_provider.cc index 06b6827..9de86d4 100644 --- a/device/bluetooth/dbus/bluetooth_gatt_service_service_provider.cc +++ b/chromeos/dbus/bluetooth_gatt_service_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 "device/bluetooth/dbus/bluetooth_gatt_service_service_provider.h" +#include "chromeos/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 bluez { +namespace chromeos { namespace { const char kErrorInvalidArgs[] = "org.freedesktop.DBus.Error.InvalidArgs"; const char kErrorPropertyReadOnly[] = @@ -261,7 +261,7 @@ BluetoothGattServiceServiceProvider::Create( const dbus::ObjectPath& object_path, const std::string& uuid, const std::vector<dbus::ObjectPath>& includes) { - if (!bluez::BluezDBusManager::Get()->IsUsingStub()) { + if (!DBusThreadManager::Get()->IsUsingStub(DBusClientBundle::BLUETOOTH)) { return new BluetoothGattServiceServiceProviderImpl(bus, object_path, uuid, includes); } @@ -269,4 +269,4 @@ BluetoothGattServiceServiceProvider::Create( includes); } -} // namespace bluez +} // namespace chromeos diff --git a/device/bluetooth/dbus/bluetooth_gatt_service_service_provider.h b/chromeos/dbus/bluetooth_gatt_service_service_provider.h index 828f096..258c4b4 100644 --- a/device/bluetooth/dbus/bluetooth_gatt_service_service_provider.h +++ b/chromeos/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 DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_H_ -#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_H_ +#ifndef CHROMEOS_DBUS_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_H_ +#define CHROMEOS_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 bluez { +namespace chromeos { // 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 bluez { // 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 DEVICE_BLUETOOTH_EXPORT BluetoothGattServiceServiceProvider { +class CHROMEOS_EXPORT BluetoothGattServiceServiceProvider { public: virtual ~BluetoothGattServiceServiceProvider(); @@ -47,6 +47,6 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothGattServiceServiceProvider { DISALLOW_COPY_AND_ASSIGN(BluetoothGattServiceServiceProvider); }; -} // namespace bluez +} // namespace chromeos -#endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_H_ +#endif // CHROMEOS_DBUS_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_H_ diff --git a/device/bluetooth/dbus/bluetooth_input_client.cc b/chromeos/dbus/bluetooth_input_client.cc index 42542a8..e8b1c8d 100644 --- a/device/bluetooth/dbus/bluetooth_input_client.cc +++ b/chromeos/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 "device/bluetooth/dbus/bluetooth_input_client.h" +#include "chromeos/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 bluez { +namespace chromeos { BluetoothInputClient::Properties::Properties( dbus::ObjectProxy* object_proxy, @@ -125,4 +125,4 @@ BluetoothInputClient* BluetoothInputClient::Create() { return new BluetoothInputClientImpl(); } -} // namespace bluez +} // namespace chromeos diff --git a/device/bluetooth/dbus/bluetooth_input_client.h b/chromeos/dbus/bluetooth_input_client.h index 0059506..02abf99 100644 --- a/device/bluetooth/dbus/bluetooth_input_client.h +++ b/chromeos/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 DEVICE_BLUETOOTH_DBUS_BLUETOOTH_INPUT_CLIENT_H_ -#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_INPUT_CLIENT_H_ +#ifndef CHROMEOS_DBUS_BLUETOOTH_INPUT_CLIENT_H_ +#define CHROMEOS_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 bluez { +namespace chromeos { // BluetoothInputClient is used to communicate with objects representing // Bluetooth Input (HID) devices. -class DEVICE_BLUETOOTH_EXPORT BluetoothInputClient : public BluezDBusClient { +class CHROMEOS_EXPORT BluetoothInputClient : public DBusClient { public: // Structure of properties associated with bluetooth input devices. struct Properties : public dbus::PropertySet { @@ -76,6 +76,6 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothInputClient : public BluezDBusClient { DISALLOW_COPY_AND_ASSIGN(BluetoothInputClient); }; -} // namespace bluez +} // namespace chromeos -#endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_INPUT_CLIENT_H_ +#endif // CHROMEOS_DBUS_BLUETOOTH_INPUT_CLIENT_H_ diff --git a/device/bluetooth/dbus/bluetooth_le_advertisement_service_provider.cc b/chromeos/dbus/bluetooth_le_advertisement_service_provider.cc index e981124..dfaeb5e 100644 --- a/device/bluetooth/dbus/bluetooth_le_advertisement_service_provider.cc +++ b/chromeos/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 "device/bluetooth/dbus/bluetooth_le_advertisement_service_provider.h" +#include "chromeos/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 bluez { +namespace chromeos { namespace { const char kErrorInvalidArgs[] = "org.freedesktop.DBus.Error.InvalidArgs"; @@ -413,7 +413,7 @@ BluetoothLEAdvertisementServiceProvider::Create( scoped_ptr<ManufacturerData> manufacturer_data, scoped_ptr<UUIDList> solicit_uuids, scoped_ptr<ServiceData> service_data) { - if (!bluez::BluezDBusManager::Get()->IsUsingStub()) { + if (!DBusThreadManager::Get()->IsUsingStub(DBusClientBundle::BLUETOOTH)) { return make_scoped_ptr(new BluetoothAdvertisementServiceProviderImpl( bus, object_path, delegate, type, service_uuids.Pass(), manufacturer_data.Pass(), solicit_uuids.Pass(), service_data.Pass())); @@ -423,4 +423,4 @@ BluetoothLEAdvertisementServiceProvider::Create( } } -} // namespace bluez +} // namespace chromeos diff --git a/device/bluetooth/dbus/bluetooth_le_advertisement_service_provider.h b/chromeos/dbus/bluetooth_le_advertisement_service_provider.h index 8f4692f..98622a2 100644 --- a/device/bluetooth/dbus/bluetooth_le_advertisement_service_provider.h +++ b/chromeos/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 DEVICE_BLUETOOTH_DBUS_BLUETOOTH_LE_ADVERTISEMENT_SERVICE_PROVIDER_H_ -#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_LE_ADVERTISEMENT_SERVICE_PROVIDER_H_ +#ifndef CHROMEOS_DBUS_BLUETOOTH_LE_ADVERTISEMENT_SERVICE_PROVIDER_H_ +#define CHROMEOS_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 bluez { +namespace chromeos { // BluetoothAdvertisementServiceProvider is used to provide a D-Bus object that // the Bluetooth daemon can communicate with to advertise data. -class DEVICE_BLUETOOTH_EXPORT BluetoothLEAdvertisementServiceProvider { +class CHROMEOS_EXPORT BluetoothLEAdvertisementServiceProvider { public: using UUIDList = std::vector<std::string>; using ManufacturerData = std::map<uint16_t, std::vector<uint8_t>>; @@ -77,6 +77,6 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothLEAdvertisementServiceProvider { DISALLOW_COPY_AND_ASSIGN(BluetoothLEAdvertisementServiceProvider); }; -} // namespace bluez +} // namespace chromeos -#endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_LE_ADVERTISEMENT_SERVICE_PROVIDER_H_ +#endif // CHROMEOS_DBUS_BLUETOOTH_LE_ADVERTISEMENT_SERVICE_PROVIDER_H_ diff --git a/device/bluetooth/dbus/bluetooth_le_advertising_manager_client.cc b/chromeos/dbus/bluetooth_le_advertising_manager_client.cc index 3c934e6..ca2c9e2 100644 --- a/device/bluetooth/dbus/bluetooth_le_advertising_manager_client.cc +++ b/chromeos/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 "device/bluetooth/dbus/bluetooth_le_advertising_manager_client.h" +#include "chromeos/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 bluez { +namespace chromeos { const char BluetoothLEAdvertisingManagerClient::kNoResponseError[] = "org.chromium.Error.NoResponse"; @@ -184,4 +184,4 @@ BluetoothLEAdvertisingManagerClient::Create() { return new BluetoothAdvertisementManagerClientImpl(); } -} // namespace bluez +} // namespace chromeos diff --git a/device/bluetooth/dbus/bluetooth_le_advertising_manager_client.h b/chromeos/dbus/bluetooth_le_advertising_manager_client.h index f4e7b34c..5160a9f 100644 --- a/device/bluetooth/dbus/bluetooth_le_advertising_manager_client.h +++ b/chromeos/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 DEVICE_BLUETOOTH_DBUS_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_ -#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_ +#ifndef CHROMEOS_DBUS_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_ +#define CHROMEOS_DBUS_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_ #include <string> #include <vector> @@ -11,16 +11,15 @@ #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 bluez { +namespace chromeos { // BluetoothAdvertisingManagerClient is used to communicate with the advertising // manager object of the BlueZ daemon. -class DEVICE_BLUETOOTH_EXPORT BluetoothLEAdvertisingManagerClient - : public BluezDBusClient { +class CHROMEOS_EXPORT BluetoothLEAdvertisingManagerClient : public DBusClient { public: // Interface for observing changes to advertising managers. class Observer { @@ -79,6 +78,6 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothLEAdvertisingManagerClient DISALLOW_COPY_AND_ASSIGN(BluetoothLEAdvertisingManagerClient); }; -} // namespace bluez +} // namespace chromeos -#endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_ +#endif // CHROMEOS_DBUS_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_ diff --git a/device/bluetooth/dbus/bluetooth_media_client.cc b/chromeos/dbus/bluetooth_media_client.cc index 0927d45..301f765 100644 --- a/device/bluetooth/dbus/bluetooth_media_client.cc +++ b/chromeos/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 "device/bluetooth/dbus/bluetooth_media_client.h" +#include "chromeos/dbus/bluetooth_media_client.h" #include "base/bind.h" #include "base/logging.h" @@ -35,7 +35,7 @@ const char kCapabilitiesEndpointProperty[] = "Capabilities"; } // namespace -namespace bluez { +namespace chromeos { // static const char BluetoothMediaClient::kNoResponseError[] = @@ -224,4 +224,4 @@ BluetoothMediaClient* BluetoothMediaClient::Create() { return new BluetoothMediaClientImpl(); } -} // namespace bluez +} // namespace chromeos diff --git a/device/bluetooth/dbus/bluetooth_media_client.h b/chromeos/dbus/bluetooth_media_client.h index 8c7050b..1bb5547 100644 --- a/device/bluetooth/dbus/bluetooth_media_client.h +++ b/chromeos/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 DEVICE_BLUETOOTH_DBUS_BLUETOOTH_MEDIA_CLIENT_H_ -#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_MEDIA_CLIENT_H_ +#ifndef CHROMEOS_DBUS_BLUETOOTH_MEDIA_CLIENT_H_ +#define CHROMEOS_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 bluez { +namespace chromeos { // BluetoothMediaClient is used to communicate with the Media interface of a // local Bluetooth adapter. -class DEVICE_BLUETOOTH_EXPORT BluetoothMediaClient : public BluezDBusClient { +class CHROMEOS_EXPORT BluetoothMediaClient : public DBusClient { public: // Properties used to register a Media Endpoint. - struct DEVICE_BLUETOOTH_EXPORT EndpointProperties { + struct CHROMEOS_EXPORT EndpointProperties { EndpointProperties(); ~EndpointProperties(); @@ -102,6 +102,6 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothMediaClient : public BluezDBusClient { DISALLOW_COPY_AND_ASSIGN(BluetoothMediaClient); }; -} // namespace bluez +} // namespace chromeos -#endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_MEDIA_CLIENT_H_ +#endif // CHROMEOS_DBUS_BLUETOOTH_MEDIA_CLIENT_H_ diff --git a/device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.cc b/chromeos/dbus/bluetooth_media_endpoint_service_provider.cc index 864a04d..9dd7720 100644 --- a/device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.cc +++ b/chromeos/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 "device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.h" +#include "chromeos/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 bluez { +namespace chromeos { // The BluetoothMediaEndopintServiceProvider implementation used in production. -class DEVICE_BLUETOOTH_EXPORT BluetoothMediaEndpointServiceProviderImpl +class CHROMEOS_EXPORT BluetoothMediaEndpointServiceProviderImpl : public BluetoothMediaEndpointServiceProvider { public: BluetoothMediaEndpointServiceProviderImpl(dbus::Bus* bus, @@ -302,7 +302,7 @@ BluetoothMediaEndpointServiceProvider::Create( const dbus::ObjectPath& object_path, Delegate* delegate) { // Returns a real implementation. - if (!bluez::BluezDBusManager::Get()->IsUsingStub()) { + if (!DBusThreadManager::Get()->IsUsingStub(DBusClientBundle::BLUETOOTH)) { return new BluetoothMediaEndpointServiceProviderImpl(bus, object_path, delegate); } @@ -310,4 +310,4 @@ BluetoothMediaEndpointServiceProvider::Create( return new FakeBluetoothMediaEndpointServiceProvider(object_path, delegate); } -} // namespace bluez +} // namespace chromeos diff --git a/device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.h b/chromeos/dbus/bluetooth_media_endpoint_service_provider.h index df17f09..fffaa53 100644 --- a/device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.h +++ b/chromeos/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 DEVICE_BLUETOOTH_DBUS_BLUETOOTH_MEDIA_ENDPOINT_SERVICE_PROVIDER_H_ -#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_MEDIA_ENDPOINT_SERVICE_PROVIDER_H_ +#ifndef CHROMEOS_DBUS_BLUETOOTH_MEDIA_ENDPOINT_SERVICE_PROVIDER_H_ +#define CHROMEOS_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 bluez { +namespace chromeos { // 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 bluez { // 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 DEVICE_BLUETOOTH_EXPORT BluetoothMediaEndpointServiceProvider { +class CHROMEOS_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 DEVICE_BLUETOOTH_EXPORT BluetoothMediaEndpointServiceProvider { class Delegate { public: // Transport-specific properties. - struct DEVICE_BLUETOOTH_EXPORT TransportProperties { + struct CHROMEOS_EXPORT TransportProperties { TransportProperties(); ~TransportProperties(); @@ -128,6 +128,6 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothMediaEndpointServiceProvider { DISALLOW_COPY_AND_ASSIGN(BluetoothMediaEndpointServiceProvider); }; -} // namespace bluez +} // namespace chromeos -#endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_MEDIA_ENDPOINT_SERVICE_PROVIDER_H_ +#endif // CHROMEOS_DBUS_BLUETOOTH_MEDIA_ENDPOINT_SERVICE_PROVIDER_H_ diff --git a/device/bluetooth/dbus/bluetooth_media_transport_client.cc b/chromeos/dbus/bluetooth_media_transport_client.cc index 7fc47d7..3117de2 100644 --- a/device/bluetooth/dbus/bluetooth_media_transport_client.cc +++ b/chromeos/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 "device/bluetooth/dbus/bluetooth_media_transport_client.h" +#include "chromeos/dbus/bluetooth_media_transport_client.h" #include "base/bind.h" #include "base/logging.h" @@ -31,7 +31,7 @@ const char kRelease[] = "Release"; } // namespace -namespace bluez { +namespace chromeos { // static const char BluetoothMediaTransportClient::kDeviceProperty[] = "Device"; @@ -283,4 +283,4 @@ BluetoothMediaTransportClient* BluetoothMediaTransportClient::Create() { return new BluetoothMediaTransportClientImpl(); } -} // namespace bluez +} // namespace chromeos diff --git a/device/bluetooth/dbus/bluetooth_media_transport_client.h b/chromeos/dbus/bluetooth_media_transport_client.h index 1314b26..4476ae7 100644 --- a/device/bluetooth/dbus/bluetooth_media_transport_client.h +++ b/chromeos/dbus/bluetooth_media_transport_client.h @@ -2,23 +2,22 @@ // 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_MEDIA_TRANSPORT_CLIENT_H_ -#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_ +#ifndef CHROMEOS_DBUS_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_ +#define CHROMEOS_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 bluez { +namespace chromeos { -class DEVICE_BLUETOOTH_EXPORT BluetoothMediaTransportClient - : public BluezDBusClient { +class CHROMEOS_EXPORT BluetoothMediaTransportClient : public DBusClient { public: struct Properties : public dbus::PropertySet { // The path to the device object which the transport is connected to. @@ -138,6 +137,6 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothMediaTransportClient DISALLOW_COPY_AND_ASSIGN(BluetoothMediaTransportClient); }; -} // namespace bluez +} // namespace chromeos -#endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_ +#endif // CHROMEOS_DBUS_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_ diff --git a/device/bluetooth/dbus/bluetooth_profile_manager_client.cc b/chromeos/dbus/bluetooth_profile_manager_client.cc index 742988a..01301d4 100644 --- a/device/bluetooth/dbus/bluetooth_profile_manager_client.cc +++ b/chromeos/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 "device/bluetooth/dbus/bluetooth_profile_manager_client.h" +#include "chromeos/dbus/bluetooth_profile_manager_client.h" #include "base/bind.h" #include "base/logging.h" @@ -11,7 +11,7 @@ #include "dbus/object_proxy.h" #include "third_party/cros_system_api/dbus/service_constants.h" -namespace bluez { +namespace chromeos { const char BluetoothProfileManagerClient::kNoResponseError[] = "org.chromium.Error.NoResponse"; @@ -231,4 +231,4 @@ BluetoothProfileManagerClient* BluetoothProfileManagerClient::Create() { return new BluetoothProfileManagerClientImpl(); } -} // namespace bluez +} // namespace chromeos diff --git a/device/bluetooth/dbus/bluetooth_profile_manager_client.h b/chromeos/dbus/bluetooth_profile_manager_client.h index 31f7fef..8f53412 100644 --- a/device/bluetooth/dbus/bluetooth_profile_manager_client.h +++ b/chromeos/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 DEVICE_BLUETOOTH_DBUS_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_ -#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_ +#ifndef CHROMEOS_DBUS_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_ +#define CHROMEOS_DBUS_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_ #include <string> #include <vector> @@ -11,16 +11,15 @@ #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 bluez { +namespace chromeos { // BluetoothProfileManagerClient is used to communicate with the profile // manager object of the Bluetooth daemon. -class DEVICE_BLUETOOTH_EXPORT BluetoothProfileManagerClient - : public BluezDBusClient { +class CHROMEOS_EXPORT BluetoothProfileManagerClient : public DBusClient { 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 @@ -28,7 +27,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothProfileManagerClient enum ProfileRole { SYMMETRIC, CLIENT, SERVER }; // Options used to register a Profile object. - struct DEVICE_BLUETOOTH_EXPORT Options { + struct CHROMEOS_EXPORT Options { Options(); ~Options(); @@ -103,6 +102,6 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothProfileManagerClient DISALLOW_COPY_AND_ASSIGN(BluetoothProfileManagerClient); }; -} // namespace bluez +} // namespace chromeos -#endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_ +#endif // CHROMEOS_DBUS_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_ diff --git a/device/bluetooth/dbus/bluetooth_profile_service_provider.cc b/chromeos/dbus/bluetooth_profile_service_provider.cc index a2a23bb..f63f5ea 100644 --- a/device/bluetooth/dbus/bluetooth_profile_service_provider.cc +++ b/chromeos/dbus/bluetooth_profile_service_provider.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 "device/bluetooth/dbus/bluetooth_profile_service_provider.h" +#include "chromeos/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 bluez { +namespace chromeos { // The BluetoothProfileServiceProvider implementation used in production. class BluetoothProfileServiceProviderImpl @@ -238,11 +238,11 @@ BluetoothProfileServiceProvider* BluetoothProfileServiceProvider::Create( dbus::Bus* bus, const dbus::ObjectPath& object_path, Delegate* delegate) { - if (!bluez::BluezDBusManager::Get()->IsUsingStub()) { + if (!DBusThreadManager::Get()->IsUsingStub(DBusClientBundle::BLUETOOTH)) { return new BluetoothProfileServiceProviderImpl(bus, object_path, delegate); } else { return new FakeBluetoothProfileServiceProvider(object_path, delegate); } } -} // namespace bluez +} // namespace chromeos diff --git a/device/bluetooth/dbus/bluetooth_profile_service_provider.h b/chromeos/dbus/bluetooth_profile_service_provider.h index f2db22c..366a354 100644 --- a/device/bluetooth/dbus/bluetooth_profile_service_provider.h +++ b/chromeos/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 DEVICE_BLUETOOTH_DBUS_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_ -#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_ +#ifndef CHROMEOS_DBUS_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_ +#define CHROMEOS_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 bluez { +namespace chromeos { // 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 bluez { // 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 DEVICE_BLUETOOTH_EXPORT BluetoothProfileServiceProvider { +class CHROMEOS_EXPORT BluetoothProfileServiceProvider { public: // Interface for reacting to profile requests. class Delegate { @@ -43,7 +43,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothProfileServiceProvider { enum Status { SUCCESS, REJECTED, CANCELLED }; // Connection-specific options. - struct DEVICE_BLUETOOTH_EXPORT Options { + struct CHROMEOS_EXPORT Options { Options() {} ~Options() {} @@ -115,6 +115,6 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothProfileServiceProvider { DISALLOW_COPY_AND_ASSIGN(BluetoothProfileServiceProvider); }; -} // namespace bluez +} // namespace chromeos -#endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_ +#endif // CHROMEOS_DBUS_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_ diff --git a/chromeos/dbus/dbus_client_bundle.cc b/chromeos/dbus/dbus_client_bundle.cc index 87e6598..642ffb4 100644 --- a/chromeos/dbus/dbus_client_bundle.cc +++ b/chromeos/dbus/dbus_client_bundle.cc @@ -13,6 +13,18 @@ #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" @@ -21,6 +33,18 @@ #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" @@ -133,6 +157,45 @@ 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 ea39ad9..a9a115b 100644 --- a/chromeos/dbus/dbus_client_bundle.h +++ b/chromeos/dbus/dbus_client_bundle.h @@ -15,6 +15,18 @@ 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; @@ -104,6 +116,55 @@ 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(); } @@ -230,6 +291,20 @@ 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 fe59021..1addc55 100644 --- a/chromeos/dbus/dbus_thread_manager.cc +++ b/chromeos/dbus/dbus_thread_manager.cc @@ -11,6 +11,18 @@ #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" @@ -115,6 +127,60 @@ 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(); } @@ -242,6 +308,18 @@ 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()); @@ -396,6 +474,79 @@ 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 83f3c26..322ab28 100644 --- a/chromeos/dbus/dbus_thread_manager.h +++ b/chromeos/dbus/dbus_thread_manager.h @@ -28,6 +28,18 @@ 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; @@ -112,6 +124,18 @@ 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(); @@ -186,6 +210,26 @@ 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/dbus/fake_bluetooth_adapter_client.cc b/chromeos/dbus/fake_bluetooth_adapter_client.cc index f928768..1ff4bcc 100644 --- a/device/bluetooth/dbus/fake_bluetooth_adapter_client.cc +++ b/chromeos/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 "device/bluetooth/dbus/fake_bluetooth_adapter_client.h" +#include "chromeos/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 "device/bluetooth/dbus/bluez_dbus_manager.h" -#include "device/bluetooth/dbus/fake_bluetooth_device_client.h" +#include "chromeos/dbus/dbus_thread_manager.h" +#include "chromeos/dbus/fake_bluetooth_device_client.h" #include "third_party/cros_system_api/dbus/service_constants.h" -namespace bluez { +namespace chromeos { namespace { @@ -139,7 +139,7 @@ void FakeBluetoothAdapterClient::StartDiscovery( FakeBluetoothDeviceClient* device_client = static_cast<FakeBluetoothDeviceClient*>( - bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()); + DBusThreadManager::Get()->GetBluetoothDeviceClient()); device_client->BeginDiscoverySimulation(dbus::ObjectPath(kAdapterPath)); } } @@ -167,7 +167,7 @@ void FakeBluetoothAdapterClient::StopDiscovery( if (discovering_count_ == 0) { FakeBluetoothDeviceClient* device_client = static_cast<FakeBluetoothDeviceClient*>( - bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()); + DBusThreadManager::Get()->GetBluetoothDeviceClient()); device_client->EndDiscoverySimulation(dbus::ObjectPath(kAdapterPath)); if (simulation_interval_ms_ > 100) { @@ -196,7 +196,7 @@ void FakeBluetoothAdapterClient::RemoveDevice( FakeBluetoothDeviceClient* device_client = static_cast<FakeBluetoothDeviceClient*>( - bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()); + DBusThreadManager::Get()->GetBluetoothDeviceClient()); device_client->RemoveDevice(dbus::ObjectPath(kAdapterPath), device_path); } @@ -293,4 +293,4 @@ void FakeBluetoothAdapterClient::PostDelayedTask( base::TimeDelta::FromMilliseconds(simulation_interval_ms_)); } -} // namespace bluez +} // namespace chromeos diff --git a/device/bluetooth/dbus/fake_bluetooth_adapter_client.h b/chromeos/dbus/fake_bluetooth_adapter_client.h index 51cd808..987fc6f 100644 --- a/device/bluetooth/dbus/fake_bluetooth_adapter_client.h +++ b/chromeos/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 bluez { +namespace chromeos { // 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 DEVICE_BLUETOOTH_EXPORT FakeBluetoothAdapterClient +class CHROMEOS_EXPORT FakeBluetoothAdapterClient : public BluetoothAdapterClient { public: struct Properties : public BluetoothAdapterClient::Properties { @@ -113,6 +113,6 @@ class DEVICE_BLUETOOTH_EXPORT FakeBluetoothAdapterClient int simulation_interval_ms_; }; -} // namespace bluez +} // namespace chromeos #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_ADAPTER_CLIENT_H_ diff --git a/device/bluetooth/dbus/fake_bluetooth_agent_manager_client.cc b/chromeos/dbus/fake_bluetooth_agent_manager_client.cc index 5904441..4ced274 100644 --- a/device/bluetooth/dbus/fake_bluetooth_agent_manager_client.cc +++ b/chromeos/dbus/fake_bluetooth_agent_manager_client.cc @@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "device/bluetooth/dbus/fake_bluetooth_agent_manager_client.h" +#include "chromeos/dbus/fake_bluetooth_agent_manager_client.h" #include "base/logging.h" -#include "device/bluetooth/dbus/fake_bluetooth_agent_service_provider.h" +#include "chromeos/dbus/fake_bluetooth_agent_service_provider.h" #include "third_party/cros_system_api/dbus/service_constants.h" -namespace bluez { +namespace chromeos { FakeBluetoothAgentManagerClient::FakeBluetoothAgentManagerClient() : service_provider_(NULL) {} @@ -75,4 +75,4 @@ FakeBluetoothAgentManagerClient::GetAgentServiceProvider() { return service_provider_; } -} // namespace bluez +} // namespace chromeos diff --git a/device/bluetooth/dbus/fake_bluetooth_agent_manager_client.h b/chromeos/dbus/fake_bluetooth_agent_manager_client.h index 8d7e30c..68c91202c3 100644 --- a/device/bluetooth/dbus/fake_bluetooth_agent_manager_client.h +++ b/chromeos/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 bluez { +namespace chromeos { 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 DEVICE_BLUETOOTH_EXPORT FakeBluetoothAgentManagerClient +class CHROMEOS_EXPORT FakeBluetoothAgentManagerClient : public BluetoothAgentManagerClient { public: FakeBluetoothAgentManagerClient(); @@ -52,6 +52,6 @@ class DEVICE_BLUETOOTH_EXPORT FakeBluetoothAgentManagerClient FakeBluetoothAgentServiceProvider* service_provider_; }; -} // namespace bluez +} // namespace chromeos #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_AGENT_MANAGER_CLIENT_H_ diff --git a/device/bluetooth/dbus/fake_bluetooth_agent_service_provider.cc b/chromeos/dbus/fake_bluetooth_agent_service_provider.cc index 777deb0..de2dbd3 100644 --- a/device/bluetooth/dbus/fake_bluetooth_agent_service_provider.cc +++ b/chromeos/dbus/fake_bluetooth_agent_service_provider.cc @@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "device/bluetooth/dbus/fake_bluetooth_agent_service_provider.h" +#include "chromeos/dbus/fake_bluetooth_agent_service_provider.h" -#include "device/bluetooth/dbus/bluez_dbus_manager.h" -#include "device/bluetooth/dbus/fake_bluetooth_agent_manager_client.h" +#include "chromeos/dbus/dbus_thread_manager.h" +#include "chromeos/dbus/fake_bluetooth_agent_manager_client.h" -namespace bluez { +namespace chromeos { FakeBluetoothAgentServiceProvider::FakeBluetoothAgentServiceProvider( const dbus::ObjectPath& object_path, @@ -17,7 +17,7 @@ FakeBluetoothAgentServiceProvider::FakeBluetoothAgentServiceProvider( FakeBluetoothAgentManagerClient* fake_bluetooth_agent_manager_client = static_cast<FakeBluetoothAgentManagerClient*>( - bluez::BluezDBusManager::Get()->GetBluetoothAgentManagerClient()); + DBusThreadManager::Get()->GetBluetoothAgentManagerClient()); fake_bluetooth_agent_manager_client->RegisterAgentServiceProvider(this); } @@ -26,7 +26,7 @@ FakeBluetoothAgentServiceProvider::~FakeBluetoothAgentServiceProvider() { FakeBluetoothAgentManagerClient* fake_bluetooth_agent_manager_client = static_cast<FakeBluetoothAgentManagerClient*>( - bluez::BluezDBusManager::Get()->GetBluetoothAgentManagerClient()); + DBusThreadManager::Get()->GetBluetoothAgentManagerClient()); fake_bluetooth_agent_manager_client->UnregisterAgentServiceProvider(this); } @@ -99,4 +99,4 @@ void FakeBluetoothAgentServiceProvider::Cancel() { delegate_->Cancel(); } -} // namespace bluez +} // namespace chromeos diff --git a/device/bluetooth/dbus/fake_bluetooth_agent_service_provider.h b/chromeos/dbus/fake_bluetooth_agent_service_provider.h index 37e1ce6..6d17519 100644 --- a/device/bluetooth/dbus/fake_bluetooth_agent_service_provider.h +++ b/chromeos/dbus/fake_bluetooth_agent_service_provider.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_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 bluez { +namespace chromeos { 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 DEVICE_BLUETOOTH_EXPORT FakeBluetoothAgentServiceProvider +class CHROMEOS_EXPORT FakeBluetoothAgentServiceProvider : public BluetoothAgentServiceProvider { public: FakeBluetoothAgentServiceProvider(const dbus::ObjectPath& object_path, @@ -63,6 +63,6 @@ class DEVICE_BLUETOOTH_EXPORT FakeBluetoothAgentServiceProvider Delegate* delegate_; }; -} // namespace bluez +} // namespace chromeos #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_ diff --git a/device/bluetooth/dbus/fake_bluetooth_device_client.cc b/chromeos/dbus/fake_bluetooth_device_client.cc index 33dacab..b910b37 100644 --- a/device/bluetooth/dbus/fake_bluetooth_device_client.cc +++ b/chromeos/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 "device/bluetooth/dbus/fake_bluetooth_device_client.h" +#include "chromeos/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 bluez { +namespace chromeos { const char FakeBluetoothDeviceClient::kTestPinCode[] = "123456"; const int FakeBluetoothDeviceClient::kTestPassKey = 123456; @@ -387,7 +387,7 @@ void FakeBluetoothDeviceClient::Connect(const dbus::ObjectPath& object_path, if (object_path == dbus::ObjectPath(kLowEnergyPath)) { FakeBluetoothGattServiceClient* gatt_service_client = static_cast<FakeBluetoothGattServiceClient*>( - bluez::BluezDBusManager::Get()->GetBluetoothGattServiceClient()); + DBusThreadManager::Get()->GetBluetoothGattServiceClient()); gatt_service_client->ExposeHeartRateService( dbus::ObjectPath(kLowEnergyPath)); } @@ -411,7 +411,7 @@ void FakeBluetoothDeviceClient::Disconnect( if (object_path == dbus::ObjectPath(kLowEnergyPath)) { FakeBluetoothGattServiceClient* gatt_service_client = static_cast<FakeBluetoothGattServiceClient*>( - bluez::BluezDBusManager::Get()->GetBluetoothGattServiceClient()); + DBusThreadManager::Get()->GetBluetoothGattServiceClient()); gatt_service_client->HideHeartRateService(); } @@ -428,7 +428,7 @@ void FakeBluetoothDeviceClient::ConnectProfile( FakeBluetoothProfileManagerClient* fake_bluetooth_profile_manager_client = static_cast<FakeBluetoothProfileManagerClient*>( - bluez::BluezDBusManager::Get()->GetBluetoothProfileManagerClient()); + DBusThreadManager::Get()->GetBluetoothProfileManagerClient()); FakeBluetoothProfileServiceProvider* profile_service_provider = fake_bluetooth_profile_manager_client->GetProfileServiceProvider(uuid); if (profile_service_provider == NULL) { @@ -491,7 +491,7 @@ void FakeBluetoothDeviceClient::DisconnectProfile( FakeBluetoothProfileManagerClient* fake_bluetooth_profile_manager_client = static_cast<FakeBluetoothProfileManagerClient*>( - bluez::BluezDBusManager::Get()->GetBluetoothProfileManagerClient()); + DBusThreadManager::Get()->GetBluetoothProfileManagerClient()); FakeBluetoothProfileServiceProvider* profile_service_provider = fake_bluetooth_profile_manager_client->GetProfileServiceProvider(uuid); if (profile_service_provider == NULL) { @@ -1002,13 +1002,13 @@ void FakeBluetoothDeviceClient::RemoveDevice( // BluetoothDeviceChromeOS object, including the device_path referenced here. FakeBluetoothInputClient* fake_bluetooth_input_client = static_cast<FakeBluetoothInputClient*>( - bluez::BluezDBusManager::Get()->GetBluetoothInputClient()); + DBusThreadManager::Get()->GetBluetoothInputClient()); fake_bluetooth_input_client->RemoveInputDevice(device_path); if (device_path == dbus::ObjectPath(kLowEnergyPath)) { FakeBluetoothGattServiceClient* gatt_service_client = static_cast<FakeBluetoothGattServiceClient*>( - bluez::BluezDBusManager::Get()->GetBluetoothGattServiceClient()); + DBusThreadManager::Get()->GetBluetoothGattServiceClient()); gatt_service_client->HideHeartRateService(); } @@ -1172,7 +1172,7 @@ void FakeBluetoothDeviceClient::SimulatePairing( FakeBluetoothAgentManagerClient* fake_bluetooth_agent_manager_client = static_cast<FakeBluetoothAgentManagerClient*>( - bluez::BluezDBusManager::Get()->GetBluetoothAgentManagerClient()); + DBusThreadManager::Get()->GetBluetoothAgentManagerClient()); FakeBluetoothAgentServiceProvider* agent_service_provider = fake_bluetooth_agent_manager_client->GetAgentServiceProvider(); CHECK(agent_service_provider != NULL); @@ -1425,7 +1425,7 @@ void FakeBluetoothDeviceClient::AddInputDeviceIfNeeded( // simulate the Input interface. FakeBluetoothInputClient* fake_bluetooth_input_client = static_cast<FakeBluetoothInputClient*>( - bluez::BluezDBusManager::Get()->GetBluetoothInputClient()); + DBusThreadManager::Get()->GetBluetoothInputClient()); if ((properties->bluetooth_class.value() & 0x001f03) == 0x000500) fake_bluetooth_input_client->AddInputDevice(object_path); @@ -1595,7 +1595,7 @@ void FakeBluetoothDeviceClient::SimulateKeypress( FakeBluetoothAgentManagerClient* fake_bluetooth_agent_manager_client = static_cast<FakeBluetoothAgentManagerClient*>( - bluez::BluezDBusManager::Get()->GetBluetoothAgentManagerClient()); + DBusThreadManager::Get()->GetBluetoothAgentManagerClient()); FakeBluetoothAgentServiceProvider* agent_service_provider = fake_bluetooth_agent_manager_client->GetAgentServiceProvider(); @@ -1658,4 +1658,4 @@ void FakeBluetoothDeviceClient::DisconnectionCallback( } } -} // namespace bluez +} // namespace chromeos diff --git a/device/bluetooth/dbus/fake_bluetooth_device_client.h b/chromeos/dbus/fake_bluetooth_device_client.h index d44bde5..03a2cb1 100644 --- a/device/bluetooth/dbus/fake_bluetooth_device_client.h +++ b/chromeos/dbus/fake_bluetooth_device_client.h @@ -12,20 +12,19 @@ #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 bluez { +namespace chromeos { // 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 DEVICE_BLUETOOTH_EXPORT FakeBluetoothDeviceClient - : public BluetoothDeviceClient { +class CHROMEOS_EXPORT FakeBluetoothDeviceClient : public BluetoothDeviceClient { public: struct Properties : public BluetoothDeviceClient::Properties { explicit Properties(const PropertyChangedCallback& callback); @@ -316,6 +315,6 @@ class DEVICE_BLUETOOTH_EXPORT FakeBluetoothDeviceClient int16 max_transmit_power_; }; -} // namespace bluez +} // namespace chromeos #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_DEVICE_CLIENT_H_ diff --git a/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.cc b/chromeos/dbus/fake_bluetooth_gatt_characteristic_client.cc index 10f073a..69779ec 100644 --- a/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.cc +++ b/chromeos/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 "device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.h" +#include "chromeos/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 "device/bluetooth/dbus/bluez_dbus_manager.h" -#include "device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_client.h" +#include "chromeos/dbus/dbus_thread_manager.h" +#include "chromeos/dbus/fake_bluetooth_gatt_descriptor_client.h" #include "third_party/cros_system_api/dbus/service_constants.h" -namespace bluez { +namespace chromeos { namespace { @@ -377,7 +377,7 @@ void FakeBluetoothGattCharacteristicClient::ExposeHeartRateCharacteristics( // Expose CCC descriptor for Heart Rate Measurement characteristic. FakeBluetoothGattDescriptorClient* descriptor_client = static_cast<FakeBluetoothGattDescriptorClient*>( - bluez::BluezDBusManager::Get()->GetBluetoothGattDescriptorClient()); + DBusThreadManager::Get()->GetBluetoothGattDescriptorClient()); dbus::ObjectPath ccc_path(descriptor_client->ExposeDescriptor( dbus::ObjectPath(heart_rate_measurement_path_), FakeBluetoothGattDescriptorClient:: @@ -397,7 +397,7 @@ void FakeBluetoothGattCharacteristicClient::HideHeartRateCharacteristics() { // Hide the descriptors. FakeBluetoothGattDescriptorClient* descriptor_client = static_cast<FakeBluetoothGattDescriptorClient*>( - bluez::BluezDBusManager::Get()->GetBluetoothGattDescriptorClient()); + DBusThreadManager::Get()->GetBluetoothGattDescriptorClient()); descriptor_client->HideDescriptor( dbus::ObjectPath(heart_rate_measurement_ccc_desc_path_)); @@ -559,4 +559,4 @@ bool FakeBluetoothGattCharacteristicClient::IsHeartRateVisible() const { return heart_rate_visible_; } -} // namespace bluez +} // namespace chromeos diff --git a/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.h b/chromeos/dbus/fake_bluetooth_gatt_characteristic_client.h index dc5196d..dc1eab3 100644 --- a/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.h +++ b/chromeos/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 bluez { +namespace chromeos { // 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 DEVICE_BLUETOOTH_EXPORT FakeBluetoothGattCharacteristicClient +class CHROMEOS_EXPORT FakeBluetoothGattCharacteristicClient : public BluetoothGattCharacteristicClient { public: struct Properties : public BluetoothGattCharacteristicClient::Properties { @@ -189,6 +189,6 @@ class DEVICE_BLUETOOTH_EXPORT FakeBluetoothGattCharacteristicClient DISALLOW_COPY_AND_ASSIGN(FakeBluetoothGattCharacteristicClient); }; -} // namespace bluez +} // namespace chromeos #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_CHARACTERISTIC_CLIENT_H_ diff --git a/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.cc b/chromeos/dbus/fake_bluetooth_gatt_characteristic_service_provider.cc index 03f06d0..39132d9 100644 --- a/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.cc +++ b/chromeos/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 "device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.h" +#include "chromeos/dbus/fake_bluetooth_gatt_characteristic_service_provider.h" #include "base/logging.h" #include "base/strings/string_util.h" -#include "device/bluetooth/dbus/bluez_dbus_manager.h" -#include "device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.h" +#include "chromeos/dbus/dbus_thread_manager.h" +#include "chromeos/dbus/fake_bluetooth_gatt_manager_client.h" -namespace bluez { +namespace chromeos { FakeBluetoothGattCharacteristicServiceProvider:: FakeBluetoothGattCharacteristicServiceProvider( @@ -36,7 +36,7 @@ FakeBluetoothGattCharacteristicServiceProvider:: FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client = static_cast<FakeBluetoothGattManagerClient*>( - bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient()); + DBusThreadManager::Get()->GetBluetoothGattManagerClient()); fake_bluetooth_gatt_manager_client->RegisterCharacteristicServiceProvider( this); } @@ -48,7 +48,7 @@ FakeBluetoothGattCharacteristicServiceProvider:: FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client = static_cast<FakeBluetoothGattManagerClient*>( - bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient()); + DBusThreadManager::Get()->GetBluetoothGattManagerClient()); fake_bluetooth_gatt_manager_client->UnregisterCharacteristicServiceProvider( this); } @@ -68,7 +68,7 @@ void FakeBluetoothGattCharacteristicServiceProvider::GetValue( // Check if this characteristic is registered. FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client = static_cast<FakeBluetoothGattManagerClient*>( - bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient()); + DBusThreadManager::Get()->GetBluetoothGattManagerClient()); if (!fake_bluetooth_gatt_manager_client->IsServiceRegistered(service_path_)) { VLOG(1) << "GATT characteristic not registered."; error_callback.Run(); @@ -90,7 +90,7 @@ void FakeBluetoothGattCharacteristicServiceProvider::SetValue( // Check if this characteristic is registered. FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client = static_cast<FakeBluetoothGattManagerClient*>( - bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient()); + DBusThreadManager::Get()->GetBluetoothGattManagerClient()); if (!fake_bluetooth_gatt_manager_client->IsServiceRegistered(service_path_)) { VLOG(1) << "GATT characteristic not registered."; error_callback.Run(); @@ -102,4 +102,4 @@ void FakeBluetoothGattCharacteristicServiceProvider::SetValue( delegate_->SetCharacteristicValue(value, callback, error_callback); } -} // namespace bluez +} // namespace chromeos diff --git a/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.h b/chromeos/dbus/fake_bluetooth_gatt_characteristic_service_provider.h index a67d6c95..8a8440b 100644 --- a/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.h +++ b/chromeos/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 bluez { +namespace chromeos { // 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 DEVICE_BLUETOOTH_EXPORT FakeBluetoothGattCharacteristicServiceProvider +class CHROMEOS_EXPORT FakeBluetoothGattCharacteristicServiceProvider : public BluetoothGattCharacteristicServiceProvider { public: FakeBluetoothGattCharacteristicServiceProvider( @@ -61,6 +61,6 @@ class DEVICE_BLUETOOTH_EXPORT FakeBluetoothGattCharacteristicServiceProvider DISALLOW_COPY_AND_ASSIGN(FakeBluetoothGattCharacteristicServiceProvider); }; -} // namespace bluez +} // namespace chromeos #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_H_ diff --git a/device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_client.cc b/chromeos/dbus/fake_bluetooth_gatt_descriptor_client.cc index dcaf1ec..2e9cdf0 100644 --- a/device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_client.cc +++ b/chromeos/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 "device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_client.h" +#include "chromeos/dbus/fake_bluetooth_gatt_descriptor_client.h" #include "base/bind.h" #include "base/logging.h" -#include "device/bluetooth/dbus/bluetooth_gatt_characteristic_client.h" -#include "device/bluetooth/dbus/bluez_dbus_manager.h" +#include "chromeos/dbus/bluetooth_gatt_characteristic_client.h" +#include "chromeos/dbus/dbus_thread_manager.h" #include "third_party/cros_system_api/dbus/service_constants.h" -namespace bluez { +namespace chromeos { const char FakeBluetoothGattDescriptorClient:: kClientCharacteristicConfigurationPathComponent[] = "desc0000"; @@ -101,7 +101,7 @@ void FakeBluetoothGattDescriptorClient::ReadValue( Properties* properties = iter->second->properties.get(); if (properties->uuid.value() == kClientCharacteristicConfigurationUUID) { BluetoothGattCharacteristicClient::Properties* chrc_props = - bluez::BluezDBusManager::Get() + DBusThreadManager::Get() ->GetBluetoothGattCharacteristicClient() ->GetProperties(properties->characteristic.value()); DCHECK(chrc_props); @@ -206,4 +206,4 @@ void FakeBluetoothGattDescriptorClient::NotifyDescriptorRemoved( GattDescriptorRemoved(object_path)); } -} // namespace bluez +} // namespace chromeos diff --git a/device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_client.h b/chromeos/dbus/fake_bluetooth_gatt_descriptor_client.h index e933664..e6106c1 100644 --- a/device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_client.h +++ b/chromeos/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 bluez { +namespace chromeos { // 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 DEVICE_BLUETOOTH_EXPORT FakeBluetoothGattDescriptorClient +class CHROMEOS_EXPORT FakeBluetoothGattDescriptorClient : public BluetoothGattDescriptorClient { public: struct Properties : public BluetoothGattDescriptorClient::Properties { @@ -98,6 +98,6 @@ class DEVICE_BLUETOOTH_EXPORT FakeBluetoothGattDescriptorClient DISALLOW_COPY_AND_ASSIGN(FakeBluetoothGattDescriptorClient); }; -} // namespace bluez +} // namespace chromeos #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_CLIENT_H_ diff --git a/device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_service_provider.cc b/chromeos/dbus/fake_bluetooth_gatt_descriptor_service_provider.cc index 4376ce9..ad002ab 100644 --- a/device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_service_provider.cc +++ b/chromeos/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 "device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_service_provider.h" +#include "chromeos/dbus/fake_bluetooth_gatt_descriptor_service_provider.h" #include "base/logging.h" #include "base/strings/string_util.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" +#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" -namespace bluez { +namespace chromeos { FakeBluetoothGattDescriptorServiceProvider:: FakeBluetoothGattDescriptorServiceProvider( @@ -37,7 +37,7 @@ FakeBluetoothGattDescriptorServiceProvider:: FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client = static_cast<FakeBluetoothGattManagerClient*>( - bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient()); + DBusThreadManager::Get()->GetBluetoothGattManagerClient()); fake_bluetooth_gatt_manager_client->RegisterDescriptorServiceProvider(this); } @@ -47,7 +47,7 @@ FakeBluetoothGattDescriptorServiceProvider:: FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client = static_cast<FakeBluetoothGattManagerClient*>( - bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient()); + DBusThreadManager::Get()->GetBluetoothGattManagerClient()); fake_bluetooth_gatt_manager_client->UnregisterDescriptorServiceProvider(this); } @@ -66,7 +66,7 @@ void FakeBluetoothGattDescriptorServiceProvider::GetValue( // Check if this descriptor is registered. FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client = static_cast<FakeBluetoothGattManagerClient*>( - bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient()); + DBusThreadManager::Get()->GetBluetoothGattManagerClient()); FakeBluetoothGattCharacteristicServiceProvider* characteristic = fake_bluetooth_gatt_manager_client->GetCharacteristicServiceProvider( characteristic_path_); @@ -97,7 +97,7 @@ void FakeBluetoothGattDescriptorServiceProvider::SetValue( // Check if this descriptor is registered. FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client = static_cast<FakeBluetoothGattManagerClient*>( - bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient()); + DBusThreadManager::Get()->GetBluetoothGattManagerClient()); FakeBluetoothGattCharacteristicServiceProvider* characteristic = fake_bluetooth_gatt_manager_client->GetCharacteristicServiceProvider( characteristic_path_); @@ -118,4 +118,4 @@ void FakeBluetoothGattDescriptorServiceProvider::SetValue( delegate_->SetDescriptorValue(value, callback, error_callback); } -} // namespace bluez +} // namespace chromeos diff --git a/device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_service_provider.h b/chromeos/dbus/fake_bluetooth_gatt_descriptor_service_provider.h index 7e53625..054c21d 100644 --- a/device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_service_provider.h +++ b/chromeos/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 bluez { +namespace chromeos { // 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 DEVICE_BLUETOOTH_EXPORT FakeBluetoothGattDescriptorServiceProvider +class CHROMEOS_EXPORT FakeBluetoothGattDescriptorServiceProvider : public BluetoothGattDescriptorServiceProvider { public: FakeBluetoothGattDescriptorServiceProvider( @@ -62,6 +62,6 @@ class DEVICE_BLUETOOTH_EXPORT FakeBluetoothGattDescriptorServiceProvider DISALLOW_COPY_AND_ASSIGN(FakeBluetoothGattDescriptorServiceProvider); }; -} // namespace bluez +} // namespace chromeos #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_H_ diff --git a/device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.cc b/chromeos/dbus/fake_bluetooth_gatt_manager_client.cc index 284a17c..1127eae 100644 --- a/device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.cc +++ b/chromeos/dbus/fake_bluetooth_gatt_manager_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 "device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.h" +#include "chromeos/dbus/fake_bluetooth_gatt_manager_client.h" #include "base/logging.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 "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 "third_party/cros_system_api/dbus/service_constants.h" -namespace bluez { +namespace chromeos { FakeBluetoothGattManagerClient::FakeBluetoothGattManagerClient() {} @@ -166,4 +166,4 @@ bool FakeBluetoothGattManagerClient::IsServiceRegistered( return iter->second.first; } -} // namespace bluez +} // namespace chromeos diff --git a/device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.h b/chromeos/dbus/fake_bluetooth_gatt_manager_client.h index 32209df..cd5d3b0 100644 --- a/device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.h +++ b/chromeos/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 bluez { +namespace chromeos { 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 DEVICE_BLUETOOTH_EXPORT FakeBluetoothGattManagerClient +class CHROMEOS_EXPORT FakeBluetoothGattManagerClient : public BluetoothGattManagerClient { public: FakeBluetoothGattManagerClient(); @@ -95,6 +95,6 @@ class DEVICE_BLUETOOTH_EXPORT FakeBluetoothGattManagerClient DISALLOW_COPY_AND_ASSIGN(FakeBluetoothGattManagerClient); }; -} // namespace bluez +} // namespace chromeos #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_MANAGER_CLIENT_H_ diff --git a/device/bluetooth/dbus/fake_bluetooth_gatt_service_client.cc b/chromeos/dbus/fake_bluetooth_gatt_service_client.cc index 2e7aa0a..47b39b6 100644 --- a/device/bluetooth/dbus/fake_bluetooth_gatt_service_client.cc +++ b/chromeos/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 "device/bluetooth/dbus/fake_bluetooth_gatt_service_client.h" +#include "chromeos/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 "device/bluetooth/dbus/bluez_dbus_manager.h" -#include "device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.h" +#include "chromeos/dbus/dbus_thread_manager.h" +#include "chromeos/dbus/fake_bluetooth_gatt_characteristic_client.h" #include "third_party/cros_system_api/dbus/service_constants.h" -namespace bluez { +namespace chromeos { namespace { @@ -122,8 +122,7 @@ void FakeBluetoothGattServiceClient::HideHeartRateService() { VLOG(2) << "Hiding fake Heart Rate Service."; FakeBluetoothGattCharacteristicClient* char_client = static_cast<FakeBluetoothGattCharacteristicClient*>( - bluez::BluezDBusManager::Get() - ->GetBluetoothGattCharacteristicClient()); + DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient()); char_client->HideHeartRateCharacteristics(); // Notify observers before deleting the properties structure so that it @@ -173,8 +172,7 @@ void FakeBluetoothGattServiceClient::ExposeHeartRateCharacteristics() { } FakeBluetoothGattCharacteristicClient* char_client = static_cast<FakeBluetoothGattCharacteristicClient*>( - bluez::BluezDBusManager::Get() - ->GetBluetoothGattCharacteristicClient()); + DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient()); char_client->ExposeHeartRateCharacteristics( dbus::ObjectPath(heart_rate_service_path_)); @@ -186,4 +184,4 @@ void FakeBluetoothGattServiceClient::ExposeHeartRateCharacteristics() { heart_rate_service_properties_->characteristics.ReplaceValue(char_paths); } -} // namespace bluez +} // namespace chromeos diff --git a/device/bluetooth/dbus/fake_bluetooth_gatt_service_client.h b/chromeos/dbus/fake_bluetooth_gatt_service_client.h index d25e9d2..f719727 100644 --- a/device/bluetooth/dbus/fake_bluetooth_gatt_service_client.h +++ b/chromeos/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 bluez { +namespace chromeos { // 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 DEVICE_BLUETOOTH_EXPORT FakeBluetoothGattServiceClient +class CHROMEOS_EXPORT FakeBluetoothGattServiceClient : public BluetoothGattServiceClient { public: struct Properties : public BluetoothGattServiceClient::Properties { @@ -101,6 +101,6 @@ class DEVICE_BLUETOOTH_EXPORT FakeBluetoothGattServiceClient DISALLOW_COPY_AND_ASSIGN(FakeBluetoothGattServiceClient); }; -} // namespace bluez +} // namespace chromeos #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_SERVICE_CLIENT_H_ diff --git a/device/bluetooth/dbus/fake_bluetooth_gatt_service_service_provider.cc b/chromeos/dbus/fake_bluetooth_gatt_service_service_provider.cc index 8d724058..f59cf98 100644 --- a/device/bluetooth/dbus/fake_bluetooth_gatt_service_service_provider.cc +++ b/chromeos/dbus/fake_bluetooth_gatt_service_service_provider.cc @@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "device/bluetooth/dbus/fake_bluetooth_gatt_service_service_provider.h" +#include "chromeos/dbus/fake_bluetooth_gatt_service_service_provider.h" #include "base/logging.h" -#include "device/bluetooth/dbus/bluez_dbus_manager.h" -#include "device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.h" +#include "chromeos/dbus/dbus_thread_manager.h" +#include "chromeos/dbus/fake_bluetooth_gatt_manager_client.h" -namespace bluez { +namespace chromeos { FakeBluetoothGattServiceServiceProvider:: FakeBluetoothGattServiceServiceProvider( @@ -20,7 +20,7 @@ FakeBluetoothGattServiceServiceProvider:: FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client = static_cast<FakeBluetoothGattManagerClient*>( - bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient()); + DBusThreadManager::Get()->GetBluetoothGattManagerClient()); fake_bluetooth_gatt_manager_client->RegisterServiceServiceProvider(this); } @@ -30,8 +30,8 @@ FakeBluetoothGattServiceServiceProvider:: FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client = static_cast<FakeBluetoothGattManagerClient*>( - bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient()); + DBusThreadManager::Get()->GetBluetoothGattManagerClient()); fake_bluetooth_gatt_manager_client->UnregisterServiceServiceProvider(this); } -} // namespace bluez +} // namespace chromeos diff --git a/device/bluetooth/dbus/fake_bluetooth_gatt_service_service_provider.h b/chromeos/dbus/fake_bluetooth_gatt_service_service_provider.h index 69b71fd..6b49d78 100644 --- a/device/bluetooth/dbus/fake_bluetooth_gatt_service_service_provider.h +++ b/chromeos/dbus/fake_bluetooth_gatt_service_service_provider.h @@ -2,22 +2,22 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_SERVICE_SERVICE_PROVIDER_H_ -#define CHROMEOS_DBUS_FAKE_BLUETOOTH_SERVICE_SERVICE_PROVIDER_H_ +#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_H_ +#define CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_H_ #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 bluez { +namespace chromeos { // 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 DEVICE_BLUETOOTH_EXPORT FakeBluetoothGattServiceServiceProvider +class CHROMEOS_EXPORT FakeBluetoothGattServiceServiceProvider : public BluetoothGattServiceServiceProvider { public: FakeBluetoothGattServiceServiceProvider( @@ -42,6 +42,6 @@ class DEVICE_BLUETOOTH_EXPORT FakeBluetoothGattServiceServiceProvider DISALLOW_COPY_AND_ASSIGN(FakeBluetoothGattServiceServiceProvider); }; -} // namespace bluez +} // namespace chromeos -#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_SERVICE_SERVICE_PROVIDER_H_ +#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_H_ diff --git a/device/bluetooth/dbus/fake_bluetooth_input_client.cc b/chromeos/dbus/fake_bluetooth_input_client.cc index 849c3be..ab2c66b 100644 --- a/device/bluetooth/dbus/fake_bluetooth_input_client.cc +++ b/chromeos/dbus/fake_bluetooth_input_client.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 "device/bluetooth/dbus/fake_bluetooth_input_client.h" +#include "chromeos/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 bluez { +namespace chromeos { FakeBluetoothInputClient::Properties::Properties( const PropertyChangedCallback& callback) @@ -120,4 +120,4 @@ void FakeBluetoothInputClient::OnPropertyChanged( InputPropertyChanged(object_path, property_name)); } -} // namespace bluez +} // namespace chromeos diff --git a/device/bluetooth/dbus/fake_bluetooth_input_client.h b/chromeos/dbus/fake_bluetooth_input_client.h index e7a3b0a..22369eb 100644 --- a/device/bluetooth/dbus/fake_bluetooth_input_client.h +++ b/chromeos/dbus/fake_bluetooth_input_client.h @@ -7,18 +7,17 @@ #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 bluez { +namespace chromeos { // 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 DEVICE_BLUETOOTH_EXPORT FakeBluetoothInputClient - : public BluetoothInputClient { +class CHROMEOS_EXPORT FakeBluetoothInputClient : public BluetoothInputClient { public: struct Properties : public BluetoothInputClient::Properties { explicit Properties(const PropertyChangedCallback& callback); @@ -60,6 +59,6 @@ class DEVICE_BLUETOOTH_EXPORT FakeBluetoothInputClient DISALLOW_COPY_AND_ASSIGN(FakeBluetoothInputClient); }; -} // namespace bluez +} // namespace chromeos #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_INPUT_CLIENT_H_ diff --git a/device/bluetooth/dbus/fake_bluetooth_le_advertisement_service_provider.cc b/chromeos/dbus/fake_bluetooth_le_advertisement_service_provider.cc index 043df05..ce46e3d 100644 --- a/device/bluetooth/dbus/fake_bluetooth_le_advertisement_service_provider.cc +++ b/chromeos/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 "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" +#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" -namespace bluez { +namespace chromeos { FakeBluetoothLEAdvertisementServiceProvider:: FakeBluetoothLEAdvertisementServiceProvider( @@ -19,7 +19,7 @@ FakeBluetoothLEAdvertisementServiceProvider:: FakeBluetoothLEAdvertisingManagerClient* fake_bluetooth_profile_manager_client = static_cast<FakeBluetoothLEAdvertisingManagerClient*>( - bluez::BluezDBusManager::Get() + DBusThreadManager::Get() ->GetBluetoothLEAdvertisingManagerClient()); fake_bluetooth_profile_manager_client->RegisterAdvertisementServiceProvider( this); @@ -32,7 +32,7 @@ FakeBluetoothLEAdvertisementServiceProvider:: FakeBluetoothLEAdvertisingManagerClient* fake_bluetooth_profile_manager_client = static_cast<FakeBluetoothLEAdvertisingManagerClient*>( - bluez::BluezDBusManager::Get() + DBusThreadManager::Get() ->GetBluetoothLEAdvertisingManagerClient()); fake_bluetooth_profile_manager_client->UnregisterAdvertisementServiceProvider( this); @@ -43,4 +43,4 @@ void FakeBluetoothLEAdvertisementServiceProvider::Release() { delegate_->Released(); } -} // namespace bluez +} // namespace chromeos diff --git a/device/bluetooth/dbus/fake_bluetooth_le_advertisement_service_provider.h b/chromeos/dbus/fake_bluetooth_le_advertisement_service_provider.h index 66df2c2..5a19aee 100644 --- a/device/bluetooth/dbus/fake_bluetooth_le_advertisement_service_provider.h +++ b/chromeos/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 bluez { +namespace chromeos { // 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 DEVICE_BLUETOOTH_EXPORT FakeBluetoothLEAdvertisementServiceProvider +class CHROMEOS_EXPORT FakeBluetoothLEAdvertisementServiceProvider : public BluetoothLEAdvertisementServiceProvider { public: FakeBluetoothLEAdvertisementServiceProvider( @@ -44,6 +44,6 @@ class DEVICE_BLUETOOTH_EXPORT FakeBluetoothLEAdvertisementServiceProvider DISALLOW_COPY_AND_ASSIGN(FakeBluetoothLEAdvertisementServiceProvider); }; -} // namespace bluez +} // namespace chromeos #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_LE_ADVERTISEMENT_SERVICE_PROVIDER_H_ diff --git a/device/bluetooth/dbus/fake_bluetooth_le_advertising_manager_client.cc b/chromeos/dbus/fake_bluetooth_le_advertising_manager_client.cc index 5b586d7..201fc42 100644 --- a/device/bluetooth/dbus/fake_bluetooth_le_advertising_manager_client.cc +++ b/chromeos/dbus/fake_bluetooth_le_advertising_manager_client.cc @@ -13,7 +13,7 @@ #include "fake_bluetooth_le_advertising_manager_client.h" #include "third_party/cros_system_api/dbus/service_constants.h" -namespace bluez { +namespace chromeos { const char FakeBluetoothLEAdvertisingManagerClient::kAdvertisingManagerPath[] = "/fake/hci0"; @@ -98,4 +98,4 @@ void FakeBluetoothLEAdvertisingManagerClient:: service_provider_map_.erase(iter); } -} // namespace bluez +} // namespace chromeos diff --git a/device/bluetooth/dbus/fake_bluetooth_le_advertising_manager_client.h b/chromeos/dbus/fake_bluetooth_le_advertising_manager_client.h index e3090e6..5df129c 100644 --- a/device/bluetooth/dbus/fake_bluetooth_le_advertising_manager_client.h +++ b/chromeos/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 bluez { +namespace chromeos { 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 DEVICE_BLUETOOTH_EXPORT FakeBluetoothLEAdvertisingManagerClient +class CHROMEOS_EXPORT FakeBluetoothLEAdvertisingManagerClient : public BluetoothLEAdvertisingManagerClient { public: FakeBluetoothLEAdvertisingManagerClient(); @@ -74,6 +74,6 @@ class DEVICE_BLUETOOTH_EXPORT FakeBluetoothLEAdvertisingManagerClient DISALLOW_COPY_AND_ASSIGN(FakeBluetoothLEAdvertisingManagerClient); }; -} // namespace bluez +} // namespace chromeos #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_ diff --git a/device/bluetooth/dbus/fake_bluetooth_media_client.cc b/chromeos/dbus/fake_bluetooth_media_client.cc index 246a140..f9cfb5a 100644 --- a/device/bluetooth/dbus/fake_bluetooth_media_client.cc +++ b/chromeos/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 "device/bluetooth/dbus/fake_bluetooth_media_client.h" +#include "chromeos/dbus/fake_bluetooth_media_client.h" #include <string> #include "base/stl_util.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" +#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" using dbus::ObjectPath; @@ -23,7 +23,7 @@ const char kInvalidArgumentsError[] = "org.chromium.Error.InvalidArguments"; } // namespace -namespace bluez { +namespace chromeos { // static const uint8_t FakeBluetoothMediaClient::kDefaultCodec = 0x00; @@ -119,7 +119,7 @@ void FakeBluetoothMediaClient::SetEndpointRegistered( // transport. FakeBluetoothMediaTransportClient* transport = static_cast<FakeBluetoothMediaTransportClient*>( - bluez::BluezDBusManager::Get()->GetBluetoothMediaTransportClient()); + DBusThreadManager::Get()->GetBluetoothMediaTransportClient()); transport->SetValid(endpoint, false); endpoints_.erase(endpoint->object_path()); @@ -131,4 +131,4 @@ bool FakeBluetoothMediaClient::IsRegistered( return ContainsKey(endpoints_, endpoint_path); } -} // namespace bluez +} // namespace chromeos diff --git a/device/bluetooth/dbus/fake_bluetooth_media_client.h b/chromeos/dbus/fake_bluetooth_media_client.h index 3d6d84e..3b4f4a7 100644 --- a/device/bluetooth/dbus/fake_bluetooth_media_client.h +++ b/chromeos/dbus/fake_bluetooth_media_client.h @@ -9,16 +9,15 @@ #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 bluez { +namespace chromeos { class FakeBluetoothMediaEndpointServiceProvider; -class DEVICE_BLUETOOTH_EXPORT FakeBluetoothMediaClient - : public BluetoothMediaClient { +class CHROMEOS_EXPORT FakeBluetoothMediaClient : public BluetoothMediaClient { public: // The default codec is SBC(0x00). static const uint8_t kDefaultCodec; @@ -72,6 +71,6 @@ class DEVICE_BLUETOOTH_EXPORT FakeBluetoothMediaClient DISALLOW_COPY_AND_ASSIGN(FakeBluetoothMediaClient); }; -} // namespace bluez +} // namespace chromeos #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_CLIENT_H_ diff --git a/device/bluetooth/dbus/fake_bluetooth_media_endpoint_service_provider.cc b/chromeos/dbus/fake_bluetooth_media_endpoint_service_provider.cc index 83a0822..a275374 100644 --- a/device/bluetooth/dbus/fake_bluetooth_media_endpoint_service_provider.cc +++ b/chromeos/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 "device/bluetooth/dbus/fake_bluetooth_media_endpoint_service_provider.h" +#include "chromeos/dbus/fake_bluetooth_media_endpoint_service_provider.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" +#include "chromeos/dbus/dbus_thread_manager.h" +#include "chromeos/dbus/fake_bluetooth_media_client.h" +#include "chromeos/dbus/fake_bluetooth_media_transport_client.h" using dbus::ObjectPath; -namespace bluez { +namespace chromeos { 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*>( - bluez::BluezDBusManager::Get()->GetBluetoothMediaTransportClient()); + DBusThreadManager::Get()->GetBluetoothMediaTransportClient()); DCHECK(transport); transport->SetValid(this, true); } @@ -62,4 +62,4 @@ void FakeBluetoothMediaEndpointServiceProvider::Released() { delegate_->Released(); } -} // namespace bluez +} // namespace chromeos diff --git a/device/bluetooth/dbus/fake_bluetooth_media_endpoint_service_provider.h b/chromeos/dbus/fake_bluetooth_media_endpoint_service_provider.h index 1f4383f..5efe14f 100644 --- a/device/bluetooth/dbus/fake_bluetooth_media_endpoint_service_provider.h +++ b/chromeos/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 bluez { +namespace chromeos { // FakeBluetoothMediaEndpointServiceProvider simulates the behavior of a local // Bluetooth Media Endpoint object. -class DEVICE_BLUETOOTH_EXPORT FakeBluetoothMediaEndpointServiceProvider +class CHROMEOS_EXPORT FakeBluetoothMediaEndpointServiceProvider : public BluetoothMediaEndpointServiceProvider { public: FakeBluetoothMediaEndpointServiceProvider(const dbus::ObjectPath& object_path, @@ -52,6 +52,6 @@ class DEVICE_BLUETOOTH_EXPORT FakeBluetoothMediaEndpointServiceProvider DISALLOW_COPY_AND_ASSIGN(FakeBluetoothMediaEndpointServiceProvider); }; -} // namespace bluez +} // namespace chromeos #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_ENDPOINT_SERVICE_PROVIDER_H_ diff --git a/device/bluetooth/dbus/fake_bluetooth_media_transport_client.cc b/chromeos/dbus/fake_bluetooth_media_transport_client.cc index 1a0a106..ae8f89b 100644 --- a/device/bluetooth/dbus/fake_bluetooth_media_transport_client.cc +++ b/chromeos/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 "device/bluetooth/dbus/fake_bluetooth_media_transport_client.h" +#include "chromeos/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,8 +35,8 @@ ObjectPath GenerateTransportPath() { static unsigned int sequence_number = 0; ++sequence_number; std::stringstream path; - path << bluez::FakeBluetoothAdapterClient::kAdapterPath - << bluez::FakeBluetoothMediaTransportClient::kTransportDevicePath + path << chromeos::FakeBluetoothAdapterClient::kAdapterPath + << chromeos::FakeBluetoothMediaTransportClient::kTransportDevicePath << "/fd" << sequence_number; return ObjectPath(path.str()); } @@ -46,7 +46,7 @@ ObjectPath GenerateTransportPath() { } // namespace -namespace bluez { +namespace chromeos { // static const char FakeBluetoothMediaTransportClient::kTransportDevicePath[] = @@ -153,7 +153,7 @@ void FakeBluetoothMediaTransportClient::SetValid( FakeBluetoothMediaEndpointServiceProvider* endpoint, bool valid) { FakeBluetoothMediaClient* media = static_cast<FakeBluetoothMediaClient*>( - bluez::BluezDBusManager::Get()->GetBluetoothMediaClient()); + DBusThreadManager::Get()->GetBluetoothMediaClient()); DCHECK(media); ObjectPath endpoint_path(endpoint->object_path()); @@ -325,4 +325,4 @@ void FakeBluetoothMediaTransportClient::AcquireInternal( SetState(endpoint_path, "active"); } -} // namespace bluez +} // namespace chromeos diff --git a/device/bluetooth/dbus/fake_bluetooth_media_transport_client.h b/chromeos/dbus/fake_bluetooth_media_transport_client.h index 31b2012..bbf30a5 100644 --- a/device/bluetooth/dbus/fake_bluetooth_media_transport_client.h +++ b/chromeos/dbus/fake_bluetooth_media_transport_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 DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_ -#define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_ +#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_ +#define CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_ #include <map> #include <string> @@ -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 bluez { +namespace chromeos { class FakeBluetoothMediaEndpointServiceProvider; -class DEVICE_BLUETOOTH_EXPORT FakeBluetoothMediaTransportClient +class CHROMEOS_EXPORT FakeBluetoothMediaTransportClient : public BluetoothMediaTransportClient { public: struct Properties : public BluetoothMediaTransportClient::Properties { @@ -143,6 +143,6 @@ class DEVICE_BLUETOOTH_EXPORT FakeBluetoothMediaTransportClient DISALLOW_COPY_AND_ASSIGN(FakeBluetoothMediaTransportClient); }; -} // namespace bluez +} // namespace chromeos -#endif // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_ +#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_ diff --git a/device/bluetooth/dbus/fake_bluetooth_profile_manager_client.cc b/chromeos/dbus/fake_bluetooth_profile_manager_client.cc index 96254a5..1a06d41 100644 --- a/device/bluetooth/dbus/fake_bluetooth_profile_manager_client.cc +++ b/chromeos/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 "device/bluetooth/dbus/fake_bluetooth_profile_manager_client.h" +#include "chromeos/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 bluez { +namespace chromeos { const char FakeBluetoothProfileManagerClient::kL2capUuid[] = "4d995052-33cc-4fdf-b446-75f32942a076"; @@ -108,4 +108,4 @@ FakeBluetoothProfileManagerClient::GetProfileServiceProvider( return service_provider_map_[iter->second]; } -} // namespace bluez +} // namespace chromeos diff --git a/device/bluetooth/dbus/fake_bluetooth_profile_manager_client.h b/chromeos/dbus/fake_bluetooth_profile_manager_client.h index 62af0f1..c142606 100644 --- a/device/bluetooth/dbus/fake_bluetooth_profile_manager_client.h +++ b/chromeos/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 bluez { +namespace chromeos { 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 DEVICE_BLUETOOTH_EXPORT FakeBluetoothProfileManagerClient +class CHROMEOS_EXPORT FakeBluetoothProfileManagerClient : public BluetoothProfileManagerClient { public: FakeBluetoothProfileManagerClient(); @@ -69,6 +69,6 @@ class DEVICE_BLUETOOTH_EXPORT FakeBluetoothProfileManagerClient ProfileMap profile_map_; }; -} // namespace bluez +} // namespace chromeos #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_ diff --git a/device/bluetooth/dbus/fake_bluetooth_profile_service_provider.cc b/chromeos/dbus/fake_bluetooth_profile_service_provider.cc index 1089501..6f9c345 100644 --- a/device/bluetooth/dbus/fake_bluetooth_profile_service_provider.cc +++ b/chromeos/dbus/fake_bluetooth_profile_service_provider.cc @@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "device/bluetooth/dbus/fake_bluetooth_profile_service_provider.h" +#include "chromeos/dbus/fake_bluetooth_profile_service_provider.h" -#include "device/bluetooth/dbus/bluez_dbus_manager.h" -#include "device/bluetooth/dbus/fake_bluetooth_profile_manager_client.h" +#include "chromeos/dbus/dbus_thread_manager.h" +#include "chromeos/dbus/fake_bluetooth_profile_manager_client.h" -namespace bluez { +namespace chromeos { FakeBluetoothProfileServiceProvider::FakeBluetoothProfileServiceProvider( const dbus::ObjectPath& object_path, @@ -17,7 +17,7 @@ FakeBluetoothProfileServiceProvider::FakeBluetoothProfileServiceProvider( FakeBluetoothProfileManagerClient* fake_bluetooth_profile_manager_client = static_cast<FakeBluetoothProfileManagerClient*>( - bluez::BluezDBusManager::Get()->GetBluetoothProfileManagerClient()); + DBusThreadManager::Get()->GetBluetoothProfileManagerClient()); fake_bluetooth_profile_manager_client->RegisterProfileServiceProvider(this); } @@ -26,7 +26,7 @@ FakeBluetoothProfileServiceProvider::~FakeBluetoothProfileServiceProvider() { FakeBluetoothProfileManagerClient* fake_bluetooth_profile_manager_client = static_cast<FakeBluetoothProfileManagerClient*>( - bluez::BluezDBusManager::Get()->GetBluetoothProfileManagerClient()); + DBusThreadManager::Get()->GetBluetoothProfileManagerClient()); fake_bluetooth_profile_manager_client->UnregisterProfileServiceProvider(this); } @@ -58,4 +58,4 @@ void FakeBluetoothProfileServiceProvider::Cancel() { delegate_->Cancel(); } -} // namespace bluez +} // namespace chromeos diff --git a/device/bluetooth/dbus/fake_bluetooth_profile_service_provider.h b/chromeos/dbus/fake_bluetooth_profile_service_provider.h index 1259927..2c98048 100644 --- a/device/bluetooth/dbus/fake_bluetooth_profile_service_provider.h +++ b/chromeos/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 bluez { +namespace chromeos { // 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 DEVICE_BLUETOOTH_EXPORT FakeBluetoothProfileServiceProvider +class CHROMEOS_EXPORT FakeBluetoothProfileServiceProvider : public BluetoothProfileServiceProvider { public: FakeBluetoothProfileServiceProvider(const dbus::ObjectPath& object_path, @@ -55,6 +55,6 @@ class DEVICE_BLUETOOTH_EXPORT FakeBluetoothProfileServiceProvider DISALLOW_COPY_AND_ASSIGN(FakeBluetoothProfileServiceProvider); }; -} // namespace bluez +} // namespace chromeos #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_ diff --git a/device/bluetooth/BUILD.gn b/device/bluetooth/BUILD.gn index 69da108..cb8f293 100644 --- a/device/bluetooth/BUILD.gn +++ b/device/bluetooth/BUILD.gn @@ -157,95 +157,6 @@ 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 5e4e821..881a160 100644 --- a/device/bluetooth/bluetooth.gyp +++ b/device/bluetooth/bluetooth.gyp @@ -129,96 +129,6 @@ '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 15f30bf..3e9aaf3 100644 --- a/device/bluetooth/bluetooth_adapter_chromeos.cc +++ b/device/bluetooth/bluetooth_adapter_chromeos.cc @@ -13,6 +13,12 @@ #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" @@ -27,12 +33,6 @@ #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 == bluez::BluetoothAdapterClient::kUnknownAdapterError) { + if (error_name == chromeos::BluetoothAdapterClient::kUnknownAdapterError) { return UMABluetoothDiscoverySessionOutcome::CHROMEOS_DBUS_UNKNOWN_ADAPTER; - } else if (error_name == bluez::BluetoothAdapterClient::kNoResponseError) { + } else if (error_name == chromeos::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(bluez::BluezDBusManager::IsInitialized()) + DCHECK(DBusThreadManager::IsInitialized()) << "Call BluetoothAdapterFactory::Shutdown() before " - "BluezDBusManager::Shutdown()."; + "DBusThreadManager::Shutdown()."; if (IsPresent()) RemoveAdapter(); // Also deletes devices_. @@ -115,19 +115,14 @@ void BluetoothAdapterChromeOS::Shutdown() { delete it.second; profile_queues_.clear(); - bluez::BluezDBusManager::Get()->GetBluetoothAdapterClient()->RemoveObserver( - this); - bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->RemoveObserver( - this); - bluez::BluezDBusManager::Get()->GetBluetoothInputClient()->RemoveObserver( - this); + DBusThreadManager::Get()->GetBluetoothAdapterClient()->RemoveObserver(this); + DBusThreadManager::Get()->GetBluetoothDeviceClient()->RemoveObserver(this); + DBusThreadManager::Get()->GetBluetoothInputClient()->RemoveObserver(this); VLOG(1) << "Unregistering pairing agent"; - bluez::BluezDBusManager::Get() - ->GetBluetoothAgentManagerClient() - ->UnregisterAgent(dbus::ObjectPath(kAgentPath), - base::Bind(&base::DoNothing), - base::Bind(&OnUnregisterAgentError)); + DBusThreadManager::Get()->GetBluetoothAgentManagerClient()->UnregisterAgent( + dbus::ObjectPath(kAgentPath), base::Bind(&base::DoNothing), + base::Bind(&OnUnregisterAgentError)); agent_.reset(); dbus_is_shutdown_ = true; @@ -141,20 +136,18 @@ BluetoothAdapterChromeOS::BluetoothAdapterChromeOS() ui_task_runner_ = base::ThreadTaskRunnerHandle::Get(); socket_thread_ = device::BluetoothSocketThread::Get(); - bluez::BluezDBusManager::Get()->GetBluetoothAdapterClient()->AddObserver( - this); - bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->AddObserver(this); - bluez::BluezDBusManager::Get()->GetBluetoothInputClient()->AddObserver(this); + DBusThreadManager::Get()->GetBluetoothAdapterClient()->AddObserver(this); + DBusThreadManager::Get()->GetBluetoothDeviceClient()->AddObserver(this); + DBusThreadManager::Get()->GetBluetoothInputClient()->AddObserver(this); // Register the pairing agent. - dbus::Bus* system_bus = bluez::BluezDBusManager::Get()->GetSystemBus(); - agent_.reset(bluez::BluetoothAgentServiceProvider::Create( + dbus::Bus* system_bus = DBusThreadManager::Get()->GetSystemBus(); + agent_.reset(BluetoothAgentServiceProvider::Create( system_bus, dbus::ObjectPath(kAgentPath), this)); DCHECK(agent_.get()); - std::vector<dbus::ObjectPath> object_paths = bluez::BluezDBusManager::Get() - ->GetBluetoothAdapterClient() - ->GetAdapters(); + std::vector<dbus::ObjectPath> object_paths = + DBusThreadManager::Get()->GetBluetoothAdapterClient()->GetAdapters(); if (!object_paths.empty()) { VLOG(1) << object_paths.size() << " Bluetooth adapter(s) available."; @@ -170,10 +163,9 @@ std::string BluetoothAdapterChromeOS::GetAddress() const { if (!IsPresent()) return std::string(); - bluez::BluetoothAdapterClient::Properties* properties = - bluez::BluezDBusManager::Get() - ->GetBluetoothAdapterClient() - ->GetProperties(object_path_); + BluetoothAdapterClient::Properties* properties = + DBusThreadManager::Get()->GetBluetoothAdapterClient()->GetProperties( + object_path_); DCHECK(properties); return BluetoothDevice::CanonicalizeAddress(properties->address.value()); @@ -183,10 +175,9 @@ std::string BluetoothAdapterChromeOS::GetName() const { if (!IsPresent()) return std::string(); - bluez::BluetoothAdapterClient::Properties* properties = - bluez::BluezDBusManager::Get() - ->GetBluetoothAdapterClient() - ->GetProperties(object_path_); + BluetoothAdapterClient::Properties* properties = + DBusThreadManager::Get()->GetBluetoothAdapterClient()->GetProperties( + object_path_); DCHECK(properties); return properties->alias.value(); @@ -200,7 +191,7 @@ void BluetoothAdapterChromeOS::SetName(const std::string& name, return; } - bluez::BluezDBusManager::Get() + DBusThreadManager::Get() ->GetBluetoothAdapterClient() ->GetProperties(object_path_) ->alias.Set( @@ -221,10 +212,9 @@ bool BluetoothAdapterChromeOS::IsPowered() const { if (!IsPresent()) return false; - bluez::BluetoothAdapterClient::Properties* properties = - bluez::BluezDBusManager::Get() - ->GetBluetoothAdapterClient() - ->GetProperties(object_path_); + BluetoothAdapterClient::Properties* properties = + DBusThreadManager::Get()->GetBluetoothAdapterClient()->GetProperties( + object_path_); return properties->powered.value(); } @@ -238,7 +228,7 @@ void BluetoothAdapterChromeOS::SetPowered( return; } - bluez::BluezDBusManager::Get() + DBusThreadManager::Get() ->GetBluetoothAdapterClient() ->GetProperties(object_path_) ->powered.Set( @@ -251,10 +241,9 @@ bool BluetoothAdapterChromeOS::IsDiscoverable() const { if (!IsPresent()) return false; - bluez::BluetoothAdapterClient::Properties* properties = - bluez::BluezDBusManager::Get() - ->GetBluetoothAdapterClient() - ->GetProperties(object_path_); + BluetoothAdapterClient::Properties* properties = + DBusThreadManager::Get()->GetBluetoothAdapterClient()->GetProperties( + object_path_); return properties->discoverable.value(); } @@ -268,7 +257,7 @@ void BluetoothAdapterChromeOS::SetDiscoverable( return; } - bluez::BluezDBusManager::Get() + DBusThreadManager::Get() ->GetBluetoothAdapterClient() ->GetProperties(object_path_) ->discoverable.Set( @@ -281,10 +270,9 @@ bool BluetoothAdapterChromeOS::IsDiscovering() const { if (!IsPresent()) return false; - bluez::BluetoothAdapterClient::Properties* properties = - bluez::BluezDBusManager::Get() - ->GetBluetoothAdapterClient() - ->GetProperties(object_path_); + BluetoothAdapterClient::Properties* properties = + DBusThreadManager::Get()->GetBluetoothAdapterClient()->GetProperties( + object_path_); return properties->discovering.value(); } @@ -389,10 +377,9 @@ void BluetoothAdapterChromeOS::AdapterPropertyChanged( return; DCHECK(IsPresent()); - bluez::BluetoothAdapterClient::Properties* properties = - bluez::BluezDBusManager::Get() - ->GetBluetoothAdapterClient() - ->GetProperties(object_path_); + BluetoothAdapterClient::Properties* properties = + DBusThreadManager::Get()->GetBluetoothAdapterClient()->GetProperties( + object_path_); if (property_name == properties->powered.name()) { PoweredChanged(properties->powered.value()); @@ -405,9 +392,9 @@ void BluetoothAdapterChromeOS::AdapterPropertyChanged( void BluetoothAdapterChromeOS::DeviceAdded( const dbus::ObjectPath& object_path) { - DCHECK(bluez::BluezDBusManager::Get()); - bluez::BluetoothDeviceClient::Properties* properties = - bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties( + DCHECK(DBusThreadManager::Get()); + BluetoothDeviceClient::Properties* properties = + DBusThreadManager::Get()->GetBluetoothDeviceClient()->GetProperties( object_path); if (!properties || properties->adapter.value() != object_path_) return; @@ -450,8 +437,8 @@ void BluetoothAdapterChromeOS::DevicePropertyChanged( if (!device_chromeos) return; - bluez::BluetoothDeviceClient::Properties* properties = - bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties( + BluetoothDeviceClient::Properties* properties = + DBusThreadManager::Get()->GetBluetoothDeviceClient()->GetProperties( object_path); if (property_name == properties->address.name()) { @@ -517,8 +504,8 @@ void BluetoothAdapterChromeOS::InputPropertyChanged( if (!device_chromeos) return; - bluez::BluetoothInputClient::Properties* properties = - bluez::BluezDBusManager::Get()->GetBluetoothInputClient()->GetProperties( + BluetoothInputClient::Properties* properties = + DBusThreadManager::Get()->GetBluetoothInputClient()->GetProperties( object_path); // Properties structure can be removed, which triggers a change in the @@ -676,7 +663,7 @@ void BluetoothAdapterChromeOS::Cancel() { void BluetoothAdapterChromeOS::OnRegisterAgent() { VLOG(1) << "Pairing agent registered, requesting to be made default"; - bluez::BluezDBusManager::Get() + DBusThreadManager::Get() ->GetBluetoothAgentManagerClient() ->RequestDefaultAgent( dbus::ObjectPath(kAgentPath), @@ -769,22 +756,19 @@ void BluetoothAdapterChromeOS::SetAdapter(const dbus::ObjectPath& object_path) { VLOG(1) << object_path_.value() << ": using adapter."; VLOG(1) << "Registering pairing agent"; - bluez::BluezDBusManager::Get() - ->GetBluetoothAgentManagerClient() - ->RegisterAgent( - dbus::ObjectPath(kAgentPath), - bluetooth_agent_manager::kKeyboardDisplayCapability, - base::Bind(&BluetoothAdapterChromeOS::OnRegisterAgent, - weak_ptr_factory_.GetWeakPtr()), - base::Bind(&BluetoothAdapterChromeOS::OnRegisterAgentError, - weak_ptr_factory_.GetWeakPtr())); + DBusThreadManager::Get()->GetBluetoothAgentManagerClient()->RegisterAgent( + dbus::ObjectPath(kAgentPath), + bluetooth_agent_manager::kKeyboardDisplayCapability, + base::Bind(&BluetoothAdapterChromeOS::OnRegisterAgent, + weak_ptr_factory_.GetWeakPtr()), + base::Bind(&BluetoothAdapterChromeOS::OnRegisterAgentError, + weak_ptr_factory_.GetWeakPtr())); SetDefaultAdapterName(); - bluez::BluetoothAdapterClient::Properties* properties = - bluez::BluezDBusManager::Get() - ->GetBluetoothAdapterClient() - ->GetProperties(object_path_); + BluetoothAdapterClient::Properties* properties = + DBusThreadManager::Get()->GetBluetoothAdapterClient()->GetProperties( + object_path_); PresentChanged(true); @@ -796,7 +780,7 @@ void BluetoothAdapterChromeOS::SetAdapter(const dbus::ObjectPath& object_path) { DiscoveringChanged(true); std::vector<dbus::ObjectPath> device_paths = - bluez::BluezDBusManager::Get() + DBusThreadManager::Get() ->GetBluetoothDeviceClient() ->GetDevicesForAdapter(object_path_); @@ -835,10 +819,9 @@ void BluetoothAdapterChromeOS::RemoveAdapter() { DCHECK(IsPresent()); VLOG(1) << object_path_.value() << ": adapter removed."; - bluez::BluetoothAdapterClient::Properties* properties = - bluez::BluezDBusManager::Get() - ->GetBluetoothAdapterClient() - ->GetProperties(object_path_); + BluetoothAdapterClient::Properties* properties = + DBusThreadManager::Get()->GetBluetoothAdapterClient()->GetProperties( + object_path_); object_path_ = dbus::ObjectPath(""); @@ -1026,8 +1009,8 @@ void BluetoothAdapterChromeOS::NotifyGattDescriptorValueChanged( void BluetoothAdapterChromeOS::UseProfile( const BluetoothUUID& uuid, const dbus::ObjectPath& device_path, - const bluez::BluetoothProfileManagerClient::Options& options, - bluez::BluetoothProfileServiceProvider::Delegate* delegate, + const BluetoothProfileManagerClient::Options& options, + BluetoothProfileServiceProvider::Delegate* delegate, const ProfileRegisteredCallback& success_callback, const ErrorCompletionCallback& error_callback) { DCHECK(delegate); @@ -1098,7 +1081,7 @@ void BluetoothAdapterChromeOS::OnRegisterProfile( void BluetoothAdapterChromeOS::SetProfileDelegate( const BluetoothUUID& uuid, const dbus::ObjectPath& device_path, - bluez::BluetoothProfileServiceProvider::Delegate* delegate, + BluetoothProfileServiceProvider::Delegate* delegate, const ProfileRegisteredCallback& success_callback, const ErrorCompletionCallback& error_callback) { if (profiles_.find(uuid) == profiles_.end()) { @@ -1141,7 +1124,7 @@ void BluetoothAdapterChromeOS::OnSetDiscoverable( // Set the discoverable_timeout property to zero so the adapter remains // discoverable forever. - bluez::BluezDBusManager::Get() + DBusThreadManager::Get() ->GetBluetoothAdapterClient() ->GetProperties(object_path_) ->discoverable_timeout.Set( @@ -1215,7 +1198,7 @@ void BluetoothAdapterChromeOS::AddDiscoverySession( // This is the first request to start device discovery. discovery_request_pending_ = true; - bluez::BluezDBusManager::Get()->GetBluetoothAdapterClient()->StartDiscovery( + DBusThreadManager::Get()->GetBluetoothAdapterClient()->StartDiscovery( object_path_, base::Bind(&BluetoothAdapterChromeOS::OnStartDiscovery, weak_ptr_factory_.GetWeakPtr(), callback, error_callback), @@ -1269,7 +1252,7 @@ void BluetoothAdapterChromeOS::RemoveDiscoverySession( // discovery. DCHECK_EQ(num_discovery_sessions_, 1); discovery_request_pending_ = true; - bluez::BluezDBusManager::Get()->GetBluetoothAdapterClient()->StopDiscovery( + DBusThreadManager::Get()->GetBluetoothAdapterClient()->StopDiscovery( object_path_, base::Bind(&BluetoothAdapterChromeOS::OnStopDiscovery, weak_ptr_factory_.GetWeakPtr(), callback), base::Bind(&BluetoothAdapterChromeOS::OnStopDiscoveryError, @@ -1302,7 +1285,7 @@ void BluetoothAdapterChromeOS::SetDiscoveryFilter( current_filter_.reset(discovery_filter.release()); - bluez::BluetoothAdapterClient::DiscoveryFilter dbus_discovery_filter; + chromeos::BluetoothAdapterClient::DiscoveryFilter dbus_discovery_filter; if (current_filter_.get()) { uint16_t pathloss; @@ -1337,14 +1320,12 @@ void BluetoothAdapterChromeOS::SetDiscoveryFilter( } } - 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)); + 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)); } void BluetoothAdapterChromeOS::OnStartDiscovery( @@ -1434,7 +1415,7 @@ void BluetoothAdapterChromeOS::OnPreSetDiscoveryFilter( DCHECK(discovery_request_pending_); DCHECK_EQ(num_discovery_sessions_, 0); - bluez::BluezDBusManager::Get()->GetBluetoothAdapterClient()->StartDiscovery( + DBusThreadManager::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 b51e603..7570780 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 bluez::BluetoothAdapterClient::Observer, - public bluez::BluetoothDeviceClient::Observer, - public bluez::BluetoothInputClient::Observer, - public bluez::BluetoothAgentServiceProvider::Delegate { + public chromeos::BluetoothAdapterClient::Observer, + public chromeos::BluetoothDeviceClient::Observer, + public chromeos::BluetoothInputClient::Observer, + public chromeos::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 bluez::BluetoothProfileManagerClient::Options& options, - bluez::BluetoothProfileServiceProvider::Delegate* delegate, + const BluetoothProfileManagerClient::Options& options, + BluetoothProfileServiceProvider::Delegate* delegate, const ProfileRegisteredCallback& success_callback, const ErrorCompletionCallback& error_callback); @@ -193,23 +193,23 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS BluetoothAdapterChromeOS(); ~BluetoothAdapterChromeOS() override; - // bluez::BluetoothAdapterClient::Observer override. + // 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; - // bluez::BluetoothDeviceClient::Observer override. + // 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; - // bluez::BluetoothInputClient::Observer override. + // BluetoothInputClient::Observer override. void InputPropertyChanged(const dbus::ObjectPath& object_path, const std::string& property_name) override; - // bluez::BluetoothAgentServiceProvider::Delegate override. + // BluetoothAgentServiceProvider::Delegate override. void Released() override; void RequestPinCode(const dbus::ObjectPath& device_path, const PinCodeCallback& callback) override; @@ -332,12 +332,11 @@ 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, - bluez::BluetoothProfileServiceProvider::Delegate* delegate, - const ProfileRegisteredCallback& success_callback, - const ErrorCompletionCallback& error_callback); + void SetProfileDelegate(const device::BluetoothUUID& uuid, + const dbus::ObjectPath& device_path, + 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); @@ -377,7 +376,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<bluez::BluetoothAgentServiceProvider> agent_; + scoped_ptr<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 27779f2..aeab2ae 100644 --- a/device/bluetooth/bluetooth_adapter_profile_chromeos.cc +++ b/device/bluetooth/bluetooth_adapter_profile_chromeos.cc @@ -9,31 +9,29 @@ #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 bluez::BluetoothProfileManagerClient::Options& options, + const BluetoothProfileManagerClient::Options& options, const ProfileRegisteredCallback& success_callback, - const bluez::BluetoothProfileManagerClient::ErrorCallback& error_callback) { + const 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(); - bluez::BluezDBusManager::Get() - ->GetBluetoothProfileManagerClient() - ->RegisterProfile(object_path, uuid.canonical_value(), options, - base::Bind(success_callback, base::Passed(&profile)), - error_callback); + DBusThreadManager::Get()->GetBluetoothProfileManagerClient()->RegisterProfile( + object_path, uuid.canonical_value(), options, + base::Bind(success_callback, base::Passed(&profile)), error_callback); } BluetoothAdapterProfileChromeOS::BluetoothAdapterProfileChromeOS( @@ -44,9 +42,9 @@ BluetoothAdapterProfileChromeOS::BluetoothAdapterProfileChromeOS( object_path_ = dbus::ObjectPath("/org/chromium/bluetooth_profile/" + uuid_path); - dbus::Bus* system_bus = bluez::BluezDBusManager::Get()->GetSystemBus(); - profile_.reset(bluez::BluetoothProfileServiceProvider::Create( - system_bus, object_path_, this)); + dbus::Bus* system_bus = DBusThreadManager::Get()->GetSystemBus(); + profile_.reset( + BluetoothProfileServiceProvider::Create(system_bus, object_path_, this)); DCHECK(profile_.get()); } @@ -55,7 +53,7 @@ BluetoothAdapterProfileChromeOS::~BluetoothAdapterProfileChromeOS() { bool BluetoothAdapterProfileChromeOS::SetDelegate( const dbus::ObjectPath& device_path, - bluez::BluetoothProfileServiceProvider::Delegate* delegate) { + BluetoothProfileServiceProvider::Delegate* delegate) { DCHECK(delegate); VLOG(1) << "SetDelegate: " << object_path_.value() << " dev " << device_path.value(); @@ -85,7 +83,7 @@ void BluetoothAdapterProfileChromeOS::RemoveDelegate( VLOG(1) << device_path.value() << " No delegates left, unregistering."; // No users left, release the profile. - bluez::BluezDBusManager::Get() + DBusThreadManager::Get() ->GetBluetoothProfileManagerClient() ->UnregisterProfile( object_path_, unregistered_callback, @@ -104,7 +102,7 @@ void BluetoothAdapterProfileChromeOS::OnUnregisterProfileError( unregistered_callback.Run(); } -// bluez::BluetoothProfileServiceProvider::Delegate: +// BluetoothProfileServiceProvider::Delegate: void BluetoothAdapterProfileChromeOS::Released() { VLOG(1) << object_path_.value() << ": Release"; } @@ -112,7 +110,7 @@ void BluetoothAdapterProfileChromeOS::Released() { void BluetoothAdapterProfileChromeOS::NewConnection( const dbus::ObjectPath& device_path, scoped_ptr<dbus::FileDescriptor> fd, - const bluez::BluetoothProfileServiceProvider::Delegate::Options& options, + const 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 35971e8..85e2ffe 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 bluez::BluetoothProfileServiceProvider::Delegate { + : public chromeos::BluetoothProfileServiceProvider::Delegate { public: typedef base::Callback<void(scoped_ptr<BluetoothAdapterProfileChromeOS> profile)> ProfileRegisteredCallback; @@ -39,10 +39,9 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterProfileChromeOS // will be called. static void Register( const device::BluetoothUUID& uuid, - const bluez::BluetoothProfileManagerClient::Options& options, + const BluetoothProfileManagerClient::Options& options, const ProfileRegisteredCallback& success_callback, - const bluez::BluetoothProfileManagerClient::ErrorCallback& - error_callback); + const BluetoothProfileManagerClient::ErrorCallback& error_callback); ~BluetoothAdapterProfileChromeOS() override; @@ -57,7 +56,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, - bluez::BluetoothProfileServiceProvider::Delegate* delegate); + BluetoothProfileServiceProvider::Delegate* delegate); // Remove the delegate for a device. |unregistered_callback| will be called // if this unregisters the profile. @@ -70,12 +69,12 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterProfileChromeOS private: BluetoothAdapterProfileChromeOS(const device::BluetoothUUID& uuid); - // bluez::BluetoothProfileServiceProvider::Delegate: + // BluetoothProfileServiceProvider::Delegate: void Released() override; void NewConnection( const dbus::ObjectPath& device_path, scoped_ptr<dbus::FileDescriptor> fd, - const bluez::BluetoothProfileServiceProvider::Delegate::Options& options, + const BluetoothProfileServiceProvider::Delegate::Options& options, const ConfirmationCallback& callback) override; void RequestDisconnection(const dbus::ObjectPath& device_path, const ConfirmationCallback& callback) override; @@ -87,8 +86,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterProfileChromeOS const std::string& error_message); // List of delegates which this profile is multiplexing to. - std::map<std::string, bluez::BluetoothProfileServiceProvider::Delegate*> - delegates_; + std::map<std::string, BluetoothProfileServiceProvider::Delegate*> delegates_; // The UUID that this profile represents. const device::BluetoothUUID& uuid_; @@ -97,7 +95,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterProfileChromeOS dbus::ObjectPath object_path_; // Profile dbus object for receiving profile method calls from BlueZ - scoped_ptr<bluez::BluetoothProfileServiceProvider> profile_; + scoped_ptr<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 be99901..1b9c0b3 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,29 +27,25 @@ class BluetoothAdapterProfileChromeOSTest : public testing::Test { BluetoothAdapterProfileChromeOSTest() : success_callback_count_(0), error_callback_count_(0), - fake_delegate_paired_( - bluez::FakeBluetoothDeviceClient::kPairedDevicePath), - fake_delegate_autopair_( - bluez::FakeBluetoothDeviceClient::kLegacyAutopairPath), + fake_delegate_paired_(FakeBluetoothDeviceClient::kPairedDevicePath), + fake_delegate_autopair_(FakeBluetoothDeviceClient::kLegacyAutopairPath), fake_delegate_listen_(""), profile_user_ptr_(nullptr) {} void SetUp() override { - scoped_ptr<bluez::BluezDBusManagerSetter> dbus_setter = - bluez::BluezDBusManager::GetSetterForTesting(); + scoped_ptr<DBusThreadManagerSetter> dbus_setter = + DBusThreadManager::GetSetterForTesting(); dbus_setter->SetBluetoothAdapterClient( - scoped_ptr<bluez::BluetoothAdapterClient>( - new bluez::FakeBluetoothAdapterClient)); + scoped_ptr<BluetoothAdapterClient>(new FakeBluetoothAdapterClient)); dbus_setter->SetBluetoothAgentManagerClient( - scoped_ptr<bluez::BluetoothAgentManagerClient>( - new bluez::FakeBluetoothAgentManagerClient)); + scoped_ptr<BluetoothAgentManagerClient>( + new FakeBluetoothAgentManagerClient)); dbus_setter->SetBluetoothDeviceClient( - scoped_ptr<bluez::BluetoothDeviceClient>( - new bluez::FakeBluetoothDeviceClient)); + scoped_ptr<BluetoothDeviceClient>(new FakeBluetoothDeviceClient)); dbus_setter->SetBluetoothProfileManagerClient( - scoped_ptr<bluez::BluetoothProfileManagerClient>( - new bluez::FakeBluetoothProfileManagerClient)); + scoped_ptr<BluetoothProfileManagerClient>( + new FakeBluetoothProfileManagerClient)); // Grab a pointer to the adapter. device::BluetoothAdapterFactory::GetAdapter( @@ -68,20 +64,21 @@ class BluetoothAdapterProfileChromeOSTest : public testing::Test { void TearDown() override { profile_.reset(); adapter_ = nullptr; - bluez::BluezDBusManager::Shutdown(); + DBusThreadManager::Shutdown(); } void AdapterCallback(scoped_refptr<BluetoothAdapter> adapter) { adapter_ = adapter; } - class FakeDelegate : public bluez::BluetoothProfileServiceProvider::Delegate { + class FakeDelegate + : public chromeos::BluetoothProfileServiceProvider::Delegate { public: FakeDelegate(const std::string& device_path) : connections_(0) { device_path_ = dbus::ObjectPath(device_path); } - // bluez::BluetoothProfileServiceProvider::Delegate: + // BluetoothProfileServiceProvider::Delegate: void Released() override { // noop } @@ -89,8 +86,7 @@ class BluetoothAdapterProfileChromeOSTest : public testing::Test { void NewConnection( const dbus::ObjectPath& device_path, scoped_ptr<dbus::FileDescriptor> fd, - const bluez::BluetoothProfileServiceProvider::Delegate::Options& - options, + const BluetoothProfileServiceProvider::Delegate::Options& options, const ConfirmationCallback& callback) override { ++connections_; fd->CheckValidity(); @@ -161,8 +157,8 @@ class BluetoothAdapterProfileChromeOSTest : public testing::Test { }; TEST_F(BluetoothAdapterProfileChromeOSTest, DelegateCount) { - BluetoothUUID uuid(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid); - bluez::BluetoothProfileManagerClient::Options options; + BluetoothUUID uuid(FakeBluetoothProfileManagerClient::kRfcommUuid); + BluetoothProfileManagerClient::Options options; options.require_authentication.reset(new bool(false)); @@ -198,8 +194,8 @@ TEST_F(BluetoothAdapterProfileChromeOSTest, DelegateCount) { } TEST_F(BluetoothAdapterProfileChromeOSTest, BlackHole) { - BluetoothUUID uuid(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid); - bluez::BluetoothProfileManagerClient::Options options; + BluetoothUUID uuid(FakeBluetoothProfileManagerClient::kRfcommUuid); + BluetoothProfileManagerClient::Options options; options.require_authentication.reset(new bool(false)); @@ -216,9 +212,9 @@ TEST_F(BluetoothAdapterProfileChromeOSTest, BlackHole) { EXPECT_EQ(1U, success_callback_count_); EXPECT_EQ(0U, error_callback_count_); - bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->ConnectProfile( - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kPairedDevicePath), - bluez::FakeBluetoothProfileManagerClient::kRfcommUuid, + DBusThreadManager::Get()->GetBluetoothDeviceClient()->ConnectProfile( + dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath), + FakeBluetoothProfileManagerClient::kRfcommUuid, base::Bind( &BluetoothAdapterProfileChromeOSTest::DBusConnectSuccessCallback, base::Unretained(this)), @@ -234,8 +230,8 @@ TEST_F(BluetoothAdapterProfileChromeOSTest, BlackHole) { } TEST_F(BluetoothAdapterProfileChromeOSTest, Routing) { - BluetoothUUID uuid(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid); - bluez::BluetoothProfileManagerClient::Options options; + BluetoothUUID uuid(FakeBluetoothProfileManagerClient::kRfcommUuid); + BluetoothProfileManagerClient::Options options; options.require_authentication.reset(new bool(false)); @@ -259,9 +255,9 @@ TEST_F(BluetoothAdapterProfileChromeOSTest, Routing) { profile_->SetDelegate(fake_delegate_listen_.device_path_, &fake_delegate_listen_); - bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->ConnectProfile( - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kPairedDevicePath), - bluez::FakeBluetoothProfileManagerClient::kRfcommUuid, + DBusThreadManager::Get()->GetBluetoothDeviceClient()->ConnectProfile( + dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath), + FakeBluetoothProfileManagerClient::kRfcommUuid, base::Bind( &BluetoothAdapterProfileChromeOSTest::DBusConnectSuccessCallback, base::Unretained(this)), @@ -275,9 +271,9 @@ TEST_F(BluetoothAdapterProfileChromeOSTest, Routing) { EXPECT_EQ(1U, fake_delegate_paired_.connections_); - bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->ConnectProfile( - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLegacyAutopairPath), - bluez::FakeBluetoothProfileManagerClient::kRfcommUuid, + DBusThreadManager::Get()->GetBluetoothDeviceClient()->ConnectProfile( + dbus::ObjectPath(FakeBluetoothDeviceClient::kLegacyAutopairPath), + FakeBluetoothProfileManagerClient::kRfcommUuid, base::Bind( &BluetoothAdapterProfileChromeOSTest::DBusConnectSuccessCallback, base::Unretained(this)), @@ -292,9 +288,9 @@ TEST_F(BluetoothAdapterProfileChromeOSTest, Routing) { EXPECT_EQ(1U, fake_delegate_autopair_.connections_); // Incoming connections look the same from BlueZ. - bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->ConnectProfile( - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kDisplayPinCodePath), - bluez::FakeBluetoothProfileManagerClient::kRfcommUuid, + DBusThreadManager::Get()->GetBluetoothDeviceClient()->ConnectProfile( + dbus::ObjectPath(FakeBluetoothDeviceClient::kDisplayPinCodePath), + FakeBluetoothProfileManagerClient::kRfcommUuid, base::Bind( &BluetoothAdapterProfileChromeOSTest::DBusConnectSuccessCallback, base::Unretained(this)), @@ -310,8 +306,8 @@ TEST_F(BluetoothAdapterProfileChromeOSTest, Routing) { } TEST_F(BluetoothAdapterProfileChromeOSTest, SimultaneousRegister) { - BluetoothUUID uuid(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid); - bluez::BluetoothProfileManagerClient::Options options; + BluetoothUUID uuid(FakeBluetoothProfileManagerClient::kRfcommUuid); + BluetoothProfileManagerClient::Options options; BluetoothAdapterChromeOS* adapter = static_cast<BluetoothAdapterChromeOS*>(adapter_.get()); @@ -351,9 +347,8 @@ TEST_F(BluetoothAdapterProfileChromeOSTest, SimultaneousRegister) { } TEST_F(BluetoothAdapterProfileChromeOSTest, SimultaneousRegisterFail) { - BluetoothUUID uuid( - bluez::FakeBluetoothProfileManagerClient::kUnregisterableUuid); - bluez::BluetoothProfileManagerClient::Options options; + BluetoothUUID uuid(FakeBluetoothProfileManagerClient::kUnregisterableUuid); + 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 671977d..8cdfe90 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,12 +82,10 @@ BluetoothAdvertisementChromeOS::BluetoothAdvertisementChromeOS( dbus::ObjectPath advertisement_object_path = dbus::ObjectPath("/org/chromium/bluetooth_advertisement/" + GuidString); - DCHECK(bluez::BluezDBusManager::Get()); - provider_ = bluez::BluetoothLEAdvertisementServiceProvider::Create( - bluez::BluezDBusManager::Get()->GetSystemBus(), advertisement_object_path, - this, - static_cast< - bluez::BluetoothLEAdvertisementServiceProvider::AdvertisementType>( + DCHECK(DBusThreadManager::Get()); + provider_ = BluetoothLEAdvertisementServiceProvider::Create( + DBusThreadManager::Get()->GetSystemBus(), advertisement_object_path, this, + static_cast<BluetoothLEAdvertisementServiceProvider::AdvertisementType>( data->type()), data->service_uuids().Pass(), data->manufacturer_data().Pass(), data->solicit_uuids().Pass(), data->service_data().Pass()); @@ -97,8 +95,8 @@ void BluetoothAdvertisementChromeOS::Register( const base::Closure& success_callback, const device::BluetoothAdapter::CreateAdvertisementErrorCallback& error_callback) { - DCHECK(bluez::BluezDBusManager::Get()); - bluez::BluezDBusManager::Get() + DCHECK(DBusThreadManager::Get()); + DBusThreadManager::Get() ->GetBluetoothLEAdvertisingManagerClient() ->RegisterAdvertisement( adapter_->object_path(), provider_->object_path(), success_callback, @@ -120,8 +118,8 @@ void BluetoothAdvertisementChromeOS::Unregister( return; } - DCHECK(bluez::BluezDBusManager::Get()); - bluez::BluezDBusManager::Get() + DCHECK(DBusThreadManager::Get()); + DBusThreadManager::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 44abec2..aeb59b7 100644 --- a/device/bluetooth/bluetooth_advertisement_chromeos.h +++ b/device/bluetooth/bluetooth_advertisement_chromeos.h @@ -6,24 +6,21 @@ #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 bluez::BluetoothLEAdvertisementServiceProvider::Delegate { + public BluetoothLEAdvertisementServiceProvider::Delegate { public: BluetoothAdvertisementChromeOS( scoped_ptr<device::BluetoothAdvertisement::Data> data, @@ -33,7 +30,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdvertisementChromeOS void Unregister(const SuccessCallback& success_callback, const ErrorCallback& error_callback) override; - // bluez::BluetoothLEAdvertisementServiceProvider::Delegate overrides: + // BluetoothLEAdvertisementServiceProvider::Delegate overrides: void Released() override; void Register( @@ -43,7 +40,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdvertisementChromeOS // Used from tests to be able to trigger events on the fake advertisement // provider. - bluez::BluetoothLEAdvertisementServiceProvider* provider() { + BluetoothLEAdvertisementServiceProvider* provider() { return provider_.get(); } @@ -52,7 +49,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdvertisementChromeOS // Adapter this advertisement is advertising on. scoped_refptr<BluetoothAdapterChromeOS> adapter_; - scoped_ptr<bluez::BluetoothLEAdvertisementServiceProvider> provider_; + scoped_ptr<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 165dc8d..02fe1e4 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 { - bluez::BluezDBusManager::Initialize(NULL, true); + DBusThreadManager::Initialize(); 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; - bluez::BluezDBusManager::Shutdown(); + DBusThreadManager::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()); - bluez::FakeBluetoothLEAdvertisementServiceProvider* provider = - static_cast<bluez::FakeBluetoothLEAdvertisementServiceProvider*>( + FakeBluetoothLEAdvertisementServiceProvider* provider = + static_cast<FakeBluetoothLEAdvertisementServiceProvider*>( adv->provider()); provider->Release(); } diff --git a/device/bluetooth/bluetooth_audio_sink_chromeos.cc b/device/bluetooth/bluetooth_audio_sink_chromeos.cc index 9bb4b60..18ab219 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(bluez::BluezDBusManager::IsInitialized()); + CHECK(DBusThreadManager::IsInitialized()); adapter_->AddObserver(this); - bluez::BluetoothMediaClient* media = - bluez::BluezDBusManager::Get()->GetBluetoothMediaClient(); + BluetoothMediaClient* media = + DBusThreadManager::Get()->GetBluetoothMediaClient(); CHECK(media); media->AddObserver(this); - bluez::BluetoothMediaTransportClient* transport = - bluez::BluezDBusManager::Get()->GetBluetoothMediaTransportClient(); + BluetoothMediaTransportClient* transport = + DBusThreadManager::Get()->GetBluetoothMediaTransportClient(); CHECK(transport); transport->AddObserver(this); @@ -123,13 +123,13 @@ BluetoothAudioSinkChromeOS::~BluetoothAudioSinkChromeOS() { adapter_->RemoveObserver(this); - bluez::BluetoothMediaClient* media = - bluez::BluezDBusManager::Get()->GetBluetoothMediaClient(); + BluetoothMediaClient* media = + DBusThreadManager::Get()->GetBluetoothMediaClient(); CHECK(media); media->RemoveObserver(this); - bluez::BluetoothMediaTransportClient* transport = - bluez::BluezDBusManager::Get()->GetBluetoothMediaTransportClient(); + BluetoothMediaTransportClient* transport = + DBusThreadManager::Get()->GetBluetoothMediaTransportClient(); CHECK(transport); transport->RemoveObserver(this); } @@ -139,11 +139,11 @@ void BluetoothAudioSinkChromeOS::Unregister( const device::BluetoothAudioSink::ErrorCallback& error_callback) { VLOG(1) << "Unregister"; - if (!bluez::BluezDBusManager::IsInitialized()) + if (!DBusThreadManager::IsInitialized()) error_callback.Run(BluetoothAudioSink::ERROR_NOT_UNREGISTERED); - bluez::BluetoothMediaClient* media = - bluez::BluezDBusManager::Get()->GetBluetoothMediaClient(); + BluetoothMediaClient* media = + DBusThreadManager::Get()->GetBluetoothMediaClient(); CHECK(media); media->UnregisterEndpoint( @@ -185,28 +185,27 @@ void BluetoothAudioSinkChromeOS::Register( DCHECK_EQ(state_, BluetoothAudioSink::STATE_DISCONNECTED); // Gets system bus. - dbus::Bus* system_bus = bluez::BluezDBusManager::Get()->GetSystemBus(); + dbus::Bus* system_bus = DBusThreadManager::Get()->GetSystemBus(); // Creates a Media Endpoint with newly-generated path. endpoint_path_ = GenerateEndpointPath(); - media_endpoint_.reset(bluez::BluetoothMediaEndpointServiceProvider::Create( + media_endpoint_.reset(BluetoothMediaEndpointServiceProvider::Create( system_bus, endpoint_path_, this)); DCHECK(media_endpoint_.get()); // Creates endpoint properties with |options|. options_ = options; - bluez::BluetoothMediaClient::EndpointProperties endpoint_properties; - endpoint_properties.uuid = - bluez::BluetoothMediaClient::kBluetoothAudioSinkUUID; + chromeos::BluetoothMediaClient::EndpointProperties endpoint_properties; + endpoint_properties.uuid = BluetoothMediaClient::kBluetoothAudioSinkUUID; endpoint_properties.codec = options_.codec; endpoint_properties.capabilities = options_.capabilities; media_path_ = static_cast<BluetoothAdapterChromeOS*>( adapter_.get())->object_path(); - bluez::BluetoothMediaClient* media = - bluez::BluezDBusManager::Get()->GetBluetoothMediaClient(); + BluetoothMediaClient* media = + DBusThreadManager::Get()->GetBluetoothMediaClient(); CHECK(media); media->RegisterEndpoint( media_path_, @@ -218,7 +217,7 @@ void BluetoothAudioSinkChromeOS::Register( weak_ptr_factory_.GetWeakPtr(), error_callback)); } -bluez::BluetoothMediaEndpointServiceProvider* +BluetoothMediaEndpointServiceProvider* BluetoothAudioSinkChromeOS::GetEndpointServiceProvider() { return media_endpoint_.get(); } @@ -280,21 +279,21 @@ void BluetoothAudioSinkChromeOS::MediaTransportPropertyChanged( VLOG(1) << "MediaTransportPropertyChanged: " << property_name; // Retrieves the property set of the transport object with |object_path|. - bluez::BluetoothMediaTransportClient::Properties* properties = - bluez::BluezDBusManager::Get() + BluetoothMediaTransportClient::Properties* properties = + DBusThreadManager::Get() ->GetBluetoothMediaTransportClient() ->GetProperties(object_path); // Dispatches a property changed event to the corresponding handler. if (property_name == properties->state.name()) { if (properties->state.value() == - bluez::BluetoothMediaTransportClient::kStateIdle) { + BluetoothMediaTransportClient::kStateIdle) { StateChanged(BluetoothAudioSink::STATE_IDLE); } else if (properties->state.value() == - bluez::BluetoothMediaTransportClient::kStatePending) { + BluetoothMediaTransportClient::kStatePending) { StateChanged(BluetoothAudioSink::STATE_PENDING); } else if (properties->state.value() == - bluez::BluetoothMediaTransportClient::kStateActive) { + BluetoothMediaTransportClient::kStateActive) { StateChanged(BluetoothAudioSink::STATE_ACTIVE); } } else if (property_name == properties->volume.name()) { @@ -309,7 +308,7 @@ void BluetoothAudioSinkChromeOS::SetConfiguration( transport_path_ = transport_path; // The initial state for a connection should be "idle". - if (properties.state != bluez::BluetoothMediaTransportClient::kStateIdle) { + if (properties.state != BluetoothMediaTransportClient::kStateIdle) { VLOG(1) << "SetConfiugration - unexpected state :" << properties.state; return; } @@ -356,7 +355,7 @@ void BluetoothAudioSinkChromeOS::AcquireFD() { read_has_failed_ = false; - bluez::BluezDBusManager::Get()->GetBluetoothMediaTransportClient()->Acquire( + DBusThreadManager::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 750b31d..6261ace 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 bluez::BluetoothMediaClient::Observer, - public bluez::BluetoothMediaTransportClient::Observer, - public bluez::BluetoothMediaEndpointServiceProvider::Delegate, + public BluetoothMediaClient::Observer, + public BluetoothMediaTransportClient::Observer, + public 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. - bluez::BluetoothMediaEndpointServiceProvider* GetEndpointServiceProvider(); + BluetoothMediaEndpointServiceProvider* GetEndpointServiceProvider(); private: ~BluetoothAudioSinkChromeOS() override; @@ -72,15 +72,15 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAudioSinkChromeOS void AdapterPoweredChanged(device::BluetoothAdapter* adapter, bool powered) override; - // bluez::BluetoothMediaClient::Observer overrides. + // BluetoothMediaClient::Observer overrides. void MediaRemoved(const dbus::ObjectPath& object_path) override; - // bluez::BluetoothMediaTransportClient::Observer overrides. + // BluetoothMediaTransportClient::Observer overrides. void MediaTransportRemoved(const dbus::ObjectPath& object_path) override; void MediaTransportPropertyChanged(const dbus::ObjectPath& object_path, const std::string& property_name) override; - // bluez::BluetoothMediaEndpointServiceProvider::Delegate overrides. + // 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<bluez::BluetoothMediaEndpointServiceProvider> media_endpoint_; + scoped_ptr<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 5f51cb8..a585f3d 100644 --- a/device/bluetooth/bluetooth_audio_sink_chromeos_unittest.cc +++ b/device/bluetooth/bluetooth_audio_sink_chromeos_unittest.cc @@ -8,21 +8,20 @@ #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 bluez::FakeBluetoothMediaTransportClient; using dbus::ObjectPath; using device::BluetoothAdapter; using device::BluetoothAdapterFactory; @@ -82,26 +81,26 @@ class TestAudioSinkObserver : public BluetoothAudioSink::Observer { class BluetoothAudioSinkChromeOSTest : public testing::Test { public: void SetUp() override { - bluez::BluezDBusManager::Initialize(NULL, true); + DBusThreadManager::Initialize(); callback_count_ = 0; error_callback_count_ = 0; - fake_media_ = static_cast<bluez::FakeBluetoothMediaClient*>( - bluez::BluezDBusManager::Get()->GetBluetoothMediaClient()); + fake_media_ = static_cast<FakeBluetoothMediaClient*>( + DBusThreadManager::Get()->GetBluetoothMediaClient()); fake_transport_ = static_cast<FakeBluetoothMediaTransportClient*>( - bluez::BluezDBusManager::Get()->GetBluetoothMediaTransportClient()); + DBusThreadManager::Get()->GetBluetoothMediaTransportClient()); // Initiates Delegate::TransportProperties with default values. properties_.device = ObjectPath(FakeBluetoothMediaTransportClient::kTransportDevicePath); - properties_.uuid = bluez::BluetoothMediaClient::kBluetoothAudioSinkUUID; + properties_.uuid = BluetoothMediaClient::kBluetoothAudioSinkUUID; properties_.codec = FakeBluetoothMediaTransportClient::kTransportCodec; properties_.configuration = std::vector<uint8_t>( FakeBluetoothMediaTransportClient::kTransportConfiguration, FakeBluetoothMediaTransportClient::kTransportConfiguration + FakeBluetoothMediaTransportClient::kTransportConfigurationLength); - properties_.state = bluez::BluetoothMediaTransportClient::kStateIdle; + properties_.state = BluetoothMediaTransportClient::kStateIdle; properties_.delay.reset( new uint16_t(FakeBluetoothMediaTransportClient::kTransportDelay)); properties_.volume.reset( @@ -120,7 +119,7 @@ class BluetoothAudioSinkChromeOSTest : public testing::Test { // The adapter should outlive audio sink. audio_sink_ = nullptr; adapter_ = nullptr; - bluez::BluezDBusManager::Shutdown(); + DBusThreadManager::Shutdown(); } // Gets the existing Bluetooth adapter. @@ -181,9 +180,8 @@ class BluetoothAudioSinkChromeOSTest : public testing::Test { static_cast<BluetoothAudioSinkChromeOS*>(audio_sink_.get()); ASSERT_NE(audio_sink_chromeos, nullptr); - media_endpoint_ = - static_cast<bluez::FakeBluetoothMediaEndpointServiceProvider*>( - audio_sink_chromeos->GetEndpointServiceProvider()); + media_endpoint_ = static_cast<FakeBluetoothMediaEndpointServiceProvider*>( + audio_sink_chromeos->GetEndpointServiceProvider()); } // Called whenever RegisterAudioSink is completed successfully. @@ -235,16 +233,16 @@ class BluetoothAudioSinkChromeOSTest : public testing::Test { base::MessageLoopForIO message_loop_; - bluez::FakeBluetoothMediaClient* fake_media_; + FakeBluetoothMediaClient* fake_media_; FakeBluetoothMediaTransportClient* fake_transport_; - bluez::FakeBluetoothMediaEndpointServiceProvider* media_endpoint_; + 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. - bluez::BluetoothMediaEndpointServiceProvider::Delegate::TransportProperties + BluetoothMediaEndpointServiceProvider::Delegate::TransportProperties properties_; }; diff --git a/device/bluetooth/bluetooth_chromeos_unittest.cc b/device/bluetooth/bluetooth_chromeos_unittest.cc index ec58701..d85d05f 100644 --- a/device/bluetooth/bluetooth_chromeos_unittest.cc +++ b/device/bluetooth/bluetooth_chromeos_unittest.cc @@ -6,6 +6,12 @@ #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" @@ -14,12 +20,6 @@ #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,18 +45,17 @@ void SaveConnectionInfo(BluetoothDevice::ConnectionInfo* out, }; class FakeBluetoothProfileServiceProviderDelegate - : public bluez::BluetoothProfileServiceProvider::Delegate { + : public chromeos::BluetoothProfileServiceProvider::Delegate { public: FakeBluetoothProfileServiceProviderDelegate() {} - // bluez::BluetoothProfileServiceProvider::Delegate: + // BluetoothProfileServiceProvider::Delegate: void Released() override {} - void NewConnection( - const dbus::ObjectPath&, - scoped_ptr<dbus::FileDescriptor>, - const bluez::BluetoothProfileServiceProvider::Delegate::Options&, - const ConfirmationCallback&) override {} + void NewConnection(const dbus::ObjectPath&, + scoped_ptr<dbus::FileDescriptor>, + const BluetoothProfileServiceProvider::Delegate::Options&, + const ConfirmationCallback&) override {} void RequestDisconnection(const dbus::ObjectPath&, const ConfirmationCallback&) override {} @@ -154,28 +153,25 @@ class TestPairingDelegate : public BluetoothDevice::PairingDelegate { class BluetoothChromeOSTest : public testing::Test { public: void SetUp() override { - scoped_ptr<bluez::BluezDBusManagerSetter> dbus_setter = - bluez::BluezDBusManager::GetSetterForTesting(); - // We need to initialize BluezDBusManager early to prevent + scoped_ptr<DBusThreadManagerSetter> dbus_setter = + chromeos::DBusThreadManager::GetSetterForTesting(); + // We need to initialize DBusThreadManager early to prevent // Bluetooth*::Create() methods from picking the real instead of fake // implementations. - fake_bluetooth_adapter_client_ = new bluez::FakeBluetoothAdapterClient; + fake_bluetooth_adapter_client_ = new FakeBluetoothAdapterClient; dbus_setter->SetBluetoothAdapterClient( - scoped_ptr<bluez::BluetoothAdapterClient>( - fake_bluetooth_adapter_client_)); - fake_bluetooth_device_client_ = new bluez::FakeBluetoothDeviceClient; + scoped_ptr<BluetoothAdapterClient>(fake_bluetooth_adapter_client_)); + fake_bluetooth_device_client_ = new FakeBluetoothDeviceClient; dbus_setter->SetBluetoothDeviceClient( - scoped_ptr<bluez::BluetoothDeviceClient>( - fake_bluetooth_device_client_)); + scoped_ptr<BluetoothDeviceClient>(fake_bluetooth_device_client_)); dbus_setter->SetBluetoothInputClient( - scoped_ptr<bluez::BluetoothInputClient>( - new bluez::FakeBluetoothInputClient)); + scoped_ptr<BluetoothInputClient>(new FakeBluetoothInputClient)); dbus_setter->SetBluetoothAgentManagerClient( - scoped_ptr<bluez::BluetoothAgentManagerClient>( - new bluez::FakeBluetoothAgentManagerClient)); + scoped_ptr<BluetoothAgentManagerClient>( + new FakeBluetoothAgentManagerClient)); dbus_setter->SetBluetoothGattServiceClient( - scoped_ptr<bluez::BluetoothGattServiceClient>( - new bluez::FakeBluetoothGattServiceClient)); + scoped_ptr<BluetoothGattServiceClient>( + new FakeBluetoothGattServiceClient)); fake_bluetooth_adapter_client_->SetSimulationIntervalMs(10); @@ -200,7 +196,7 @@ class BluetoothChromeOSTest : public testing::Test { } discovery_sessions_.clear(); adapter_ = nullptr; - bluez::BluezDBusManager::Shutdown(); + DBusThreadManager::Shutdown(); } // Generic callbacks @@ -329,8 +325,8 @@ class BluetoothChromeOSTest : public testing::Test { protected: base::MessageLoop message_loop_; - bluez::FakeBluetoothAdapterClient* fake_bluetooth_adapter_client_; - bluez::FakeBluetoothDeviceClient* fake_bluetooth_device_client_; + FakeBluetoothAdapterClient* fake_bluetooth_adapter_client_; + FakeBluetoothDeviceClient* fake_bluetooth_device_client_; scoped_refptr<BluetoothAdapter> adapter_; int callback_count_; @@ -358,16 +354,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(bluez::FakeBluetoothAdapterClient::kAdapterAddress, + EXPECT_EQ(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(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress, + EXPECT_EQ(FakeBluetoothDeviceClient::kPairedDeviceAddress, devices[0]->GetAddress()); - EXPECT_EQ(bluez::FakeBluetoothDeviceClient::kPairedUnconnectableDeviceAddress, + EXPECT_EQ(FakeBluetoothDeviceClient::kPairedUnconnectableDeviceAddress, devices[1]->GetAddress()); } @@ -389,7 +385,7 @@ TEST_F(BluetoothChromeOSTest, BecomePresent) { // We should have had a device announced. EXPECT_EQ(2, observer.device_added_count()); - EXPECT_EQ(bluez::FakeBluetoothDeviceClient::kPairedUnconnectableDeviceAddress, + EXPECT_EQ(FakeBluetoothDeviceClient::kPairedUnconnectableDeviceAddress, observer.last_device_address()); // Other callbacks shouldn't be called if the values are false. @@ -416,7 +412,7 @@ TEST_F(BluetoothChromeOSTest, BecomeNotPresent) { // We should have had a device removed. EXPECT_EQ(2, observer.device_removed_count()); - EXPECT_EQ(bluez::FakeBluetoothDeviceClient::kPairedUnconnectableDeviceAddress, + EXPECT_EQ(FakeBluetoothDeviceClient::kPairedUnconnectableDeviceAddress, observer.last_device_address()); // Other callbacks shouldn't be called since the values are false. @@ -439,7 +435,7 @@ TEST_F(BluetoothChromeOSTest, SecondAdapter) { EXPECT_EQ(0, observer.present_changed_count()); EXPECT_TRUE(adapter_->IsPresent()); - EXPECT_EQ(bluez::FakeBluetoothAdapterClient::kAdapterAddress, + EXPECT_EQ(FakeBluetoothAdapterClient::kAdapterAddress, adapter_->GetAddress()); // Try removing the first adapter, we should now act as if the adapter @@ -453,7 +449,7 @@ TEST_F(BluetoothChromeOSTest, SecondAdapter) { // We should have had a device removed. EXPECT_EQ(2, observer.device_removed_count()); - EXPECT_EQ(bluez::FakeBluetoothDeviceClient::kPairedUnconnectableDeviceAddress, + EXPECT_EQ(FakeBluetoothDeviceClient::kPairedUnconnectableDeviceAddress, observer.last_device_address()); // Other callbacks shouldn't be called since the values are false. @@ -724,7 +720,7 @@ TEST_F(BluetoothChromeOSTest, Discovery) { message_loop_.Run(); EXPECT_EQ(2, observer.device_added_count()); - EXPECT_EQ(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress, + EXPECT_EQ(FakeBluetoothDeviceClient::kLowEnergyAddress, observer.last_device_address()); // Next we should get another two devices... @@ -736,7 +732,7 @@ TEST_F(BluetoothChromeOSTest, Discovery) { message_loop_.Run(); EXPECT_EQ(1, observer.device_removed_count()); - EXPECT_EQ(bluez::FakeBluetoothDeviceClient::kVanishingDeviceAddress, + EXPECT_EQ(FakeBluetoothDeviceClient::kVanishingDeviceAddress, observer.last_device_address()); } @@ -756,7 +752,7 @@ TEST_F(BluetoothChromeOSTest, PoweredAndDiscovering) { // Stop the timers that the simulation uses fake_bluetooth_device_client_->EndDiscoverySimulation( - dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath)); + dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath)); ASSERT_TRUE(adapter_->IsPowered()); ASSERT_TRUE(adapter_->IsDiscovering()); @@ -950,23 +946,21 @@ TEST_F(BluetoothChromeOSTest, // Stop the timers that the simulation uses fake_bluetooth_device_client_->EndDiscoverySimulation( - dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath)); + dbus::ObjectPath(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 bluez::FakeBluetoothAdapterClient does its own reference - // counting and + // Even though FakeBluetoothAdapterClient does its own reference counting and // we called 3 BluetoothAdapter::StartDiscoverySession 3 times, the - // bluez::FakeBluetoothAdapterClient's count should be only 1 and a single - // call to - // bluez::FakeBluetoothAdapterClient::StopDiscovery should work. + // FakeBluetoothAdapterClient's count should be only 1 and a single call to + // FakeBluetoothAdapterClient::StopDiscovery should work. fake_bluetooth_adapter_client_->StopDiscovery( - dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath), - GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback, - base::Unretained(this))); + dbus::ObjectPath(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_); @@ -999,7 +993,7 @@ TEST_F(BluetoothChromeOSTest, EXPECT_TRUE(discovery_sessions_[i]->IsActive()); fake_bluetooth_device_client_->EndDiscoverySimulation( - dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath)); + dbus::ObjectPath(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 @@ -1024,8 +1018,7 @@ TEST_F(BluetoothChromeOSTest, EXPECT_TRUE(observer.last_discovering()); EXPECT_TRUE(adapter_->IsDiscovering()); - // Start and stop discovery. At this point, bluez::FakeBluetoothAdapterClient - // has + // Start and stop discovery. At this point, 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. @@ -1070,9 +1063,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(bluez::FakeBluetoothAdapterClient::kAdapterPath), - GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback, - base::Unretained(this))); + dbus::ObjectPath(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_); @@ -1131,7 +1124,7 @@ TEST_F(BluetoothChromeOSTest, InvalidatedDiscoverySessions) { // Stop the timers that the simulation uses fake_bluetooth_device_client_->EndDiscoverySimulation( - dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath)); + dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath)); ASSERT_TRUE(adapter_->IsPowered()); ASSERT_TRUE(adapter_->IsDiscovering()); @@ -1148,9 +1141,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(bluez::FakeBluetoothAdapterClient::kAdapterPath), - GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback, - base::Unretained(this))); + dbus::ObjectPath(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_); @@ -1183,7 +1176,7 @@ TEST_F(BluetoothChromeOSTest, QueuedDiscoveryRequests) { EXPECT_EQ(0, callback_count_); fake_bluetooth_device_client_->EndDiscoverySimulation( - dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath)); + dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath)); // The underlying adapter has started discovery, but our call hasn't returned // yet. @@ -2099,13 +2092,12 @@ TEST_F(BluetoothChromeOSTest, DeviceProperties) { BluetoothAdapter::DeviceList devices = adapter_->GetDevices(); ASSERT_EQ(2U, devices.size()); - ASSERT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress, + ASSERT_EQ(FakeBluetoothDeviceClient::kPairedDeviceAddress, devices[0]->GetAddress()); // Verify the other device properties. - EXPECT_EQ( - base::UTF8ToUTF16(bluez::FakeBluetoothDeviceClient::kPairedDeviceName), - devices[0]->GetName()); + EXPECT_EQ(base::UTF8ToUTF16(FakeBluetoothDeviceClient::kPairedDeviceName), + devices[0]->GetName()); EXPECT_EQ(BluetoothDevice::DEVICE_COMPUTER, devices[0]->GetDeviceType()); EXPECT_TRUE(devices[0]->IsPaired()); EXPECT_FALSE(devices[0]->IsConnected()); @@ -2132,7 +2124,7 @@ TEST_F(BluetoothChromeOSTest, DeviceClassChanged) { BluetoothAdapter::DeviceList devices = adapter_->GetDevices(); ASSERT_EQ(2U, devices.size()); - ASSERT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress, + ASSERT_EQ(FakeBluetoothDeviceClient::kPairedDeviceAddress, devices[0]->GetAddress()); ASSERT_EQ(BluetoothDevice::DEVICE_COMPUTER, devices[0]->GetDeviceType()); @@ -2140,9 +2132,9 @@ TEST_F(BluetoothChromeOSTest, DeviceClassChanged) { // we change the class of the device. TestBluetoothAdapterObserver observer(adapter_); - bluez::FakeBluetoothDeviceClient::Properties* properties = - fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath( - bluez::FakeBluetoothDeviceClient::kPairedDevicePath)); + FakeBluetoothDeviceClient::Properties* properties = + fake_bluetooth_device_client_->GetProperties( + dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath)); properties->bluetooth_class.ReplaceValue(0x002580); @@ -2158,19 +2150,18 @@ TEST_F(BluetoothChromeOSTest, DeviceNameChanged) { BluetoothAdapter::DeviceList devices = adapter_->GetDevices(); ASSERT_EQ(2U, devices.size()); - ASSERT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress, + ASSERT_EQ(FakeBluetoothDeviceClient::kPairedDeviceAddress, devices[0]->GetAddress()); - ASSERT_EQ( - base::UTF8ToUTF16(bluez::FakeBluetoothDeviceClient::kPairedDeviceName), - devices[0]->GetName()); + ASSERT_EQ(base::UTF8ToUTF16(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_); - bluez::FakeBluetoothDeviceClient::Properties* properties = - fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath( - bluez::FakeBluetoothDeviceClient::kPairedDevicePath)); + FakeBluetoothDeviceClient::Properties* properties = + fake_bluetooth_device_client_->GetProperties( + dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath)); static const std::string new_name("New Device Name"); properties->alias.ReplaceValue(new_name); @@ -2187,19 +2178,18 @@ TEST_F(BluetoothChromeOSTest, DeviceAddressChanged) { BluetoothAdapter::DeviceList devices = adapter_->GetDevices(); ASSERT_EQ(2U, devices.size()); - ASSERT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress, + ASSERT_EQ(FakeBluetoothDeviceClient::kPairedDeviceAddress, devices[0]->GetAddress()); - ASSERT_EQ( - base::UTF8ToUTF16(bluez::FakeBluetoothDeviceClient::kPairedDeviceName), - devices[0]->GetName()); + ASSERT_EQ(base::UTF8ToUTF16(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_); - bluez::FakeBluetoothDeviceClient::Properties* properties = - fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath( - bluez::FakeBluetoothDeviceClient::kPairedDevicePath)); + FakeBluetoothDeviceClient::Properties* properties = + fake_bluetooth_device_client_->GetProperties( + dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath)); static const char* kNewAddress = "D9:1F:FC:11:22:33"; properties->address.ReplaceValue(kNewAddress); @@ -2217,7 +2207,7 @@ TEST_F(BluetoothChromeOSTest, DeviceUuidsChanged) { BluetoothAdapter::DeviceList devices = adapter_->GetDevices(); ASSERT_EQ(2U, devices.size()); - ASSERT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress, + ASSERT_EQ(FakeBluetoothDeviceClient::kPairedDeviceAddress, devices[0]->GetAddress()); BluetoothDevice::UUIDList uuids = devices[0]->GetUUIDs(); @@ -2229,9 +2219,9 @@ TEST_F(BluetoothChromeOSTest, DeviceUuidsChanged) { // we change the class of the device. TestBluetoothAdapterObserver observer(adapter_); - bluez::FakeBluetoothDeviceClient::Properties* properties = - fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath( - bluez::FakeBluetoothDeviceClient::kPairedDevicePath)); + FakeBluetoothDeviceClient::Properties* properties = + fake_bluetooth_device_client_->GetProperties( + dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath)); std::vector<std::string> new_uuids; new_uuids.push_back(uuids[0].canonical_value()); @@ -2262,12 +2252,12 @@ TEST_F(BluetoothChromeOSTest, DeviceInquiryRSSIInvalidated) { BluetoothAdapter::DeviceList devices = adapter_->GetDevices(); ASSERT_EQ(2U, devices.size()); - ASSERT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress, + ASSERT_EQ(FakeBluetoothDeviceClient::kPairedDeviceAddress, devices[0]->GetAddress()); - bluez::FakeBluetoothDeviceClient::Properties* properties = - fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath( - bluez::FakeBluetoothDeviceClient::kPairedDevicePath)); + FakeBluetoothDeviceClient::Properties* properties = + fake_bluetooth_device_client_->GetProperties( + dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath)); // During discovery, rssi is a valid value (-75) properties->rssi.ReplaceValue(-75); @@ -2297,12 +2287,12 @@ TEST_F(BluetoothChromeOSTest, DeviceInquiryTxPowerInvalidated) { BluetoothAdapter::DeviceList devices = adapter_->GetDevices(); ASSERT_EQ(2U, devices.size()); - ASSERT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress, + ASSERT_EQ(FakeBluetoothDeviceClient::kPairedDeviceAddress, devices[0]->GetAddress()); - bluez::FakeBluetoothDeviceClient::Properties* properties = - fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath( - bluez::FakeBluetoothDeviceClient::kPairedDevicePath)); + FakeBluetoothDeviceClient::Properties* properties = + fake_bluetooth_device_client_->GetProperties( + dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath)); // During discovery, tx_power is a valid value (0) properties->tx_power.ReplaceValue(0); @@ -2330,7 +2320,7 @@ TEST_F(BluetoothChromeOSTest, ForgetDevice) { BluetoothAdapter::DeviceList devices = adapter_->GetDevices(); ASSERT_EQ(2U, devices.size()); - ASSERT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress, + ASSERT_EQ(FakeBluetoothDeviceClient::kPairedDeviceAddress, devices[0]->GetAddress()); std::string address = devices[0]->GetAddress(); @@ -2354,8 +2344,8 @@ TEST_F(BluetoothChromeOSTest, ForgetUnpairedDevice) { GetAdapter(); DiscoverDevices(); - BluetoothDevice* device = adapter_->GetDevice( - bluez::FakeBluetoothDeviceClient::kConnectUnpairableAddress); + BluetoothDevice* device = + adapter_->GetDevice(FakeBluetoothDeviceClient::kConnectUnpairableAddress); ASSERT_TRUE(device != nullptr); ASSERT_FALSE(device->IsPaired()); @@ -2372,9 +2362,9 @@ TEST_F(BluetoothChromeOSTest, ForgetUnpairedDevice) { ASSERT_FALSE(device->IsConnecting()); // Make sure the trusted property has been set to true. - bluez::FakeBluetoothDeviceClient::Properties* properties = - fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath( - bluez::FakeBluetoothDeviceClient::kConnectUnpairablePath)); + FakeBluetoothDeviceClient::Properties* properties = + fake_bluetooth_device_client_->GetProperties( + dbus::ObjectPath(FakeBluetoothDeviceClient::kConnectUnpairablePath)); ASSERT_TRUE(properties->trusted.value()); // Install an observer; expect the DeviceRemoved method to be called @@ -2385,20 +2375,20 @@ TEST_F(BluetoothChromeOSTest, ForgetUnpairedDevice) { EXPECT_EQ(0, error_callback_count_); EXPECT_EQ(1, observer.device_removed_count()); - EXPECT_EQ(bluez::FakeBluetoothDeviceClient::kConnectUnpairableAddress, + EXPECT_EQ(FakeBluetoothDeviceClient::kConnectUnpairableAddress, observer.last_device_address()); // GetDevices shouldn't return the device either. - device = adapter_->GetDevice( - bluez::FakeBluetoothDeviceClient::kConnectUnpairableAddress); + device = + adapter_->GetDevice(FakeBluetoothDeviceClient::kConnectUnpairableAddress); EXPECT_FALSE(device != nullptr); } TEST_F(BluetoothChromeOSTest, ConnectPairedDevice) { GetAdapter(); - BluetoothDevice* device = adapter_->GetDevice( - bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress); + BluetoothDevice* device = + adapter_->GetDevice(FakeBluetoothDeviceClient::kPairedDeviceAddress); ASSERT_TRUE(device != nullptr); ASSERT_TRUE(device->IsPaired()); @@ -2426,8 +2416,8 @@ TEST_F(BluetoothChromeOSTest, ConnectUnpairableDevice) { GetAdapter(); DiscoverDevices(); - BluetoothDevice* device = adapter_->GetDevice( - bluez::FakeBluetoothDeviceClient::kConnectUnpairableAddress); + BluetoothDevice* device = + adapter_->GetDevice(FakeBluetoothDeviceClient::kConnectUnpairableAddress); ASSERT_TRUE(device != nullptr); ASSERT_FALSE(device->IsPaired()); @@ -2451,9 +2441,9 @@ TEST_F(BluetoothChromeOSTest, ConnectUnpairableDevice) { EXPECT_FALSE(device->IsConnecting()); // Make sure the trusted property has been set to true. - bluez::FakeBluetoothDeviceClient::Properties* properties = - fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath( - bluez::FakeBluetoothDeviceClient::kConnectUnpairablePath)); + FakeBluetoothDeviceClient::Properties* properties = + fake_bluetooth_device_client_->GetProperties( + dbus::ObjectPath(FakeBluetoothDeviceClient::kConnectUnpairablePath)); EXPECT_TRUE(properties->trusted.value()); // Verify is a HID device and is not connectable. @@ -2466,8 +2456,8 @@ TEST_F(BluetoothChromeOSTest, ConnectUnpairableDevice) { TEST_F(BluetoothChromeOSTest, ConnectConnectedDevice) { GetAdapter(); - BluetoothDevice* device = adapter_->GetDevice( - bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress); + BluetoothDevice* device = + adapter_->GetDevice(FakeBluetoothDeviceClient::kPairedDeviceAddress); ASSERT_TRUE(device != nullptr); ASSERT_TRUE(device->IsPaired()); @@ -2504,8 +2494,8 @@ TEST_F(BluetoothChromeOSTest, ConnectDeviceFails) { GetAdapter(); DiscoverDevices(); - BluetoothDevice* device = adapter_->GetDevice( - bluez::FakeBluetoothDeviceClient::kLegacyAutopairAddress); + BluetoothDevice* device = + adapter_->GetDevice(FakeBluetoothDeviceClient::kLegacyAutopairAddress); ASSERT_TRUE(device != nullptr); ASSERT_FALSE(device->IsPaired()); @@ -2530,8 +2520,8 @@ TEST_F(BluetoothChromeOSTest, ConnectDeviceFails) { TEST_F(BluetoothChromeOSTest, DisconnectDevice) { GetAdapter(); - BluetoothDevice* device = adapter_->GetDevice( - bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress); + BluetoothDevice* device = + adapter_->GetDevice(FakeBluetoothDeviceClient::kPairedDeviceAddress); ASSERT_TRUE(device != nullptr); ASSERT_TRUE(device->IsPaired()); @@ -2564,8 +2554,8 @@ TEST_F(BluetoothChromeOSTest, DisconnectDevice) { TEST_F(BluetoothChromeOSTest, DisconnectUnconnectedDevice) { GetAdapter(); - BluetoothDevice* device = adapter_->GetDevice( - bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress); + BluetoothDevice* device = + adapter_->GetDevice(FakeBluetoothDeviceClient::kPairedDeviceAddress); ASSERT_TRUE(device != nullptr); ASSERT_TRUE(device->IsPaired()); ASSERT_FALSE(device->IsConnected()); @@ -2589,20 +2579,18 @@ TEST_F(BluetoothChromeOSTest, PairTrustedDevice) { GetAdapter(); fake_bluetooth_device_client_->CreateDevice( - dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath), - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient:: - kConnectedTrustedNotPairedDevicePath)); - BluetoothDevice* device = - adapter_->GetDevice(bluez::FakeBluetoothDeviceClient:: - kConnectedTrustedNotPairedDeviceAddress); + dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), + dbus::ObjectPath( + FakeBluetoothDeviceClient::kConnectedTrustedNotPairedDevicePath)); + BluetoothDevice* device = adapter_->GetDevice( + FakeBluetoothDeviceClient::kConnectedTrustedNotPairedDeviceAddress); ASSERT_TRUE(device != nullptr); // On the DBus level the device is trusted but not paired. But the current // implementation of |BluetoothDevice::IsPaired()| returns true in this case. - bluez::FakeBluetoothDeviceClient::Properties* properties = - fake_bluetooth_device_client_->GetProperties( - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient:: - kConnectedTrustedNotPairedDevicePath)); + FakeBluetoothDeviceClient::Properties* properties = + fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath( + FakeBluetoothDeviceClient::kConnectedTrustedNotPairedDevicePath)); EXPECT_FALSE(properties->paired.value()); EXPECT_TRUE(properties->trusted.value()); ASSERT_TRUE(device->IsPaired()); @@ -2628,7 +2616,7 @@ TEST_F(BluetoothChromeOSTest, PairTrustedDevice) { // Make sure the paired property has been set to true. properties = fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath( - bluez::FakeBluetoothDeviceClient::kConnectedTrustedNotPairedDevicePath)); + FakeBluetoothDeviceClient::kConnectedTrustedNotPairedDevicePath)); EXPECT_TRUE(properties->paired.value()); } @@ -2636,16 +2624,16 @@ TEST_F(BluetoothChromeOSTest, PairAlreadyPairedDevice) { GetAdapter(); fake_bluetooth_device_client_->CreateDevice( - dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath), - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kPairedDevicePath)); - BluetoothDevice* device = adapter_->GetDevice( - bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress); + dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), + dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath)); + BluetoothDevice* device = + adapter_->GetDevice(FakeBluetoothDeviceClient::kPairedDeviceAddress); ASSERT_TRUE(device != nullptr); // On the DBus level a device can be trusted but not paired. - bluez::FakeBluetoothDeviceClient::Properties* properties = - fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath( - bluez::FakeBluetoothDeviceClient::kPairedDevicePath)); + FakeBluetoothDeviceClient::Properties* properties = + fake_bluetooth_device_client_->GetProperties( + dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath)); EXPECT_TRUE(properties->paired.value()); EXPECT_TRUE(properties->trusted.value()); ASSERT_TRUE(device->IsPaired()); @@ -2673,8 +2661,8 @@ 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( - bluez::FakeBluetoothDeviceClient::kLegacyAutopairAddress); + BluetoothDevice* device = + adapter_->GetDevice(FakeBluetoothDeviceClient::kLegacyAutopairAddress); ASSERT_TRUE(device != nullptr); ASSERT_FALSE(device->IsPaired()); @@ -2711,9 +2699,9 @@ TEST_F(BluetoothChromeOSTest, PairLegacyAutopair) { EXPECT_TRUE(device->IsConnectable()); // Make sure the trusted property has been set to true. - bluez::FakeBluetoothDeviceClient::Properties* properties = - fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath( - bluez::FakeBluetoothDeviceClient::kLegacyAutopairPath)); + FakeBluetoothDeviceClient::Properties* properties = + fake_bluetooth_device_client_->GetProperties( + dbus::ObjectPath(FakeBluetoothDeviceClient::kLegacyAutopairPath)); EXPECT_TRUE(properties->trusted.value()); } @@ -2724,8 +2712,8 @@ TEST_F(BluetoothChromeOSTest, PairDisplayPinCode) { DiscoverDevices(); // Requires that we display a randomly generated PIN on the screen. - BluetoothDevice* device = adapter_->GetDevice( - bluez::FakeBluetoothDeviceClient::kDisplayPinCodeAddress); + BluetoothDevice* device = + adapter_->GetDevice(FakeBluetoothDeviceClient::kDisplayPinCodeAddress); ASSERT_TRUE(device != nullptr); ASSERT_FALSE(device->IsPaired()); @@ -2764,9 +2752,9 @@ TEST_F(BluetoothChromeOSTest, PairDisplayPinCode) { EXPECT_TRUE(device->IsConnectable()); // Make sure the trusted property has been set to true. - bluez::FakeBluetoothDeviceClient::Properties* properties = - fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath( - bluez::FakeBluetoothDeviceClient::kDisplayPinCodePath)); + FakeBluetoothDeviceClient::Properties* properties = + fake_bluetooth_device_client_->GetProperties( + dbus::ObjectPath(FakeBluetoothDeviceClient::kDisplayPinCodePath)); EXPECT_TRUE(properties->trusted.value()); } @@ -2778,8 +2766,8 @@ 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( - bluez::FakeBluetoothDeviceClient::kDisplayPasskeyAddress); + BluetoothDevice* device = + adapter_->GetDevice(FakeBluetoothDeviceClient::kDisplayPasskeyAddress); ASSERT_TRUE(device != nullptr); ASSERT_FALSE(device->IsPaired()); @@ -2839,9 +2827,9 @@ TEST_F(BluetoothChromeOSTest, PairDisplayPasskey) { EXPECT_FALSE(device->IsConnectable()); // Make sure the trusted property has been set to true. - bluez::FakeBluetoothDeviceClient::Properties* properties = - fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath( - bluez::FakeBluetoothDeviceClient::kDisplayPasskeyPath)); + FakeBluetoothDeviceClient::Properties* properties = + fake_bluetooth_device_client_->GetProperties( + dbus::ObjectPath(FakeBluetoothDeviceClient::kDisplayPasskeyPath)); EXPECT_TRUE(properties->trusted.value()); } @@ -2852,8 +2840,8 @@ TEST_F(BluetoothChromeOSTest, PairRequestPinCode) { DiscoverDevices(); // Requires that the user enters a PIN for them. - BluetoothDevice* device = adapter_->GetDevice( - bluez::FakeBluetoothDeviceClient::kRequestPinCodeAddress); + BluetoothDevice* device = + adapter_->GetDevice(FakeBluetoothDeviceClient::kRequestPinCodeAddress); ASSERT_TRUE(device != nullptr); ASSERT_FALSE(device->IsPaired()); @@ -2893,9 +2881,9 @@ TEST_F(BluetoothChromeOSTest, PairRequestPinCode) { EXPECT_TRUE(device->IsConnectable()); // Make sure the trusted property has been set to true. - bluez::FakeBluetoothDeviceClient::Properties* properties = - fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath( - bluez::FakeBluetoothDeviceClient::kRequestPinCodePath)); + FakeBluetoothDeviceClient::Properties* properties = + fake_bluetooth_device_client_->GetProperties( + dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPinCodePath)); EXPECT_TRUE(properties->trusted.value()); } @@ -2906,8 +2894,8 @@ TEST_F(BluetoothChromeOSTest, PairConfirmPasskey) { DiscoverDevices(); // Requests that we confirm a displayed passkey. - BluetoothDevice* device = adapter_->GetDevice( - bluez::FakeBluetoothDeviceClient::kConfirmPasskeyAddress); + BluetoothDevice* device = + adapter_->GetDevice(FakeBluetoothDeviceClient::kConfirmPasskeyAddress); ASSERT_TRUE(device != nullptr); ASSERT_FALSE(device->IsPaired()); @@ -2944,9 +2932,9 @@ TEST_F(BluetoothChromeOSTest, PairConfirmPasskey) { EXPECT_TRUE(device->IsConnectable()); // Make sure the trusted property has been set to true. - bluez::FakeBluetoothDeviceClient::Properties* properties = - fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath( - bluez::FakeBluetoothDeviceClient::kConfirmPasskeyPath)); + FakeBluetoothDeviceClient::Properties* properties = + fake_bluetooth_device_client_->GetProperties( + dbus::ObjectPath(FakeBluetoothDeviceClient::kConfirmPasskeyPath)); EXPECT_TRUE(properties->trusted.value()); } @@ -2958,8 +2946,8 @@ 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( - bluez::FakeBluetoothDeviceClient::kRequestPasskeyAddress); + BluetoothDevice* device = + adapter_->GetDevice(FakeBluetoothDeviceClient::kRequestPasskeyAddress); ASSERT_TRUE(device != nullptr); ASSERT_FALSE(device->IsPaired()); @@ -2995,9 +2983,9 @@ TEST_F(BluetoothChromeOSTest, PairRequestPasskey) { EXPECT_TRUE(device->IsConnectable()); // Make sure the trusted property has been set to true. - bluez::FakeBluetoothDeviceClient::Properties* properties = - fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath( - bluez::FakeBluetoothDeviceClient::kRequestPasskeyPath)); + FakeBluetoothDeviceClient::Properties* properties = + fake_bluetooth_device_client_->GetProperties( + dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPasskeyPath)); EXPECT_TRUE(properties->trusted.value()); } @@ -3010,7 +2998,7 @@ TEST_F(BluetoothChromeOSTest, PairJustWorks) { // Uses just-works pairing, since this is an outgoing pairing, no delegate // interaction is required. BluetoothDevice* device = - adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kJustWorksAddress); + adapter_->GetDevice(FakeBluetoothDeviceClient::kJustWorksAddress); ASSERT_TRUE(device != nullptr); ASSERT_FALSE(device->IsPaired()); @@ -3042,9 +3030,9 @@ TEST_F(BluetoothChromeOSTest, PairJustWorks) { EXPECT_TRUE(device->IsConnectable()); // Make sure the trusted property has been set to true. - bluez::FakeBluetoothDeviceClient::Properties* properties = + FakeBluetoothDeviceClient::Properties* properties = fake_bluetooth_device_client_->GetProperties( - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kJustWorksPath)); + dbus::ObjectPath(FakeBluetoothDeviceClient::kJustWorksPath)); EXPECT_TRUE(properties->trusted.value()); } @@ -3052,10 +3040,10 @@ TEST_F(BluetoothChromeOSTest, PairUnpairableDeviceFails) { fake_bluetooth_device_client_->SetSimulationIntervalMs(10); GetAdapter(); - DiscoverDevice(bluez::FakeBluetoothDeviceClient::kUnconnectableDeviceAddress); + DiscoverDevice(FakeBluetoothDeviceClient::kUnconnectableDeviceAddress); - BluetoothDevice* device = adapter_->GetDevice( - bluez::FakeBluetoothDeviceClient::kUnpairableDeviceAddress); + BluetoothDevice* device = + adapter_->GetDevice(FakeBluetoothDeviceClient::kUnpairableDeviceAddress); ASSERT_TRUE(device != nullptr); ASSERT_FALSE(device->IsPaired()); @@ -3086,11 +3074,11 @@ TEST_F(BluetoothChromeOSTest, PairingFails) { fake_bluetooth_device_client_->SetSimulationIntervalMs(10); GetAdapter(); - DiscoverDevice(bluez::FakeBluetoothDeviceClient::kVanishingDeviceAddress); + DiscoverDevice(FakeBluetoothDeviceClient::kVanishingDeviceAddress); // The vanishing device times out during pairing - BluetoothDevice* device = adapter_->GetDevice( - bluez::FakeBluetoothDeviceClient::kVanishingDeviceAddress); + BluetoothDevice* device = + adapter_->GetDevice(FakeBluetoothDeviceClient::kVanishingDeviceAddress); ASSERT_TRUE(device != nullptr); ASSERT_FALSE(device->IsPaired()); @@ -3126,7 +3114,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( - bluez::FakeBluetoothDeviceClient::kUnconnectableDeviceAddress); + FakeBluetoothDeviceClient::kUnconnectableDeviceAddress); ASSERT_TRUE(device != nullptr); ASSERT_FALSE(device->IsPaired()); @@ -3158,9 +3146,9 @@ TEST_F(BluetoothChromeOSTest, PairingFailsAtConnection) { // Make sure the trusted property has been set to true still (since pairing // worked). - bluez::FakeBluetoothDeviceClient::Properties* properties = + FakeBluetoothDeviceClient::Properties* properties = fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath( - bluez::FakeBluetoothDeviceClient::kUnconnectableDevicePath)); + FakeBluetoothDeviceClient::kUnconnectableDevicePath)); EXPECT_TRUE(properties->trusted.value()); } @@ -3171,8 +3159,8 @@ TEST_F(BluetoothChromeOSTest, PairingRejectedAtPinCode) { DiscoverDevices(); // Reject the pairing after we receive a request for the PIN code. - BluetoothDevice* device = adapter_->GetDevice( - bluez::FakeBluetoothDeviceClient::kRequestPinCodeAddress); + BluetoothDevice* device = + adapter_->GetDevice(FakeBluetoothDeviceClient::kRequestPinCodeAddress); ASSERT_TRUE(device != nullptr); ASSERT_FALSE(device->IsPaired()); @@ -3209,8 +3197,8 @@ TEST_F(BluetoothChromeOSTest, PairingCancelledAtPinCode) { DiscoverDevices(); // Cancel the pairing after we receive a request for the PIN code. - BluetoothDevice* device = adapter_->GetDevice( - bluez::FakeBluetoothDeviceClient::kRequestPinCodeAddress); + BluetoothDevice* device = + adapter_->GetDevice(FakeBluetoothDeviceClient::kRequestPinCodeAddress); ASSERT_TRUE(device != nullptr); ASSERT_FALSE(device->IsPaired()); @@ -3247,8 +3235,8 @@ TEST_F(BluetoothChromeOSTest, PairingRejectedAtPasskey) { DiscoverDevices(); // Reject the pairing after we receive a request for the passkey. - BluetoothDevice* device = adapter_->GetDevice( - bluez::FakeBluetoothDeviceClient::kRequestPasskeyAddress); + BluetoothDevice* device = + adapter_->GetDevice(FakeBluetoothDeviceClient::kRequestPasskeyAddress); ASSERT_TRUE(device != nullptr); ASSERT_FALSE(device->IsPaired()); @@ -3285,8 +3273,8 @@ TEST_F(BluetoothChromeOSTest, PairingCancelledAtPasskey) { DiscoverDevices(); // Cancel the pairing after we receive a request for the passkey. - BluetoothDevice* device = adapter_->GetDevice( - bluez::FakeBluetoothDeviceClient::kRequestPasskeyAddress); + BluetoothDevice* device = + adapter_->GetDevice(FakeBluetoothDeviceClient::kRequestPasskeyAddress); ASSERT_TRUE(device != nullptr); ASSERT_FALSE(device->IsPaired()); @@ -3323,8 +3311,8 @@ TEST_F(BluetoothChromeOSTest, PairingRejectedAtConfirmation) { DiscoverDevices(); // Reject the pairing after we receive a request for passkey confirmation. - BluetoothDevice* device = adapter_->GetDevice( - bluez::FakeBluetoothDeviceClient::kConfirmPasskeyAddress); + BluetoothDevice* device = + adapter_->GetDevice(FakeBluetoothDeviceClient::kConfirmPasskeyAddress); ASSERT_TRUE(device != nullptr); ASSERT_FALSE(device->IsPaired()); @@ -3361,8 +3349,8 @@ TEST_F(BluetoothChromeOSTest, PairingCancelledAtConfirmation) { DiscoverDevices(); // Cancel the pairing after we receive a request for the passkey. - BluetoothDevice* device = adapter_->GetDevice( - bluez::FakeBluetoothDeviceClient::kConfirmPasskeyAddress); + BluetoothDevice* device = + adapter_->GetDevice(FakeBluetoothDeviceClient::kConfirmPasskeyAddress); ASSERT_TRUE(device != nullptr); ASSERT_FALSE(device->IsPaired()); @@ -3399,8 +3387,8 @@ TEST_F(BluetoothChromeOSTest, PairingCancelledInFlight) { DiscoverDevices(); // Cancel the pairing while we're waiting for the remote host. - BluetoothDevice* device = adapter_->GetDevice( - bluez::FakeBluetoothDeviceClient::kLegacyAutopairAddress); + BluetoothDevice* device = + adapter_->GetDevice(FakeBluetoothDeviceClient::kLegacyAutopairAddress); ASSERT_TRUE(device != nullptr); ASSERT_FALSE(device->IsPaired()); @@ -3441,19 +3429,19 @@ TEST_F(BluetoothChromeOSTest, IncomingPairRequestPinCode) { // Requires that we provide a PIN code. fake_bluetooth_device_client_->CreateDevice( - dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath), - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPinCodePath)); - BluetoothDevice* device = adapter_->GetDevice( - bluez::FakeBluetoothDeviceClient::kRequestPinCodeAddress); + dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), + dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPinCodePath)); + BluetoothDevice* device = + adapter_->GetDevice(FakeBluetoothDeviceClient::kRequestPinCodeAddress); ASSERT_TRUE(device != nullptr); ASSERT_FALSE(device->IsPaired()); TestBluetoothAdapterObserver observer(adapter_); fake_bluetooth_device_client_->SimulatePairing( - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPinCodePath), - true, GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback, - base::Unretained(this))); + dbus::ObjectPath(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_); @@ -3472,9 +3460,9 @@ TEST_F(BluetoothChromeOSTest, IncomingPairRequestPinCode) { EXPECT_TRUE(device->IsPaired()); // Make sure the trusted property has been set to true. - bluez::FakeBluetoothDeviceClient::Properties* properties = - fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath( - bluez::FakeBluetoothDeviceClient::kRequestPinCodePath)); + FakeBluetoothDeviceClient::Properties* properties = + fake_bluetooth_device_client_->GetProperties( + dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPinCodePath)); ASSERT_TRUE(properties->trusted.value()); // No pairing context should remain on the device. @@ -3495,19 +3483,19 @@ TEST_F(BluetoothChromeOSTest, IncomingPairConfirmPasskey) { // Requests that we confirm a displayed passkey. fake_bluetooth_device_client_->CreateDevice( - dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath), - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kConfirmPasskeyPath)); - BluetoothDevice* device = adapter_->GetDevice( - bluez::FakeBluetoothDeviceClient::kConfirmPasskeyAddress); + dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), + dbus::ObjectPath(FakeBluetoothDeviceClient::kConfirmPasskeyPath)); + BluetoothDevice* device = + adapter_->GetDevice(FakeBluetoothDeviceClient::kConfirmPasskeyAddress); ASSERT_TRUE(device != nullptr); ASSERT_FALSE(device->IsPaired()); TestBluetoothAdapterObserver observer(adapter_); fake_bluetooth_device_client_->SimulatePairing( - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kConfirmPasskeyPath), - true, GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback, - base::Unretained(this))); + dbus::ObjectPath(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_); @@ -3527,9 +3515,9 @@ TEST_F(BluetoothChromeOSTest, IncomingPairConfirmPasskey) { EXPECT_TRUE(device->IsPaired()); // Make sure the trusted property has been set to true. - bluez::FakeBluetoothDeviceClient::Properties* properties = - fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath( - bluez::FakeBluetoothDeviceClient::kConfirmPasskeyPath)); + FakeBluetoothDeviceClient::Properties* properties = + fake_bluetooth_device_client_->GetProperties( + dbus::ObjectPath(FakeBluetoothDeviceClient::kConfirmPasskeyPath)); ASSERT_TRUE(properties->trusted.value()); // No pairing context should remain on the device. @@ -3550,19 +3538,19 @@ TEST_F(BluetoothChromeOSTest, IncomingPairRequestPasskey) { // Requests that we provide a Passkey. fake_bluetooth_device_client_->CreateDevice( - dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath), - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPasskeyPath)); - BluetoothDevice* device = adapter_->GetDevice( - bluez::FakeBluetoothDeviceClient::kRequestPasskeyAddress); + dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), + dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPasskeyPath)); + BluetoothDevice* device = + adapter_->GetDevice(FakeBluetoothDeviceClient::kRequestPasskeyAddress); ASSERT_TRUE(device != nullptr); ASSERT_FALSE(device->IsPaired()); TestBluetoothAdapterObserver observer(adapter_); fake_bluetooth_device_client_->SimulatePairing( - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPasskeyPath), - true, GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback, - base::Unretained(this))); + dbus::ObjectPath(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_); @@ -3581,9 +3569,9 @@ TEST_F(BluetoothChromeOSTest, IncomingPairRequestPasskey) { EXPECT_TRUE(device->IsPaired()); // Make sure the trusted property has been set to true. - bluez::FakeBluetoothDeviceClient::Properties* properties = - fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath( - bluez::FakeBluetoothDeviceClient::kRequestPasskeyPath)); + FakeBluetoothDeviceClient::Properties* properties = + fake_bluetooth_device_client_->GetProperties( + dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPasskeyPath)); ASSERT_TRUE(properties->trusted.value()); // No pairing context should remain on the device. @@ -3605,17 +3593,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(bluez::FakeBluetoothAdapterClient::kAdapterPath), - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kJustWorksPath)); + dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), + dbus::ObjectPath(FakeBluetoothDeviceClient::kJustWorksPath)); BluetoothDevice* device = - adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kJustWorksAddress); + adapter_->GetDevice(FakeBluetoothDeviceClient::kJustWorksAddress); ASSERT_TRUE(device != nullptr); ASSERT_FALSE(device->IsPaired()); TestBluetoothAdapterObserver observer(adapter_); fake_bluetooth_device_client_->SimulatePairing( - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kJustWorksPath), true, + dbus::ObjectPath(FakeBluetoothDeviceClient::kJustWorksPath), true, GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback, base::Unretained(this))); @@ -3636,9 +3624,9 @@ TEST_F(BluetoothChromeOSTest, IncomingPairJustWorks) { EXPECT_TRUE(device->IsPaired()); // Make sure the trusted property has been set to true. - bluez::FakeBluetoothDeviceClient::Properties* properties = + FakeBluetoothDeviceClient::Properties* properties = fake_bluetooth_device_client_->GetProperties( - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kJustWorksPath)); + dbus::ObjectPath(FakeBluetoothDeviceClient::kJustWorksPath)); ASSERT_TRUE(properties->trusted.value()); // No pairing context should remain on the device. @@ -3655,19 +3643,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(bluez::FakeBluetoothAdapterClient::kAdapterPath), - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPinCodePath)); - BluetoothDevice* device = adapter_->GetDevice( - bluez::FakeBluetoothDeviceClient::kRequestPinCodeAddress); + dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), + dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPinCodePath)); + BluetoothDevice* device = + adapter_->GetDevice(FakeBluetoothDeviceClient::kRequestPinCodeAddress); ASSERT_TRUE(device != nullptr); ASSERT_FALSE(device->IsPaired()); TestBluetoothAdapterObserver observer(adapter_); fake_bluetooth_device_client_->SimulatePairing( - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPinCodePath), - true, GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback, - base::Unretained(this))); + dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPinCodePath), true, + GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback, + base::Unretained(this))); message_loop_.Run(); @@ -3694,19 +3682,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(bluez::FakeBluetoothAdapterClient::kAdapterPath), - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kConfirmPasskeyPath)); - BluetoothDevice* device = adapter_->GetDevice( - bluez::FakeBluetoothDeviceClient::kConfirmPasskeyAddress); + dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), + dbus::ObjectPath(FakeBluetoothDeviceClient::kConfirmPasskeyPath)); + BluetoothDevice* device = + adapter_->GetDevice(FakeBluetoothDeviceClient::kConfirmPasskeyAddress); ASSERT_TRUE(device != nullptr); ASSERT_FALSE(device->IsPaired()); TestBluetoothAdapterObserver observer(adapter_); fake_bluetooth_device_client_->SimulatePairing( - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kConfirmPasskeyPath), - true, GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback, - base::Unretained(this))); + dbus::ObjectPath(FakeBluetoothDeviceClient::kConfirmPasskeyPath), true, + GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback, + base::Unretained(this))); message_loop_.Run(); @@ -3733,19 +3721,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(bluez::FakeBluetoothAdapterClient::kAdapterPath), - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPasskeyPath)); - BluetoothDevice* device = adapter_->GetDevice( - bluez::FakeBluetoothDeviceClient::kRequestPasskeyAddress); + dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), + dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPasskeyPath)); + BluetoothDevice* device = + adapter_->GetDevice(FakeBluetoothDeviceClient::kRequestPasskeyAddress); ASSERT_TRUE(device != nullptr); ASSERT_FALSE(device->IsPaired()); TestBluetoothAdapterObserver observer(adapter_); fake_bluetooth_device_client_->SimulatePairing( - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPasskeyPath), - true, GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback, - base::Unretained(this))); + dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPasskeyPath), true, + GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback, + base::Unretained(this))); message_loop_.Run(); @@ -3772,17 +3760,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(bluez::FakeBluetoothAdapterClient::kAdapterPath), - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kJustWorksPath)); + dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), + dbus::ObjectPath(FakeBluetoothDeviceClient::kJustWorksPath)); BluetoothDevice* device = - adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kJustWorksAddress); + adapter_->GetDevice(FakeBluetoothDeviceClient::kJustWorksAddress); ASSERT_TRUE(device != nullptr); ASSERT_FALSE(device->IsPaired()); TestBluetoothAdapterObserver observer(adapter_); fake_bluetooth_device_client_->SimulatePairing( - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kJustWorksPath), true, + dbus::ObjectPath(FakeBluetoothDeviceClient::kJustWorksPath), true, GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback, base::Unretained(this))); @@ -3815,19 +3803,19 @@ TEST_F(BluetoothChromeOSTest, RemovePairingDelegateDuringPairing) { // Requests that we provide a Passkey. fake_bluetooth_device_client_->CreateDevice( - dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath), - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPasskeyPath)); - BluetoothDevice* device = adapter_->GetDevice( - bluez::FakeBluetoothDeviceClient::kRequestPasskeyAddress); + dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), + dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPasskeyPath)); + BluetoothDevice* device = + adapter_->GetDevice(FakeBluetoothDeviceClient::kRequestPasskeyAddress); ASSERT_TRUE(device != nullptr); ASSERT_FALSE(device->IsPaired()); TestBluetoothAdapterObserver observer(adapter_); fake_bluetooth_device_client_->SimulatePairing( - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPasskeyPath), - true, GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback, - base::Unretained(this))); + dbus::ObjectPath(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_); @@ -3858,11 +3846,11 @@ 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( - bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress); - bluez::FakeBluetoothDeviceClient::Properties* properties = - fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath( - bluez::FakeBluetoothDeviceClient::kPairedDevicePath)); + BluetoothDevice* device = + adapter_->GetDevice(FakeBluetoothDeviceClient::kPairedDeviceAddress); + FakeBluetoothDeviceClient::Properties* properties = + fake_bluetooth_device_client_->GetProperties( + dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath)); ASSERT_TRUE(device != nullptr); ASSERT_TRUE(properties != nullptr); @@ -3910,8 +3898,8 @@ TEST_F(BluetoothChromeOSTest, DeviceId) { TEST_F(BluetoothChromeOSTest, GetConnectionInfoForDisconnectedDevice) { GetAdapter(); - BluetoothDevice* device = adapter_->GetDevice( - bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress); + BluetoothDevice* device = + adapter_->GetDevice(FakeBluetoothDeviceClient::kPairedDeviceAddress); // Calling GetConnectionInfo for an unconnected device should return a result // in which all fields are filled with BluetoothDevice::kUnknownPower. @@ -3926,8 +3914,8 @@ TEST_F(BluetoothChromeOSTest, GetConnectionInfoForDisconnectedDevice) { TEST_F(BluetoothChromeOSTest, GetConnectionInfoForConnectedDevice) { GetAdapter(); - BluetoothDevice* device = adapter_->GetDevice( - bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress); + BluetoothDevice* device = + adapter_->GetDevice(FakeBluetoothDeviceClient::kPairedDeviceAddress); device->Connect(nullptr, GetCallback(), base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback, @@ -3972,9 +3960,8 @@ TEST_F(BluetoothChromeOSTest, Shutdown) { EXPECT_TRUE(adapter_->IsDiscoverable()); EXPECT_TRUE(adapter_->IsDiscovering()); EXPECT_EQ(2U, adapter_->GetDevices().size()); - EXPECT_NE(nullptr, - adapter_->GetDevice( - bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress)); + EXPECT_NE(nullptr, adapter_->GetDevice( + FakeBluetoothDeviceClient::kPairedDeviceAddress)); EXPECT_NE(dbus::ObjectPath(""), static_cast<BluetoothAdapterChromeOS*>( adapter_.get())->object_path()); @@ -4051,7 +4038,7 @@ TEST_F(BluetoothChromeOSTest, Shutdown) { FakeBluetoothProfileServiceProviderDelegate profile_delegate; adapter_chrome_os->UseProfile( BluetoothUUID(), dbus::ObjectPath(""), - bluez::BluetoothProfileManagerClient::Options(), &profile_delegate, + BluetoothProfileManagerClient::Options(), &profile_delegate, base::Bind(&BluetoothChromeOSTest::ProfileRegisteredCallback, base::Unretained(this)), base::Bind(&BluetoothChromeOSTest::ErrorCompletionCallback, @@ -4071,8 +4058,7 @@ TEST_F(BluetoothChromeOSTest, Shutdown) { adapter_chrome_os->DeviceRemoved(dbus::ObjectPath("")); adapter_chrome_os->DevicePropertyChanged(dbus::ObjectPath(""), ""); adapter_chrome_os->InputPropertyChanged(dbus::ObjectPath(""), ""); - // bluez::BluetoothAgentServiceProvider::Delegate omitted, dbus will be - // shutdown, + // BluetoothAgentServiceProvider::Delegate omitted, dbus will be shutdown, // with the exception of Released. adapter_chrome_os->Released(); @@ -4129,7 +4115,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(""), - bluez::BluetoothProfileManagerClient::Options(), &profile_delegate, + BluetoothProfileManagerClient::Options(), &profile_delegate, base::Bind(&BluetoothChromeOSTest::ProfileRegisteredCallback, base::Unretained(this)), base::Bind(&BluetoothChromeOSTest::ErrorCompletionCallback, @@ -4164,9 +4150,8 @@ TEST_F(BluetoothChromeOSTest, Shutdown) { EXPECT_EQ(1, error_callback_count_--) << "StartDiscoverySession error"; EXPECT_EQ(0U, adapter_->GetDevices().size()); - EXPECT_EQ(nullptr, - adapter_->GetDevice( - bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress)); + EXPECT_EQ(nullptr, adapter_->GetDevice( + 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 2b27d9d..07b46b7 100644 --- a/device/bluetooth/bluetooth_device_chromeos.cc +++ b/device/bluetooth/bluetooth_device_chromeos.cc @@ -11,6 +11,11 @@ #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" @@ -20,11 +25,6 @@ #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,10 @@ void ParseModalias(const dbus::ObjectPath& object_path, uint16* vendor_id, uint16* product_id, uint16* device_id) { - bluez::BluetoothDeviceClient::Properties* properties = - bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties( - object_path); + chromeos::BluetoothDeviceClient::Properties* properties = + chromeos::DBusThreadManager::Get() + ->GetBluetoothDeviceClient() + ->GetProperties(object_path); DCHECK(properties); std::string modalias = properties->modalias.value(); @@ -151,14 +152,11 @@ BluetoothDeviceChromeOS::BluetoothDeviceChromeOS( ui_task_runner_(ui_task_runner), socket_thread_(socket_thread), weak_ptr_factory_(this) { - bluez::BluezDBusManager::Get()->GetBluetoothGattServiceClient()->AddObserver( - this); + DBusThreadManager::Get()->GetBluetoothGattServiceClient()->AddObserver(this); // Add all known GATT services. const std::vector<dbus::ObjectPath> gatt_services = - bluez::BluezDBusManager::Get() - ->GetBluetoothGattServiceClient() - ->GetServices(); + DBusThreadManager::Get()->GetBluetoothGattServiceClient()->GetServices(); for (std::vector<dbus::ObjectPath>::const_iterator it = gatt_services.begin(); it != gatt_services.end(); ++it) { GattServiceAdded(*it); @@ -166,9 +164,8 @@ BluetoothDeviceChromeOS::BluetoothDeviceChromeOS( } BluetoothDeviceChromeOS::~BluetoothDeviceChromeOS() { - bluez::BluezDBusManager::Get() - ->GetBluetoothGattServiceClient() - ->RemoveObserver(this); + DBusThreadManager::Get()->GetBluetoothGattServiceClient()->RemoveObserver( + this); // Copy the GATT services list here and clear the original so that when we // send GattServiceRemoved(), GetGattServices() returns no services. @@ -184,8 +181,8 @@ BluetoothDeviceChromeOS::~BluetoothDeviceChromeOS() { } uint32 BluetoothDeviceChromeOS::GetBluetoothClass() const { - bluez::BluetoothDeviceClient::Properties* properties = - bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties( + BluetoothDeviceClient::Properties* properties = + DBusThreadManager::Get()->GetBluetoothDeviceClient()->GetProperties( object_path_); DCHECK(properties); @@ -193,8 +190,8 @@ uint32 BluetoothDeviceChromeOS::GetBluetoothClass() const { } std::string BluetoothDeviceChromeOS::GetDeviceName() const { - bluez::BluetoothDeviceClient::Properties* properties = - bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties( + BluetoothDeviceClient::Properties* properties = + DBusThreadManager::Get()->GetBluetoothDeviceClient()->GetProperties( object_path_); DCHECK(properties); @@ -214,8 +211,8 @@ void BluetoothDeviceChromeOS::DisconnectGatt() { } std::string BluetoothDeviceChromeOS::GetAddress() const { - bluez::BluetoothDeviceClient::Properties* properties = - bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties( + BluetoothDeviceClient::Properties* properties = + DBusThreadManager::Get()->GetBluetoothDeviceClient()->GetProperties( object_path_); DCHECK(properties); @@ -248,8 +245,8 @@ uint16 BluetoothDeviceChromeOS::GetDeviceID() const { } bool BluetoothDeviceChromeOS::IsPaired() const { - bluez::BluetoothDeviceClient::Properties* properties = - bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties( + BluetoothDeviceClient::Properties* properties = + DBusThreadManager::Get()->GetBluetoothDeviceClient()->GetProperties( object_path_); DCHECK(properties); @@ -260,8 +257,8 @@ bool BluetoothDeviceChromeOS::IsPaired() const { } bool BluetoothDeviceChromeOS::IsConnected() const { - bluez::BluetoothDeviceClient::Properties* properties = - bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties( + BluetoothDeviceClient::Properties* properties = + DBusThreadManager::Get()->GetBluetoothDeviceClient()->GetProperties( object_path_); DCHECK(properties); @@ -274,8 +271,8 @@ bool BluetoothDeviceChromeOS::IsGattConnected() const { } bool BluetoothDeviceChromeOS::IsConnectable() const { - bluez::BluetoothInputClient::Properties* input_properties = - bluez::BluezDBusManager::Get()->GetBluetoothInputClient()->GetProperties( + BluetoothInputClient::Properties* input_properties = + DBusThreadManager::Get()->GetBluetoothInputClient()->GetProperties( object_path_); // GetProperties returns NULL when the device does not implement the given // interface. Non HID devices are normally connectable. @@ -290,8 +287,8 @@ bool BluetoothDeviceChromeOS::IsConnecting() const { } BluetoothDeviceChromeOS::UUIDList BluetoothDeviceChromeOS::GetUUIDs() const { - bluez::BluetoothDeviceClient::Properties* properties = - bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties( + BluetoothDeviceClient::Properties* properties = + DBusThreadManager::Get()->GetBluetoothDeviceClient()->GetProperties( object_path_); DCHECK(properties); @@ -307,8 +304,8 @@ BluetoothDeviceChromeOS::UUIDList BluetoothDeviceChromeOS::GetUUIDs() const { } int16 BluetoothDeviceChromeOS::GetInquiryRSSI() const { - bluez::BluetoothDeviceClient::Properties* properties = - bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties( + BluetoothDeviceClient::Properties* properties = + DBusThreadManager::Get()->GetBluetoothDeviceClient()->GetProperties( object_path_); DCHECK(properties); @@ -319,8 +316,8 @@ int16 BluetoothDeviceChromeOS::GetInquiryRSSI() const { } int16 BluetoothDeviceChromeOS::GetInquiryTxPower() const { - bluez::BluetoothDeviceClient::Properties* properties = - bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties( + BluetoothDeviceClient::Properties* properties = + DBusThreadManager::Get()->GetBluetoothDeviceClient()->GetProperties( object_path_); DCHECK(properties); @@ -346,7 +343,7 @@ void BluetoothDeviceChromeOS::GetConnectionInfo( const ConnectionInfoCallback& callback) { // DBus method call should gracefully return an error if the device is not // currently connected. - bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetConnInfo( + DBusThreadManager::Get()->GetBluetoothDeviceClient()->GetConnInfo( object_path_, base::Bind(&BluetoothDeviceChromeOS::OnGetConnInfo, weak_ptr_factory_.GetWeakPtr(), callback), base::Bind(&BluetoothDeviceChromeOS::OnGetConnInfoError, @@ -370,7 +367,7 @@ void BluetoothDeviceChromeOS::Connect( // Initiate high-security connection with pairing. BeginPairing(pairing_delegate); - bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->Pair( + DBusThreadManager::Get()->GetBluetoothDeviceClient()->Pair( object_path_, base::Bind(&BluetoothDeviceChromeOS::OnPairDuringConnect, weak_ptr_factory_.GetWeakPtr(), callback, error_callback), @@ -386,7 +383,7 @@ void BluetoothDeviceChromeOS::Pair( DCHECK(pairing_delegate); BeginPairing(pairing_delegate); - bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->Pair( + DBusThreadManager::Get()->GetBluetoothDeviceClient()->Pair( object_path_, base::Bind(&BluetoothDeviceChromeOS::OnPair, weak_ptr_factory_.GetWeakPtr(), callback), base::Bind(&BluetoothDeviceChromeOS::OnPairError, @@ -433,7 +430,7 @@ void BluetoothDeviceChromeOS::CancelPairing() { if (!canceled) { VLOG(1) << object_path_.value() << ": No pairing context or callback. " << "Sending explicit cancel"; - bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->CancelPairing( + DBusThreadManager::Get()->GetBluetoothDeviceClient()->CancelPairing( object_path_, base::Bind(&base::DoNothing), base::Bind(&BluetoothDeviceChromeOS::OnCancelPairingError, weak_ptr_factory_.GetWeakPtr())); @@ -449,7 +446,7 @@ void BluetoothDeviceChromeOS::CancelPairing() { void BluetoothDeviceChromeOS::Disconnect(const base::Closure& callback, const ErrorCallback& error_callback) { VLOG(1) << object_path_.value() << ": Disconnecting"; - bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->Disconnect( + DBusThreadManager::Get()->GetBluetoothDeviceClient()->Disconnect( object_path_, base::Bind(&BluetoothDeviceChromeOS::OnDisconnect, weak_ptr_factory_.GetWeakPtr(), callback), base::Bind(&BluetoothDeviceChromeOS::OnDisconnectError, @@ -458,7 +455,7 @@ void BluetoothDeviceChromeOS::Disconnect(const base::Closure& callback, void BluetoothDeviceChromeOS::Forget(const ErrorCallback& error_callback) { VLOG(1) << object_path_.value() << ": Removing device"; - bluez::BluezDBusManager::Get()->GetBluetoothAdapterClient()->RemoveDevice( + DBusThreadManager::Get()->GetBluetoothAdapterClient()->RemoveDevice( adapter()->object_path(), object_path_, base::Bind(&base::DoNothing), base::Bind(&BluetoothDeviceChromeOS::OnForgetError, weak_ptr_factory_.GetWeakPtr(), error_callback)); @@ -537,10 +534,9 @@ void BluetoothDeviceChromeOS::GattServiceAdded( return; } - bluez::BluetoothGattServiceClient::Properties* properties = - bluez::BluezDBusManager::Get() - ->GetBluetoothGattServiceClient() - ->GetProperties(object_path); + BluetoothGattServiceClient::Properties* properties = + DBusThreadManager::Get()->GetBluetoothGattServiceClient()->GetProperties( + object_path); DCHECK(properties); if (properties->device.value() != object_path_) { VLOG(2) << "Remote GATT service does not belong to this device."; @@ -607,7 +603,7 @@ void BluetoothDeviceChromeOS::ConnectInternal( const base::Closure& callback, const ConnectErrorCallback& error_callback) { VLOG(1) << object_path_.value() << ": Connecting"; - bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->Connect( + DBusThreadManager::Get()->GetBluetoothDeviceClient()->Connect( object_path_, base::Bind(&BluetoothDeviceChromeOS::OnConnect, weak_ptr_factory_.GetWeakPtr(), after_pairing, callback), @@ -735,7 +731,7 @@ 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. - bluez::BluezDBusManager::Get() + DBusThreadManager::Get() ->GetBluetoothDeviceClient() ->GetProperties(object_path_) ->trusted.Set(true, base::Bind(&BluetoothDeviceChromeOS::OnSetTrusted, diff --git a/device/bluetooth/bluetooth_device_chromeos.h b/device/bluetooth/bluetooth_device_chromeos.h index 358b1cd..7f66a43 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 bluez::BluetoothGattServiceClient::Observer { + public BluetoothGattServiceClient::Observer { public: // BluetoothDevice override uint32 GetBluetoothClass() const override; @@ -118,7 +118,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceChromeOS scoped_refptr<device::BluetoothSocketThread> socket_thread); ~BluetoothDeviceChromeOS() override; - // bluez::BluetoothGattServiceClient::Observer overrides. + // 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 cc5860d..24eebaf 100644 --- a/device/bluetooth/bluetooth_gatt_chromeos_unittest.cc +++ b/device/bluetooth/bluetooth_gatt_chromeos_unittest.cc @@ -5,6 +5,14 @@ #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" @@ -15,14 +23,6 @@ #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( - bluez::FakeBluetoothGattCharacteristicClient::kHeartRateMeasurementUUID); + FakeBluetoothGattCharacteristicClient::kHeartRateMeasurementUUID); const BluetoothUUID kBodySensorLocationUUID( - bluez::FakeBluetoothGattCharacteristicClient::kBodySensorLocationUUID); + FakeBluetoothGattCharacteristicClient::kBodySensorLocationUUID); const BluetoothUUID kHeartRateControlPointUUID( - bluez::FakeBluetoothGattCharacteristicClient::kHeartRateControlPointUUID); + FakeBluetoothGattCharacteristicClient::kHeartRateControlPointUUID); // Compares GATT characteristic/descriptor values. Returns true, if the values // are equal. @@ -70,36 +70,32 @@ class BluetoothGattChromeOSTest : public testing::Test { } void SetUp() override { - scoped_ptr<bluez::BluezDBusManagerSetter> dbus_setter = - bluez::BluezDBusManager::GetSetterForTesting(); - fake_bluetooth_device_client_ = new bluez::FakeBluetoothDeviceClient; - fake_bluetooth_gatt_service_client_ = - new bluez::FakeBluetoothGattServiceClient; + scoped_ptr<DBusThreadManagerSetter> dbus_setter = + chromeos::DBusThreadManager::GetSetterForTesting(); + fake_bluetooth_device_client_ = new FakeBluetoothDeviceClient; + fake_bluetooth_gatt_service_client_ = new FakeBluetoothGattServiceClient; fake_bluetooth_gatt_characteristic_client_ = - new bluez::FakeBluetoothGattCharacteristicClient; + new FakeBluetoothGattCharacteristicClient; fake_bluetooth_gatt_descriptor_client_ = - new bluez::FakeBluetoothGattDescriptorClient; + new FakeBluetoothGattDescriptorClient; dbus_setter->SetBluetoothDeviceClient( - scoped_ptr<bluez::BluetoothDeviceClient>( - fake_bluetooth_device_client_)); + scoped_ptr<BluetoothDeviceClient>(fake_bluetooth_device_client_)); dbus_setter->SetBluetoothGattServiceClient( - scoped_ptr<bluez::BluetoothGattServiceClient>( + scoped_ptr<BluetoothGattServiceClient>( fake_bluetooth_gatt_service_client_)); dbus_setter->SetBluetoothGattCharacteristicClient( - scoped_ptr<bluez::BluetoothGattCharacteristicClient>( + scoped_ptr<BluetoothGattCharacteristicClient>( fake_bluetooth_gatt_characteristic_client_)); dbus_setter->SetBluetoothGattDescriptorClient( - scoped_ptr<bluez::BluetoothGattDescriptorClient>( + scoped_ptr<BluetoothGattDescriptorClient>( fake_bluetooth_gatt_descriptor_client_)); dbus_setter->SetBluetoothAdapterClient( - scoped_ptr<bluez::BluetoothAdapterClient>( - new bluez::FakeBluetoothAdapterClient)); + scoped_ptr<BluetoothAdapterClient>(new FakeBluetoothAdapterClient)); dbus_setter->SetBluetoothInputClient( - scoped_ptr<bluez::BluetoothInputClient>( - new bluez::FakeBluetoothInputClient)); + scoped_ptr<BluetoothInputClient>(new FakeBluetoothInputClient)); dbus_setter->SetBluetoothAgentManagerClient( - scoped_ptr<bluez::BluetoothAgentManagerClient>( - new bluez::FakeBluetoothAgentManagerClient)); + scoped_ptr<BluetoothAgentManagerClient>( + new FakeBluetoothAgentManagerClient)); GetAdapter(); @@ -114,7 +110,7 @@ class BluetoothGattChromeOSTest : public testing::Test { adapter_ = NULL; update_sessions_.clear(); gatt_conn_.reset(); - bluez::BluezDBusManager::Shutdown(); + DBusThreadManager::Shutdown(); } void GetAdapter() { @@ -177,12 +173,11 @@ class BluetoothGattChromeOSTest : public testing::Test { base::MessageLoop message_loop_; - bluez::FakeBluetoothDeviceClient* fake_bluetooth_device_client_; - bluez::FakeBluetoothGattServiceClient* fake_bluetooth_gatt_service_client_; - bluez::FakeBluetoothGattCharacteristicClient* + FakeBluetoothDeviceClient* fake_bluetooth_device_client_; + FakeBluetoothGattServiceClient* fake_bluetooth_gatt_service_client_; + FakeBluetoothGattCharacteristicClient* fake_bluetooth_gatt_characteristic_client_; - bluez::FakeBluetoothGattDescriptorClient* - fake_bluetooth_gatt_descriptor_client_; + FakeBluetoothGattDescriptorClient* fake_bluetooth_gatt_descriptor_client_; scoped_ptr<device::BluetoothGattConnection> gatt_conn_; ScopedVector<BluetoothGattNotifySession> update_sessions_; scoped_refptr<BluetoothAdapter> adapter_; @@ -195,10 +190,10 @@ class BluetoothGattChromeOSTest : public testing::Test { TEST_F(BluetoothGattChromeOSTest, GattConnection) { fake_bluetooth_device_client_->CreateDevice( - dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath), - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); + dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), + dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath)); BluetoothDevice* device = - adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress); + adapter_->GetDevice(FakeBluetoothDeviceClient::kLowEnergyAddress); ASSERT_TRUE(device); ASSERT_FALSE(device->IsConnected()); ASSERT_FALSE(gatt_conn_.get()); @@ -216,7 +211,7 @@ TEST_F(BluetoothGattChromeOSTest, GattConnection) { EXPECT_TRUE(device->IsConnected()); ASSERT_TRUE(gatt_conn_.get()); EXPECT_TRUE(gatt_conn_->IsConnected()); - EXPECT_EQ(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress, + EXPECT_EQ(FakeBluetoothDeviceClient::kLowEnergyAddress, gatt_conn_->GetDeviceAddress()); gatt_conn_->Disconnect(); @@ -258,8 +253,8 @@ TEST_F(BluetoothGattChromeOSTest, GattConnection) { EXPECT_TRUE(gatt_conn_->IsConnected()); fake_bluetooth_device_client_->RemoveDevice( - dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath), - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); + dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), + dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath)); ASSERT_TRUE(gatt_conn_.get()); EXPECT_FALSE(gatt_conn_->IsConnected()); } @@ -268,10 +263,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(bluez::FakeBluetoothAdapterClient::kAdapterPath), - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); + dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), + dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath)); BluetoothDevice* device = - adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress); + adapter_->GetDevice(FakeBluetoothDeviceClient::kLowEnergyAddress); ASSERT_TRUE(device); TestBluetoothAdapterObserver observer(adapter_); @@ -284,14 +279,14 @@ TEST_F(BluetoothGattChromeOSTest, GattServiceAddedAndRemoved) { // Expose the fake Heart Rate Service. fake_bluetooth_gatt_service_client_->ExposeHeartRateService( - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); + dbus::ObjectPath(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( - bluez::FakeBluetoothGattServiceClient::kHeartRateServiceUUID), - observer.last_gatt_service_uuid()); + EXPECT_EQ( + BluetoothUUID(FakeBluetoothGattServiceClient::kHeartRateServiceUUID), + observer.last_gatt_service_uuid()); BluetoothGattService* service = device->GetGattService(observer.last_gatt_service_id()); @@ -311,9 +306,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( - bluez::FakeBluetoothGattServiceClient::kHeartRateServiceUUID), - observer.last_gatt_service_uuid()); + EXPECT_EQ( + BluetoothUUID(FakeBluetoothGattServiceClient::kHeartRateServiceUUID), + observer.last_gatt_service_uuid()); EXPECT_EQ(NULL, device->GetGattService(observer.last_gatt_service_id())); @@ -321,14 +316,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(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); + dbus::ObjectPath(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( - bluez::FakeBluetoothGattServiceClient::kHeartRateServiceUUID), - observer.last_gatt_service_uuid()); + EXPECT_EQ( + BluetoothUUID(FakeBluetoothGattServiceClient::kHeartRateServiceUUID), + observer.last_gatt_service_uuid()); // The object |service| points to should have been deallocated. |device| // should contain a brand new instance. @@ -344,25 +339,25 @@ TEST_F(BluetoothGattChromeOSTest, GattServiceAddedAndRemoved) { observer.last_gatt_service_uuid() = BluetoothUUID(); observer.last_gatt_service_id().clear(); fake_bluetooth_device_client_->RemoveDevice( - dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath), - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); + dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), + dbus::ObjectPath(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( - bluez::FakeBluetoothGattServiceClient::kHeartRateServiceUUID), - observer.last_gatt_service_uuid()); - EXPECT_EQ(NULL, adapter_->GetDevice( - bluez::FakeBluetoothDeviceClient::kLowEnergyAddress)); + EXPECT_EQ( + BluetoothUUID(FakeBluetoothGattServiceClient::kHeartRateServiceUUID), + observer.last_gatt_service_uuid()); + EXPECT_EQ(NULL, + adapter_->GetDevice(FakeBluetoothDeviceClient::kLowEnergyAddress)); } TEST_F(BluetoothGattChromeOSTest, GattCharacteristicAddedAndRemoved) { fake_bluetooth_device_client_->CreateDevice( - dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath), - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); + dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), + dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath)); BluetoothDevice* device = - adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress); + adapter_->GetDevice(FakeBluetoothDeviceClient::kLowEnergyAddress); ASSERT_TRUE(device); TestBluetoothAdapterObserver observer(adapter_); @@ -370,7 +365,7 @@ TEST_F(BluetoothGattChromeOSTest, GattCharacteristicAddedAndRemoved) { // Expose the fake Heart Rate service. This will asynchronously expose // characteristics. fake_bluetooth_gatt_service_client_->ExposeHeartRateService( - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); + dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath)); ASSERT_EQ(1, observer.gatt_service_added_count()); BluetoothGattService* service = @@ -427,10 +422,10 @@ TEST_F(BluetoothGattChromeOSTest, GattCharacteristicAddedAndRemoved) { TEST_F(BluetoothGattChromeOSTest, GattDescriptorAddedAndRemoved) { fake_bluetooth_device_client_->CreateDevice( - dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath), - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); + dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), + dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath)); BluetoothDevice* device = - adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress); + adapter_->GetDevice(FakeBluetoothDeviceClient::kLowEnergyAddress); ASSERT_TRUE(device); TestBluetoothAdapterObserver observer(adapter_); @@ -438,7 +433,7 @@ TEST_F(BluetoothGattChromeOSTest, GattDescriptorAddedAndRemoved) { // Expose the fake Heart Rate service. This will asynchronously expose // characteristics. fake_bluetooth_gatt_service_client_->ExposeHeartRateService( - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); + dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath)); ASSERT_EQ(1, observer.gatt_service_added_count()); BluetoothGattService* service = @@ -499,7 +494,7 @@ TEST_F(BluetoothGattChromeOSTest, GattDescriptorAddedAndRemoved) { observer.last_gatt_descriptor_uuid() = BluetoothUUID(); fake_bluetooth_gatt_descriptor_client_->ExposeDescriptor( dbus::ObjectPath(characteristic->GetIdentifier()), - bluez::FakeBluetoothGattDescriptorClient:: + FakeBluetoothGattDescriptorClient:: kClientCharacteristicConfigurationUUID); EXPECT_EQ(0, observer.gatt_service_changed_count()); EXPECT_EQ(1U, characteristic->GetDescriptors().size()); @@ -523,10 +518,10 @@ TEST_F(BluetoothGattChromeOSTest, AdapterAddedAfterGattService) { // Create the fake D-Bus objects. fake_bluetooth_device_client_->CreateDevice( - dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath), - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); + dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), + dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath)); fake_bluetooth_gatt_service_client_->ExposeHeartRateService( - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); + dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath)); while (!fake_bluetooth_gatt_characteristic_client_->IsHeartRateVisible()) base::RunLoop().RunUntilIdle(); ASSERT_TRUE(fake_bluetooth_gatt_service_client_->IsHeartRateVisible()); @@ -535,7 +530,7 @@ TEST_F(BluetoothGattChromeOSTest, AdapterAddedAfterGattService) { // Create the adapter. This should create all the GATT objects. GetAdapter(); BluetoothDevice* device = - adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress); + adapter_->GetDevice(FakeBluetoothDeviceClient::kLowEnergyAddress); ASSERT_TRUE(device); EXPECT_EQ(1U, device->GetGattServices().size()); @@ -543,9 +538,9 @@ TEST_F(BluetoothGattChromeOSTest, AdapterAddedAfterGattService) { ASSERT_TRUE(service); EXPECT_FALSE(service->IsLocal()); EXPECT_TRUE(service->IsPrimary()); - EXPECT_EQ(BluetoothUUID( - bluez::FakeBluetoothGattServiceClient::kHeartRateServiceUUID), - service->GetUUID()); + EXPECT_EQ( + BluetoothUUID(FakeBluetoothGattServiceClient::kHeartRateServiceUUID), + service->GetUUID()); EXPECT_EQ(service, device->GetGattServices()[0]); EXPECT_EQ(service, device->GetGattService(service->GetIdentifier())); EXPECT_FALSE(service->IsLocal()); @@ -555,8 +550,8 @@ TEST_F(BluetoothGattChromeOSTest, AdapterAddedAfterGattService) { fake_bluetooth_gatt_characteristic_client_-> GetBodySensorLocationPath().value()); ASSERT_TRUE(characteristic); - EXPECT_EQ(BluetoothUUID(bluez::FakeBluetoothGattCharacteristicClient:: - kBodySensorLocationUUID), + EXPECT_EQ(BluetoothUUID( + FakeBluetoothGattCharacteristicClient::kBodySensorLocationUUID), characteristic->GetUUID()); EXPECT_FALSE(characteristic->IsLocal()); EXPECT_TRUE(characteristic->GetDescriptors().empty()); @@ -565,9 +560,10 @@ TEST_F(BluetoothGattChromeOSTest, AdapterAddedAfterGattService) { fake_bluetooth_gatt_characteristic_client_-> GetHeartRateControlPointPath().value()); ASSERT_TRUE(characteristic); - EXPECT_EQ(BluetoothUUID(bluez::FakeBluetoothGattCharacteristicClient:: - kHeartRateControlPointUUID), - characteristic->GetUUID()); + EXPECT_EQ( + BluetoothUUID( + FakeBluetoothGattCharacteristicClient::kHeartRateControlPointUUID), + characteristic->GetUUID()); EXPECT_FALSE(characteristic->IsLocal()); EXPECT_TRUE(characteristic->GetDescriptors().empty()); @@ -575,9 +571,10 @@ TEST_F(BluetoothGattChromeOSTest, AdapterAddedAfterGattService) { fake_bluetooth_gatt_characteristic_client_-> GetHeartRateMeasurementPath().value()); ASSERT_TRUE(characteristic); - EXPECT_EQ(BluetoothUUID(bluez::FakeBluetoothGattCharacteristicClient:: - kHeartRateMeasurementUUID), - characteristic->GetUUID()); + EXPECT_EQ( + BluetoothUUID( + FakeBluetoothGattCharacteristicClient::kHeartRateMeasurementUUID), + characteristic->GetUUID()); EXPECT_FALSE(characteristic->IsLocal()); EXPECT_EQ(1U, characteristic->GetDescriptors().size()); @@ -590,10 +587,10 @@ TEST_F(BluetoothGattChromeOSTest, AdapterAddedAfterGattService) { TEST_F(BluetoothGattChromeOSTest, GattCharacteristicValue) { fake_bluetooth_device_client_->CreateDevice( - dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath), - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); + dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), + dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath)); BluetoothDevice* device = - adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress); + adapter_->GetDevice(FakeBluetoothDeviceClient::kLowEnergyAddress); ASSERT_TRUE(device); TestBluetoothAdapterObserver observer(adapter_); @@ -601,7 +598,7 @@ TEST_F(BluetoothGattChromeOSTest, GattCharacteristicValue) { // Expose the fake Heart Rate service. This will asynchronously expose // characteristics. fake_bluetooth_gatt_service_client_->ExposeHeartRateService( - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); + dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath)); ASSERT_EQ(1, observer.gatt_service_added_count()); BluetoothGattService* service = @@ -805,10 +802,10 @@ TEST_F(BluetoothGattChromeOSTest, GattCharacteristicValue) { TEST_F(BluetoothGattChromeOSTest, GattCharacteristicProperties) { fake_bluetooth_device_client_->CreateDevice( - dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath), - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); + dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), + dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath)); BluetoothDevice* device = - adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress); + adapter_->GetDevice(FakeBluetoothDeviceClient::kLowEnergyAddress); ASSERT_TRUE(device); TestBluetoothAdapterObserver observer(adapter_); @@ -816,7 +813,7 @@ TEST_F(BluetoothGattChromeOSTest, GattCharacteristicProperties) { // Expose the fake Heart Rate service. This will asynchronously expose // characteristics. fake_bluetooth_gatt_service_client_->ExposeHeartRateService( - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); + dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath)); BluetoothGattService* service = device->GetGattService(observer.last_gatt_service_id()); @@ -847,10 +844,10 @@ TEST_F(BluetoothGattChromeOSTest, GattCharacteristicProperties) { TEST_F(BluetoothGattChromeOSTest, GattDescriptorValue) { fake_bluetooth_device_client_->CreateDevice( - dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath), - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); + dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), + dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath)); BluetoothDevice* device = - adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress); + adapter_->GetDevice(FakeBluetoothDeviceClient::kLowEnergyAddress); ASSERT_TRUE(device); TestBluetoothAdapterObserver observer(adapter_); @@ -858,7 +855,7 @@ TEST_F(BluetoothGattChromeOSTest, GattDescriptorValue) { // Expose the fake Heart Rate service. This will asynchronously expose // characteristics. fake_bluetooth_gatt_service_client_->ExposeHeartRateService( - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); + dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath)); ASSERT_EQ(1, observer.gatt_service_added_count()); BluetoothGattService* service = @@ -970,10 +967,10 @@ TEST_F(BluetoothGattChromeOSTest, GattDescriptorValue) { TEST_F(BluetoothGattChromeOSTest, NotifySessions) { fake_bluetooth_device_client_->CreateDevice( - dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath), - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); + dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), + dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath)); BluetoothDevice* device = - adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress); + adapter_->GetDevice(FakeBluetoothDeviceClient::kLowEnergyAddress); ASSERT_TRUE(device); TestBluetoothAdapterObserver observer(adapter_); @@ -981,7 +978,7 @@ TEST_F(BluetoothGattChromeOSTest, NotifySessions) { // Expose the fake Heart Rate service. This will asynchronously expose // characteristics. fake_bluetooth_gatt_service_client_->ExposeHeartRateService( - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); + dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath)); ASSERT_EQ(1, observer.gatt_service_added_count()); BluetoothGattService* service = @@ -1119,10 +1116,10 @@ TEST_F(BluetoothGattChromeOSTest, NotifySessions) { TEST_F(BluetoothGattChromeOSTest, NotifySessionsMadeInactive) { fake_bluetooth_device_client_->CreateDevice( - dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath), - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); + dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), + dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath)); BluetoothDevice* device = - adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress); + adapter_->GetDevice(FakeBluetoothDeviceClient::kLowEnergyAddress); ASSERT_TRUE(device); TestBluetoothAdapterObserver observer(adapter_); @@ -1130,7 +1127,7 @@ TEST_F(BluetoothGattChromeOSTest, NotifySessionsMadeInactive) { // Expose the fake Heart Rate service. This will asynchronously expose // characteristics. fake_bluetooth_gatt_service_client_->ExposeHeartRateService( - dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); + dbus::ObjectPath(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 57aaa4d..6c16db8 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,12 +23,11 @@ BluetoothGattConnectionChromeOS::BluetoothGattConnectionChromeOS( DCHECK(!device_address_.empty()); DCHECK(object_path_.IsValid()); - bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->AddObserver(this); + DBusThreadManager::Get()->GetBluetoothDeviceClient()->AddObserver(this); } BluetoothGattConnectionChromeOS::~BluetoothGattConnectionChromeOS() { - bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->RemoveObserver( - this); + DBusThreadManager::Get()->GetBluetoothDeviceClient()->RemoveObserver(this); Disconnect(); } @@ -41,8 +40,8 @@ bool BluetoothGattConnectionChromeOS::IsConnected() { if (!connected_) return false; - bluez::BluetoothDeviceClient::Properties* properties = - bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties( + BluetoothDeviceClient::Properties* properties = + DBusThreadManager::Get()->GetBluetoothDeviceClient()->GetProperties( object_path_); if (!properties || !properties->connected.value()) connected_ = false; @@ -83,8 +82,8 @@ void BluetoothGattConnectionChromeOS::DevicePropertyChanged( if (!connected_) return; - bluez::BluetoothDeviceClient::Properties* properties = - bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties( + BluetoothDeviceClient::Properties* properties = + DBusThreadManager::Get()->GetBluetoothDeviceClient()->GetProperties( object_path_); if (!properties) { diff --git a/device/bluetooth/bluetooth_gatt_connection_chromeos.h b/device/bluetooth/bluetooth_gatt_connection_chromeos.h index 6e40283..66c1a1a 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 { @@ -23,9 +23,8 @@ namespace chromeos { // BluetoothGattConnectionChromeOS implements BluetoothGattConnection for the // Chrome OS platform. -class BluetoothGattConnectionChromeOS - : public device::BluetoothGattConnection, - public bluez::BluetoothDeviceClient::Observer { +class BluetoothGattConnectionChromeOS : public device::BluetoothGattConnection, + public BluetoothDeviceClient::Observer { public: explicit BluetoothGattConnectionChromeOS( scoped_refptr<device::BluetoothAdapter> adapter, @@ -38,7 +37,7 @@ class BluetoothGattConnectionChromeOS void Disconnect() override; private: - // bluez::Bluetooth$1Client::Observer overrides. + // chromeos::BluetoothDeviceClient::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 02f7ed8..ba7b843 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,13 +32,12 @@ BluetoothGattNotifySessionChromeOS::BluetoothGattNotifySessionChromeOS( DCHECK(!characteristic_id_.empty()); DCHECK(object_path_.IsValid()); - bluez::BluezDBusManager::Get() - ->GetBluetoothGattCharacteristicClient() - ->AddObserver(this); + DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient()->AddObserver( + this); } BluetoothGattNotifySessionChromeOS::~BluetoothGattNotifySessionChromeOS() { - bluez::BluezDBusManager::Get() + DBusThreadManager::Get() ->GetBluetoothGattCharacteristicClient() ->RemoveObserver(this); Stop(base::Bind(&base::DoNothing)); @@ -59,12 +58,11 @@ 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 - // bluez::BluetoothGattCharacteristicClient::Observer implementation, which - // was + // BluetoothGattCharacteristicClient::Observer implementation, which was // called before ours). Check the client to see if notifications are still // being sent. - bluez::BluetoothGattCharacteristicClient::Properties* properties = - bluez::BluezDBusManager::Get() + BluetoothGattCharacteristicClient::Properties* properties = + DBusThreadManager::Get() ->GetBluetoothGattCharacteristicClient() ->GetProperties(object_path_); if (!properties || !properties->notifying.value()) @@ -117,8 +115,8 @@ void BluetoothGattNotifySessionChromeOS::GattCharacteristicPropertyChanged( if (!active_) return; - bluez::BluetoothGattCharacteristicClient::Properties* properties = - bluez::BluezDBusManager::Get() + BluetoothGattCharacteristicClient::Properties* properties = + DBusThreadManager::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 ef6e8da..245a72f 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 bluez::BluetoothGattCharacteristicClient::Observer { + public BluetoothGattCharacteristicClient::Observer { public: ~BluetoothGattNotifySessionChromeOS() override; @@ -44,7 +44,7 @@ class BluetoothGattNotifySessionChromeOS const std::string& characteristic_identifier, const dbus::ObjectPath& characteristic_path); - // bluez::BluetoothGattCharacteristicClient::Observer overrides. + // 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 c69bc94..2bc67cb 100644 --- a/device/bluetooth/bluetooth_pairing_chromeos.cc +++ b/device/bluetooth/bluetooth_pairing_chromeos.cc @@ -55,26 +55,25 @@ BluetoothPairingChromeOS::~BluetoothPairingChromeOS() { } if (!pincode_callback_.is_null()) { - pincode_callback_.Run( - bluez::BluetoothAgentServiceProvider::Delegate::CANCELLED, ""); + pincode_callback_.Run(BluetoothAgentServiceProvider::Delegate::CANCELLED, + ""); } if (!passkey_callback_.is_null()) { - passkey_callback_.Run( - bluez::BluetoothAgentServiceProvider::Delegate::CANCELLED, 0); + passkey_callback_.Run(BluetoothAgentServiceProvider::Delegate::CANCELLED, + 0); } if (!confirmation_callback_.is_null()) { confirmation_callback_.Run( - bluez::BluetoothAgentServiceProvider::Delegate::CANCELLED); + BluetoothAgentServiceProvider::Delegate::CANCELLED); } pairing_delegate_ = NULL; } void BluetoothPairingChromeOS::RequestPinCode( - const bluez::BluetoothAgentServiceProvider::Delegate::PinCodeCallback& - callback) { + const BluetoothAgentServiceProvider::Delegate::PinCodeCallback& callback) { UMA_HISTOGRAM_ENUMERATION("Bluetooth.PairingMethod", UMA_PAIRING_METHOD_REQUEST_PINCODE, UMA_PAIRING_METHOD_COUNT); @@ -93,7 +92,7 @@ void BluetoothPairingChromeOS::SetPinCode(const std::string& pincode) { if (pincode_callback_.is_null()) return; - pincode_callback_.Run(bluez::BluetoothAgentServiceProvider::Delegate::SUCCESS, + pincode_callback_.Run(BluetoothAgentServiceProvider::Delegate::SUCCESS, pincode); pincode_callback_.Reset(); @@ -121,8 +120,7 @@ void BluetoothPairingChromeOS::DisplayPinCode(const std::string& pincode) { } void BluetoothPairingChromeOS::RequestPasskey( - const bluez::BluetoothAgentServiceProvider::Delegate::PasskeyCallback& - callback) { + const BluetoothAgentServiceProvider::Delegate::PasskeyCallback& callback) { UMA_HISTOGRAM_ENUMERATION("Bluetooth.PairingMethod", UMA_PAIRING_METHOD_REQUEST_PASSKEY, UMA_PAIRING_METHOD_COUNT); @@ -141,7 +139,7 @@ void BluetoothPairingChromeOS::SetPasskey(uint32 passkey) { if (passkey_callback_.is_null()) return; - passkey_callback_.Run(bluez::BluetoothAgentServiceProvider::Delegate::SUCCESS, + passkey_callback_.Run(BluetoothAgentServiceProvider::Delegate::SUCCESS, passkey); passkey_callback_.Reset(); @@ -176,7 +174,7 @@ void BluetoothPairingChromeOS::KeysEntered(uint16 entered) { void BluetoothPairingChromeOS::RequestConfirmation( uint32 passkey, - const bluez::BluetoothAgentServiceProvider::Delegate::ConfirmationCallback& + const BluetoothAgentServiceProvider::Delegate::ConfirmationCallback& callback) { UMA_HISTOGRAM_ENUMERATION("Bluetooth.PairingMethod", UMA_PAIRING_METHOD_CONFIRM_PASSKEY, @@ -189,7 +187,7 @@ void BluetoothPairingChromeOS::RequestConfirmation( } void BluetoothPairingChromeOS::RequestAuthorization( - const bluez::BluetoothAgentServiceProvider::Delegate::ConfirmationCallback& + const BluetoothAgentServiceProvider::Delegate::ConfirmationCallback& callback) { UMA_HISTOGRAM_ENUMERATION("Bluetooth.PairingMethod", UMA_PAIRING_METHOD_NONE, @@ -209,8 +207,7 @@ void BluetoothPairingChromeOS::ConfirmPairing() { if (confirmation_callback_.is_null()) return; - confirmation_callback_.Run( - bluez::BluetoothAgentServiceProvider::Delegate::SUCCESS); + confirmation_callback_.Run(BluetoothAgentServiceProvider::Delegate::SUCCESS); confirmation_callback_.Reset(); // If this is not an outgoing connection to the device, clean up the pairing @@ -221,13 +218,12 @@ void BluetoothPairingChromeOS::ConfirmPairing() { } bool BluetoothPairingChromeOS::RejectPairing() { - return RunPairingCallbacks( - bluez::BluetoothAgentServiceProvider::Delegate::REJECTED); + return RunPairingCallbacks(BluetoothAgentServiceProvider::Delegate::REJECTED); } bool BluetoothPairingChromeOS::CancelPairing() { return RunPairingCallbacks( - bluez::BluetoothAgentServiceProvider::Delegate::CANCELLED); + BluetoothAgentServiceProvider::Delegate::CANCELLED); } BluetoothDevice::PairingDelegate* @@ -242,7 +238,7 @@ void BluetoothPairingChromeOS::ResetCallbacks() { } bool BluetoothPairingChromeOS::RunPairingCallbacks( - bluez::BluetoothAgentServiceProvider::Delegate::Status status) { + 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 0a4ddb6..b50a328 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,8 +36,7 @@ class BluetoothPairingChromeOS { // calls on this object are translated into the appropriate response to // |callback|. void RequestPinCode( - const bluez::BluetoothAgentServiceProvider::Delegate::PinCodeCallback& - callback); + const BluetoothAgentServiceProvider::Delegate::PinCodeCallback& callback); // Indicates whether the device is currently pairing and expecting a // PIN Code to be returned. @@ -58,8 +57,7 @@ class BluetoothPairingChromeOS { // calls on this object are translated into the appropriate response to // |callback|. void RequestPasskey( - const bluez::BluetoothAgentServiceProvider::Delegate::PasskeyCallback& - callback); + const BluetoothAgentServiceProvider::Delegate::PasskeyCallback& callback); // Sends the Passkey |passkey| to the remote device during pairing. // @@ -81,16 +79,18 @@ 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 bluez::BluetoothAgentServiceProvider:: - Delegate::ConfirmationCallback& callback); + void RequestConfirmation( + uint32 passkey, + const 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 bluez::BluetoothAgentServiceProvider:: - Delegate::ConfirmationCallback& callback); + void RequestAuthorization( + const 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( - bluez::BluetoothAgentServiceProvider::Delegate::Status status); + BluetoothAgentServiceProvider::Delegate::Status status); // The underlying BluetoothDeviceChromeOS that owns this pairing context. BluetoothDeviceChromeOS* device_; @@ -131,13 +131,11 @@ class BluetoothPairingChromeOS { // During pairing these callbacks are set to those provided by method calls // made on the BluetoothAdapterChromeOS instance by its respective - // bluez::BluetoothAgentServiceProvider instance, and are called by our own + // BluetoothAgentServiceProvider instance, and are called by our own // method calls such as SetPinCode() and SetPasskey(). - bluez::BluetoothAgentServiceProvider::Delegate::PinCodeCallback - pincode_callback_; - bluez::BluetoothAgentServiceProvider::Delegate::PasskeyCallback - passkey_callback_; - bluez::BluetoothAgentServiceProvider::Delegate::ConfirmationCallback + BluetoothAgentServiceProvider::Delegate::PinCodeCallback pincode_callback_; + BluetoothAgentServiceProvider::Delegate::PasskeyCallback passkey_callback_; + 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 7374f16..7a0f5e3 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,12 @@ BluetoothRemoteGattCharacteristicChromeOS:: weak_ptr_factory_(this) { VLOG(1) << "Creating remote GATT characteristic with identifier: " << GetIdentifier() << ", UUID: " << GetUUID().canonical_value(); - bluez::BluezDBusManager::Get() - ->GetBluetoothGattDescriptorClient() - ->AddObserver(this); + DBusThreadManager::Get()->GetBluetoothGattDescriptorClient()->AddObserver( + this); // Add all known GATT characteristic descriptors. const std::vector<dbus::ObjectPath>& gatt_descs = - bluez::BluezDBusManager::Get() + DBusThreadManager::Get() ->GetBluetoothGattDescriptorClient() ->GetDescriptors(); for (std::vector<dbus::ObjectPath>::const_iterator iter = gatt_descs.begin(); @@ -60,9 +59,8 @@ BluetoothRemoteGattCharacteristicChromeOS:: BluetoothRemoteGattCharacteristicChromeOS:: ~BluetoothRemoteGattCharacteristicChromeOS() { - bluez::BluezDBusManager::Get() - ->GetBluetoothGattDescriptorClient() - ->RemoveObserver(this); + DBusThreadManager::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. @@ -84,8 +82,8 @@ std::string BluetoothRemoteGattCharacteristicChromeOS::GetIdentifier() const { device::BluetoothUUID BluetoothRemoteGattCharacteristicChromeOS::GetUUID() const { - bluez::BluetoothGattCharacteristicClient::Properties* properties = - bluez::BluezDBusManager::Get() + BluetoothGattCharacteristicClient::Properties* properties = + DBusThreadManager::Get() ->GetBluetoothGattCharacteristicClient() ->GetProperties(object_path_); DCHECK(properties); @@ -98,8 +96,8 @@ bool BluetoothRemoteGattCharacteristicChromeOS::IsLocal() const { const std::vector<uint8>& BluetoothRemoteGattCharacteristicChromeOS::GetValue() const { - bluez::BluetoothGattCharacteristicClient::Properties* properties = - bluez::BluezDBusManager::Get() + BluetoothGattCharacteristicClient::Properties* properties = + DBusThreadManager::Get() ->GetBluetoothGattCharacteristicClient() ->GetProperties(object_path_); @@ -115,8 +113,8 @@ BluetoothRemoteGattCharacteristicChromeOS::GetService() const { device::BluetoothGattCharacteristic::Properties BluetoothRemoteGattCharacteristicChromeOS::GetProperties() const { - bluez::BluetoothGattCharacteristicClient::Properties* properties = - bluez::BluezDBusManager::Get() + BluetoothGattCharacteristicClient::Properties* properties = + DBusThreadManager::Get() ->GetBluetoothGattCharacteristicClient() ->GetProperties(object_path_); DCHECK(properties); @@ -159,8 +157,8 @@ BluetoothRemoteGattCharacteristicChromeOS::GetPermissions() const { } bool BluetoothRemoteGattCharacteristicChromeOS::IsNotifying() const { - bluez::BluetoothGattCharacteristicClient::Properties* properties = - bluez::BluezDBusManager::Get() + BluetoothGattCharacteristicClient::Properties* properties = + DBusThreadManager::Get() ->GetBluetoothGattCharacteristicClient() ->GetProperties(object_path_); DCHECK(properties); @@ -206,12 +204,10 @@ void BluetoothRemoteGattCharacteristicChromeOS::ReadRemoteCharacteristic( << GetIdentifier() << ", UUID: " << GetUUID().canonical_value() << "."; - bluez::BluezDBusManager::Get() - ->GetBluetoothGattCharacteristicClient() - ->ReadValue( - object_path_, callback, - base::Bind(&BluetoothRemoteGattCharacteristicChromeOS::OnError, - weak_ptr_factory_.GetWeakPtr(), error_callback)); + DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient()->ReadValue( + object_path_, callback, + base::Bind(&BluetoothRemoteGattCharacteristicChromeOS::OnError, + weak_ptr_factory_.GetWeakPtr(), error_callback)); } void BluetoothRemoteGattCharacteristicChromeOS::WriteRemoteCharacteristic( @@ -222,12 +218,10 @@ void BluetoothRemoteGattCharacteristicChromeOS::WriteRemoteCharacteristic( << GetIdentifier() << ", UUID: " << GetUUID().canonical_value() << ", with value: " << new_value << "."; - bluez::BluezDBusManager::Get() - ->GetBluetoothGattCharacteristicClient() - ->WriteValue( - object_path_, new_value, callback, - base::Bind(&BluetoothRemoteGattCharacteristicChromeOS::OnError, - weak_ptr_factory_.GetWeakPtr(), error_callback)); + DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient()->WriteValue( + object_path_, new_value, callback, + base::Bind(&BluetoothRemoteGattCharacteristicChromeOS::OnError, + weak_ptr_factory_.GetWeakPtr(), error_callback)); } void BluetoothRemoteGattCharacteristicChromeOS::StartNotifySession( @@ -273,16 +267,13 @@ void BluetoothRemoteGattCharacteristicChromeOS::StartNotifySession( } notify_call_pending_ = true; - 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)); + 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)); } void BluetoothRemoteGattCharacteristicChromeOS::RemoveNotifySession( @@ -311,16 +302,13 @@ void BluetoothRemoteGattCharacteristicChromeOS::RemoveNotifySession( DCHECK(num_notify_sessions_ == 1); notify_call_pending_ = true; - 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)); + DBusThreadManager::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( @@ -331,8 +319,8 @@ void BluetoothRemoteGattCharacteristicChromeOS::GattDescriptorAdded( return; } - bluez::BluetoothGattDescriptorClient::Properties* properties = - bluez::BluezDBusManager::Get() + BluetoothGattDescriptorClient::Properties* properties = + DBusThreadManager::Get() ->GetBluetoothGattDescriptorClient() ->GetProperties(object_path); DCHECK(properties); @@ -384,8 +372,8 @@ void BluetoothRemoteGattCharacteristicChromeOS::GattDescriptorPropertyChanged( return; } - bluez::BluetoothGattDescriptorClient::Properties* properties = - bluez::BluezDBusManager::Get() + BluetoothGattDescriptorClient::Properties* properties = + DBusThreadManager::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 361b319..a23a1178 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 bluez::BluetoothGattDescriptorClient::Observer { + public BluetoothGattDescriptorClient::Observer { public: // device::BluetoothGattCharacteristic overrides. std::string GetIdentifier() const override; @@ -78,7 +78,7 @@ class BluetoothRemoteGattCharacteristicChromeOS const dbus::ObjectPath& object_path); ~BluetoothRemoteGattCharacteristicChromeOS() override; - // bluez::BluetoothGattDescriptorClient::Observer overrides. + // 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 f864c3b..ab1074f8 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,8 +47,8 @@ std::string BluetoothRemoteGattDescriptorChromeOS::GetIdentifier() const { } device::BluetoothUUID BluetoothRemoteGattDescriptorChromeOS::GetUUID() const { - bluez::BluetoothGattDescriptorClient::Properties* properties = - bluez::BluezDBusManager::Get() + BluetoothGattDescriptorClient::Properties* properties = + DBusThreadManager::Get() ->GetBluetoothGattDescriptorClient() ->GetProperties(object_path_); DCHECK(properties); @@ -61,8 +61,8 @@ bool BluetoothRemoteGattDescriptorChromeOS::IsLocal() const { const std::vector<uint8>& BluetoothRemoteGattDescriptorChromeOS::GetValue() const { - bluez::BluetoothGattDescriptorClient::Properties* properties = - bluez::BluezDBusManager::Get() + BluetoothGattDescriptorClient::Properties* properties = + DBusThreadManager::Get() ->GetBluetoothGattDescriptorClient() ->GetProperties(object_path_); @@ -90,7 +90,7 @@ void BluetoothRemoteGattDescriptorChromeOS::ReadRemoteDescriptor( << "descriptor: " << GetIdentifier() << ", UUID: " << GetUUID().canonical_value(); - bluez::BluezDBusManager::Get()->GetBluetoothGattDescriptorClient()->ReadValue( + DBusThreadManager::Get()->GetBluetoothGattDescriptorClient()->ReadValue( object_path_, callback, base::Bind(&BluetoothRemoteGattDescriptorChromeOS::OnError, weak_ptr_factory_.GetWeakPtr(), error_callback)); @@ -105,11 +105,10 @@ void BluetoothRemoteGattDescriptorChromeOS::WriteRemoteDescriptor( << GetUUID().canonical_value() << ", with value: " << new_value << "."; - bluez::BluezDBusManager::Get() - ->GetBluetoothGattDescriptorClient() - ->WriteValue(object_path_, new_value, callback, - base::Bind(&BluetoothRemoteGattDescriptorChromeOS::OnError, - weak_ptr_factory_.GetWeakPtr(), error_callback)); + DBusThreadManager::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 8a57fa2..e8176bd 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,15 +41,13 @@ BluetoothRemoteGattServiceChromeOS::BluetoothRemoteGattServiceChromeOS( << object_path.value() << ", UUID: " << GetUUID().canonical_value(); DCHECK(adapter_); - bluez::BluezDBusManager::Get()->GetBluetoothGattServiceClient()->AddObserver( + DBusThreadManager::Get()->GetBluetoothGattServiceClient()->AddObserver(this); + DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient()->AddObserver( this); - bluez::BluezDBusManager::Get() - ->GetBluetoothGattCharacteristicClient() - ->AddObserver(this); // Add all known GATT characteristics. const std::vector<dbus::ObjectPath>& gatt_chars = - bluez::BluezDBusManager::Get() + DBusThreadManager::Get() ->GetBluetoothGattCharacteristicClient() ->GetCharacteristics(); for (std::vector<dbus::ObjectPath>::const_iterator iter = gatt_chars.begin(); @@ -58,10 +56,9 @@ BluetoothRemoteGattServiceChromeOS::BluetoothRemoteGattServiceChromeOS( } BluetoothRemoteGattServiceChromeOS::~BluetoothRemoteGattServiceChromeOS() { - bluez::BluezDBusManager::Get() - ->GetBluetoothGattServiceClient() - ->RemoveObserver(this); - bluez::BluezDBusManager::Get() + DBusThreadManager::Get()->GetBluetoothGattServiceClient()->RemoveObserver( + this); + DBusThreadManager::Get() ->GetBluetoothGattCharacteristicClient() ->RemoveObserver(this); @@ -84,10 +81,9 @@ std::string BluetoothRemoteGattServiceChromeOS::GetIdentifier() const { } device::BluetoothUUID BluetoothRemoteGattServiceChromeOS::GetUUID() const { - bluez::BluetoothGattServiceClient::Properties* properties = - bluez::BluezDBusManager::Get() - ->GetBluetoothGattServiceClient() - ->GetProperties(object_path_); + BluetoothGattServiceClient::Properties* properties = + DBusThreadManager::Get()->GetBluetoothGattServiceClient()->GetProperties( + object_path_); DCHECK(properties); return device::BluetoothUUID(properties->uuid.value()); } @@ -97,10 +93,9 @@ bool BluetoothRemoteGattServiceChromeOS::IsLocal() const { } bool BluetoothRemoteGattServiceChromeOS::IsPrimary() const { - bluez::BluetoothGattServiceClient::Properties* properties = - bluez::BluezDBusManager::Get() - ->GetBluetoothGattServiceClient() - ->GetProperties(object_path_); + BluetoothGattServiceClient::Properties* properties = + DBusThreadManager::Get()->GetBluetoothGattServiceClient()->GetProperties( + object_path_); DCHECK(properties); return properties->primary.value(); } @@ -234,10 +229,9 @@ void BluetoothRemoteGattServiceChromeOS::GattServicePropertyChanged( VLOG(1) << "Service property changed: \"" << property_name << "\", " << object_path.value(); - bluez::BluetoothGattServiceClient::Properties* properties = - bluez::BluezDBusManager::Get() - ->GetBluetoothGattServiceClient() - ->GetProperties(object_path); + BluetoothGattServiceClient::Properties* properties = + DBusThreadManager::Get()->GetBluetoothGattServiceClient()->GetProperties( + object_path); DCHECK(properties); if (property_name != properties->characteristics.name()) { @@ -263,8 +257,8 @@ void BluetoothRemoteGattServiceChromeOS::GattCharacteristicAdded( return; } - bluez::BluetoothGattCharacteristicClient::Properties* properties = - bluez::BluezDBusManager::Get() + BluetoothGattCharacteristicClient::Properties* properties = + DBusThreadManager::Get() ->GetBluetoothGattCharacteristicClient() ->GetProperties(object_path); DCHECK(properties); @@ -321,8 +315,8 @@ void BluetoothRemoteGattServiceChromeOS::GattCharacteristicPropertyChanged( // "Characteristic Extended Properties" descriptor. In this case, kick off // a service changed observer event to let observers refresh the // characteristics. - bluez::BluetoothGattCharacteristicClient::Properties* properties = - bluez::BluezDBusManager::Get() + BluetoothGattCharacteristicClient::Properties* properties = + DBusThreadManager::Get() ->GetBluetoothGattCharacteristicClient() ->GetProperties(object_path); diff --git a/device/bluetooth/bluetooth_remote_gatt_service_chromeos.h b/device/bluetooth/bluetooth_remote_gatt_service_chromeos.h index bc35cb7..9aa8fdd 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 bluez::BluetoothGattServiceClient::Observer, - public bluez::BluetoothGattCharacteristicClient::Observer { + public BluetoothGattServiceClient::Observer, + public BluetoothGattCharacteristicClient::Observer { public: // device::BluetoothGattService overrides. std::string GetIdentifier() const override; @@ -104,11 +104,11 @@ class BluetoothRemoteGattServiceChromeOS const dbus::ObjectPath& object_path); ~BluetoothRemoteGattServiceChromeOS() override; - // bluez::BluetoothGattServiceClient::Observer override. + // BluetoothGattServiceClient::Observer override. void GattServicePropertyChanged(const dbus::ObjectPath& object_path, const std::string& property_name) override; - // bluez::BluetoothGattCharacteristicClient::Observer override. + // 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 b3e357d..da15484 100644 --- a/device/bluetooth/bluetooth_socket_chromeos.cc +++ b/device/bluetooth/bluetooth_socket_chromeos.cc @@ -20,6 +20,10 @@ #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" @@ -31,10 +35,6 @@ #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 bluez::BluetoothProfileManagerClient::Options()); + options_.reset(new 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 bluez::BluetoothProfileManagerClient::Options()); + options_.reset(new 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 - // BluezDBusManager during shutdown if that callback executes too late. + // DBusThreadManager 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(); - bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->ConnectProfile( + DBusThreadManager::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 bluez::BluetoothProfileServiceProvider::Delegate::Options& options, + const 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 bluez::BluetoothProfileServiceProvider::Delegate::Options& options, + const 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 a1c76ee2..98d4d02 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 DEVICE_BLUETOOTH_EXPORT BluetoothSocketChromeOS +class CHROMEOS_EXPORT BluetoothSocketChromeOS : public device::BluetoothSocketNet, public device::BluetoothAdapter::Observer, - public bluez::BluetoothProfileServiceProvider::Delegate { + public BluetoothProfileServiceProvider::Delegate { public: enum SecurityLevel { SECURITY_LEVEL_LOW, @@ -112,12 +112,12 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothSocketChromeOS void OnInternalRegisterProfile(BluetoothAdapterProfileChromeOS* profile); void OnInternalRegisterProfileError(const std::string& error_message); - // bluez::BluetoothProfileServiceProvider::Delegate: + // BluetoothProfileServiceProvider::Delegate: void Released() override; void NewConnection( const dbus::ObjectPath& device_path, scoped_ptr<dbus::FileDescriptor> fd, - const bluez::BluetoothProfileServiceProvider::Delegate::Options& options, + const BluetoothProfileServiceProvider::Delegate::Options& options, const ConfirmationCallback& callback) override; void RequestDisconnection(const dbus::ObjectPath& device_path, const ConfirmationCallback& callback) override; @@ -131,7 +131,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothSocketChromeOS void DoNewConnection( const dbus::ObjectPath& device_path, scoped_ptr<dbus::FileDescriptor> fd, - const bluez::BluetoothProfileServiceProvider::Delegate::Options& options, + const 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 DEVICE_BLUETOOTH_EXPORT BluetoothSocketChromeOS device::BluetoothUUID uuid_; // Copy of the profile options used for registering the profile. - scoped_ptr<bluez::BluetoothProfileManagerClient::Options> options_; + scoped_ptr<BluetoothProfileManagerClient::Options> options_; // The profile registered with the adapter for this socket. BluetoothAdapterProfileChromeOS* profile_; @@ -188,7 +188,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothSocketChromeOS dbus::ObjectPath device_path; scoped_ptr<dbus::FileDescriptor> fd; - bluez::BluetoothProfileServiceProvider::Delegate::Options options; + 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 0bdc3be..747b857 100644 --- a/device/bluetooth/bluetooth_socket_chromeos_unittest.cc +++ b/device/bluetooth/bluetooth_socket_chromeos_unittest.cc @@ -5,6 +5,14 @@ #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" @@ -14,14 +22,6 @@ #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,27 +51,24 @@ class BluetoothSocketChromeOSTest : public testing::Test { last_reason_(BluetoothSocket::kSystemError) {} void SetUp() override { - scoped_ptr<bluez::BluezDBusManagerSetter> dbus_setter = - bluez::BluezDBusManager::GetSetterForTesting(); + scoped_ptr<DBusThreadManagerSetter> dbus_setter = + DBusThreadManager::GetSetterForTesting(); dbus_setter->SetBluetoothAdapterClient( - scoped_ptr<bluez::BluetoothAdapterClient>( - new bluez::FakeBluetoothAdapterClient)); + scoped_ptr<BluetoothAdapterClient>(new FakeBluetoothAdapterClient)); dbus_setter->SetBluetoothAgentManagerClient( - scoped_ptr<bluez::BluetoothAgentManagerClient>( - new bluez::FakeBluetoothAgentManagerClient)); + scoped_ptr<BluetoothAgentManagerClient>( + new FakeBluetoothAgentManagerClient)); dbus_setter->SetBluetoothDeviceClient( - scoped_ptr<bluez::BluetoothDeviceClient>( - new bluez::FakeBluetoothDeviceClient)); + scoped_ptr<BluetoothDeviceClient>(new FakeBluetoothDeviceClient)); dbus_setter->SetBluetoothGattServiceClient( - scoped_ptr<bluez::BluetoothGattServiceClient>( - new bluez::FakeBluetoothGattServiceClient)); + scoped_ptr<BluetoothGattServiceClient>( + new FakeBluetoothGattServiceClient)); dbus_setter->SetBluetoothInputClient( - scoped_ptr<bluez::BluetoothInputClient>( - new bluez::FakeBluetoothInputClient)); + scoped_ptr<BluetoothInputClient>(new FakeBluetoothInputClient)); dbus_setter->SetBluetoothProfileManagerClient( - scoped_ptr<bluez::BluetoothProfileManagerClient>( - new bluez::FakeBluetoothProfileManagerClient)); + scoped_ptr<BluetoothProfileManagerClient>( + new FakeBluetoothProfileManagerClient)); BluetoothSocketThread::Get(); @@ -94,7 +91,7 @@ class BluetoothSocketChromeOSTest : public testing::Test { void TearDown() override { adapter_ = nullptr; BluetoothSocketThread::CleanupForTesting(); - bluez::BluezDBusManager::Shutdown(); + DBusThreadManager::Shutdown(); } void AdapterCallback(scoped_refptr<BluetoothAdapter> adapter) { @@ -185,12 +182,12 @@ class BluetoothSocketChromeOSTest : public testing::Test { }; TEST_F(BluetoothSocketChromeOSTest, Connect) { - BluetoothDevice* device = adapter_->GetDevice( - bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress); + BluetoothDevice* device = + adapter_->GetDevice(FakeBluetoothDeviceClient::kPairedDeviceAddress); ASSERT_TRUE(device != nullptr); device->ConnectToService( - BluetoothUUID(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid), + BluetoothUUID(FakeBluetoothProfileManagerClient::kRfcommUuid), base::Bind(&BluetoothSocketChromeOSTest::ConnectToServiceSuccessCallback, base::Unretained(this)), base::Bind(&BluetoothSocketChromeOSTest::ErrorCallback, @@ -297,7 +294,7 @@ TEST_F(BluetoothSocketChromeOSTest, Connect) { TEST_F(BluetoothSocketChromeOSTest, Listen) { adapter_->CreateRfcommService( - BluetoothUUID(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid), + BluetoothUUID(FakeBluetoothProfileManagerClient::kRfcommUuid), BluetoothAdapter::ServiceOptions(), base::Bind(&BluetoothSocketChromeOSTest::CreateServiceSuccessCallback, base::Unretained(this)), @@ -322,15 +319,15 @@ TEST_F(BluetoothSocketChromeOSTest, Listen) { // // This is done before the Accept() call to simulate a pending call at the // point that Accept() is called. - bluez::FakeBluetoothDeviceClient* fake_bluetooth_device_client = - static_cast<bluez::FakeBluetoothDeviceClient*>( - bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()); - BluetoothDevice* device = adapter_->GetDevice( - bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress); + FakeBluetoothDeviceClient* fake_bluetooth_device_client = + static_cast<FakeBluetoothDeviceClient*>( + DBusThreadManager::Get()->GetBluetoothDeviceClient()); + BluetoothDevice* device = + adapter_->GetDevice(FakeBluetoothDeviceClient::kPairedDeviceAddress); ASSERT_TRUE(device != nullptr); fake_bluetooth_device_client->ConnectProfile( static_cast<BluetoothDeviceChromeOS*>(device)->object_path(), - bluez::FakeBluetoothProfileManagerClient::kRfcommUuid, + FakeBluetoothProfileManagerClient::kRfcommUuid, base::Bind(&base::DoNothing), base::Bind(&DoNothingDBusErrorCallback)); message_loop_.RunUntilIdle(); @@ -377,7 +374,7 @@ TEST_F(BluetoothSocketChromeOSTest, Listen) { fake_bluetooth_device_client->ConnectProfile( static_cast<BluetoothDeviceChromeOS*>(device)->object_path(), - bluez::FakeBluetoothProfileManagerClient::kRfcommUuid, + FakeBluetoothProfileManagerClient::kRfcommUuid, base::Bind(&base::DoNothing), base::Bind(&DoNothingDBusErrorCallback)); message_loop_.Run(); @@ -417,13 +414,13 @@ TEST_F(BluetoothSocketChromeOSTest, Listen) { TEST_F(BluetoothSocketChromeOSTest, ListenBeforeAdapterStart) { // Start off with an invisible adapter, register the profile, then make // the adapter visible. - bluez::FakeBluetoothAdapterClient* fake_bluetooth_adapter_client = - static_cast<bluez::FakeBluetoothAdapterClient*>( - bluez::BluezDBusManager::Get()->GetBluetoothAdapterClient()); + FakeBluetoothAdapterClient* fake_bluetooth_adapter_client = + static_cast<FakeBluetoothAdapterClient*>( + DBusThreadManager::Get()->GetBluetoothAdapterClient()); fake_bluetooth_adapter_client->SetVisible(false); adapter_->CreateRfcommService( - BluetoothUUID(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid), + BluetoothUUID(FakeBluetoothProfileManagerClient::kRfcommUuid), BluetoothAdapter::ServiceOptions(), base::Bind(&BluetoothSocketChromeOSTest::CreateServiceSuccessCallback, base::Unretained(this)), @@ -442,14 +439,12 @@ TEST_F(BluetoothSocketChromeOSTest, ListenBeforeAdapterStart) { error_callback_count_ = 0; // But there shouldn't be a profile registered yet. - bluez::FakeBluetoothProfileManagerClient* - fake_bluetooth_profile_manager_client = - static_cast<bluez::FakeBluetoothProfileManagerClient*>( - bluez::BluezDBusManager::Get() - ->GetBluetoothProfileManagerClient()); - bluez::FakeBluetoothProfileServiceProvider* profile_service_provider = + FakeBluetoothProfileManagerClient* fake_bluetooth_profile_manager_client = + static_cast<FakeBluetoothProfileManagerClient*>( + DBusThreadManager::Get()->GetBluetoothProfileManagerClient()); + FakeBluetoothProfileServiceProvider* profile_service_provider = fake_bluetooth_profile_manager_client->GetProfileServiceProvider( - bluez::FakeBluetoothProfileManagerClient::kRfcommUuid); + FakeBluetoothProfileManagerClient::kRfcommUuid); EXPECT_TRUE(profile_service_provider == nullptr); // Make the adapter visible. This should register a profile. @@ -459,7 +454,7 @@ TEST_F(BluetoothSocketChromeOSTest, ListenBeforeAdapterStart) { profile_service_provider = fake_bluetooth_profile_manager_client->GetProfileServiceProvider( - bluez::FakeBluetoothProfileManagerClient::kRfcommUuid); + FakeBluetoothProfileManagerClient::kRfcommUuid); EXPECT_TRUE(profile_service_provider != nullptr); // Cleanup the socket. @@ -474,12 +469,12 @@ TEST_F(BluetoothSocketChromeOSTest, ListenBeforeAdapterStart) { TEST_F(BluetoothSocketChromeOSTest, ListenAcrossAdapterRestart) { // The fake adapter starts off visible by default. - bluez::FakeBluetoothAdapterClient* fake_bluetooth_adapter_client = - static_cast<bluez::FakeBluetoothAdapterClient*>( - bluez::BluezDBusManager::Get()->GetBluetoothAdapterClient()); + FakeBluetoothAdapterClient* fake_bluetooth_adapter_client = + static_cast<FakeBluetoothAdapterClient*>( + DBusThreadManager::Get()->GetBluetoothAdapterClient()); adapter_->CreateRfcommService( - BluetoothUUID(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid), + BluetoothUUID(FakeBluetoothProfileManagerClient::kRfcommUuid), BluetoothAdapter::ServiceOptions(), base::Bind(&BluetoothSocketChromeOSTest::CreateServiceSuccessCallback, base::Unretained(this)), @@ -498,14 +493,12 @@ TEST_F(BluetoothSocketChromeOSTest, ListenAcrossAdapterRestart) { error_callback_count_ = 0; // Make sure the profile was registered with the daemon. - bluez::FakeBluetoothProfileManagerClient* - fake_bluetooth_profile_manager_client = - static_cast<bluez::FakeBluetoothProfileManagerClient*>( - bluez::BluezDBusManager::Get() - ->GetBluetoothProfileManagerClient()); - bluez::FakeBluetoothProfileServiceProvider* profile_service_provider = + FakeBluetoothProfileManagerClient* fake_bluetooth_profile_manager_client = + static_cast<FakeBluetoothProfileManagerClient*>( + DBusThreadManager::Get()->GetBluetoothProfileManagerClient()); + FakeBluetoothProfileServiceProvider* profile_service_provider = fake_bluetooth_profile_manager_client->GetProfileServiceProvider( - bluez::FakeBluetoothProfileManagerClient::kRfcommUuid); + FakeBluetoothProfileManagerClient::kRfcommUuid); EXPECT_TRUE(profile_service_provider != nullptr); // Make the adapter invisible, and fiddle with the profile fake to unregister @@ -521,7 +514,7 @@ TEST_F(BluetoothSocketChromeOSTest, ListenAcrossAdapterRestart) { profile_service_provider = fake_bluetooth_profile_manager_client->GetProfileServiceProvider( - bluez::FakeBluetoothProfileManagerClient::kRfcommUuid); + FakeBluetoothProfileManagerClient::kRfcommUuid); EXPECT_TRUE(profile_service_provider != nullptr); // Cleanup the socket. @@ -536,11 +529,11 @@ TEST_F(BluetoothSocketChromeOSTest, ListenAcrossAdapterRestart) { TEST_F(BluetoothSocketChromeOSTest, PairedConnectFails) { BluetoothDevice* device = adapter_->GetDevice( - bluez::FakeBluetoothDeviceClient::kPairedUnconnectableDeviceAddress); + FakeBluetoothDeviceClient::kPairedUnconnectableDeviceAddress); ASSERT_TRUE(device != nullptr); device->ConnectToService( - BluetoothUUID(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid), + BluetoothUUID(FakeBluetoothProfileManagerClient::kRfcommUuid), base::Bind(&BluetoothSocketChromeOSTest::ConnectToServiceSuccessCallback, base::Unretained(this)), base::Bind(&BluetoothSocketChromeOSTest::ErrorCallback, @@ -552,7 +545,7 @@ TEST_F(BluetoothSocketChromeOSTest, PairedConnectFails) { EXPECT_TRUE(last_socket_.get() == nullptr); device->ConnectToService( - BluetoothUUID(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid), + BluetoothUUID(FakeBluetoothProfileManagerClient::kRfcommUuid), base::Bind(&BluetoothSocketChromeOSTest::ConnectToServiceSuccessCallback, base::Unretained(this)), base::Bind(&BluetoothSocketChromeOSTest::ErrorCallback, @@ -566,7 +559,7 @@ TEST_F(BluetoothSocketChromeOSTest, PairedConnectFails) { TEST_F(BluetoothSocketChromeOSTest, SocketListenTwice) { adapter_->CreateRfcommService( - BluetoothUUID(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid), + BluetoothUUID(FakeBluetoothProfileManagerClient::kRfcommUuid), BluetoothAdapter::ServiceOptions(), base::Bind(&BluetoothSocketChromeOSTest::CreateServiceSuccessCallback, base::Unretained(this)), @@ -599,7 +592,7 @@ TEST_F(BluetoothSocketChromeOSTest, SocketListenTwice) { EXPECT_EQ(1U, error_callback_count_); adapter_->CreateRfcommService( - BluetoothUUID(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid), + BluetoothUUID(FakeBluetoothProfileManagerClient::kRfcommUuid), BluetoothAdapter::ServiceOptions(), base::Bind(&BluetoothSocketChromeOSTest::CreateServiceSuccessCallback, base::Unretained(this)), diff --git a/device/bluetooth/dbus/bluetooth_dbus_client_bundle.cc b/device/bluetooth/dbus/bluetooth_dbus_client_bundle.cc deleted file mode 100644 index 29a4ce8..0000000 --- a/device/bluetooth/dbus/bluetooth_dbus_client_bundle.cc +++ /dev/null @@ -1,84 +0,0 @@ -// 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 deleted file mode 100644 index bc1a63c..0000000 --- a/device/bluetooth/dbus/bluetooth_dbus_client_bundle.h +++ /dev/null @@ -1,113 +0,0 @@ -// 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/device/bluetooth/dbus/bluez_dbus_client.h b/device/bluetooth/dbus/bluez_dbus_client.h deleted file mode 100644 index 3dd0985..0000000 --- a/device/bluetooth/dbus/bluez_dbus_client.h +++ /dev/null @@ -1,37 +0,0 @@ -// 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 deleted file mode 100644 index 376261d..0000000 --- a/device/bluetooth/dbus/bluez_dbus_manager.cc +++ /dev/null @@ -1,250 +0,0 @@ -// 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 deleted file mode 100644 index 6f75f96..0000000 --- a/device/bluetooth/dbus/bluez_dbus_manager.h +++ /dev/null @@ -1,157 +0,0 @@ -// 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_ |