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

Unified Diff: device/bluetooth/bluetooth_remote_gatt_service_chromeos.cc

Issue 1347193004: Refactor DBusThreadManager to split away BT clients. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: device/bluetooth/bluetooth_remote_gatt_service_chromeos.cc
diff --git a/device/bluetooth/bluetooth_remote_gatt_service_chromeos.cc b/device/bluetooth/bluetooth_remote_gatt_service_chromeos.cc
index cea23ec35dfdc3d5107fadf23519187542896c4f..8a57fa21b1d37c64014dca4a242624ad2ebe3e31 100644
--- a/device/bluetooth/bluetooth_remote_gatt_service_chromeos.cc
+++ b/device/bluetooth/bluetooth_remote_gatt_service_chromeos.cc
@@ -6,12 +6,12 @@
#include "base/logging.h"
#include "base/strings/stringprintf.h"
-#include "chromeos/dbus/bluetooth_gatt_service_client.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
#include "device/bluetooth/bluetooth_adapter_chromeos.h"
#include "device/bluetooth/bluetooth_device_chromeos.h"
#include "device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h"
#include "device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.h"
+#include "device/bluetooth/dbus/bluetooth_gatt_service_client.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
namespace chromeos {
@@ -41,24 +41,29 @@ BluetoothRemoteGattServiceChromeOS::BluetoothRemoteGattServiceChromeOS(
<< object_path.value() << ", UUID: " << GetUUID().canonical_value();
DCHECK(adapter_);
- DBusThreadManager::Get()->GetBluetoothGattServiceClient()->AddObserver(this);
- DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient()->
- AddObserver(this);
+ bluez::BluezDBusManager::Get()->GetBluetoothGattServiceClient()->AddObserver(
+ this);
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothGattCharacteristicClient()
+ ->AddObserver(this);
// Add all known GATT characteristics.
const std::vector<dbus::ObjectPath>& gatt_chars =
- DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient()->
- GetCharacteristics();
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothGattCharacteristicClient()
+ ->GetCharacteristics();
for (std::vector<dbus::ObjectPath>::const_iterator iter = gatt_chars.begin();
iter != gatt_chars.end(); ++iter)
GattCharacteristicAdded(*iter);
}
BluetoothRemoteGattServiceChromeOS::~BluetoothRemoteGattServiceChromeOS() {
- DBusThreadManager::Get()->GetBluetoothGattServiceClient()->
- RemoveObserver(this);
- DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient()->
- RemoveObserver(this);
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothGattServiceClient()
+ ->RemoveObserver(this);
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothGattCharacteristicClient()
+ ->RemoveObserver(this);
// Clean up all the characteristics. Copy the characteristics list here and
// clear the original so that when we send GattCharacteristicRemoved(),
@@ -79,9 +84,10 @@ std::string BluetoothRemoteGattServiceChromeOS::GetIdentifier() const {
}
device::BluetoothUUID BluetoothRemoteGattServiceChromeOS::GetUUID() const {
- BluetoothGattServiceClient::Properties* properties =
- DBusThreadManager::Get()->GetBluetoothGattServiceClient()->
- GetProperties(object_path_);
+ bluez::BluetoothGattServiceClient::Properties* properties =
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothGattServiceClient()
+ ->GetProperties(object_path_);
DCHECK(properties);
return device::BluetoothUUID(properties->uuid.value());
}
@@ -91,9 +97,10 @@ bool BluetoothRemoteGattServiceChromeOS::IsLocal() const {
}
bool BluetoothRemoteGattServiceChromeOS::IsPrimary() const {
- BluetoothGattServiceClient::Properties* properties =
- DBusThreadManager::Get()->GetBluetoothGattServiceClient()->
- GetProperties(object_path_);
+ bluez::BluetoothGattServiceClient::Properties* properties =
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothGattServiceClient()
+ ->GetProperties(object_path_);
DCHECK(properties);
return properties->primary.value();
}
@@ -227,9 +234,10 @@ void BluetoothRemoteGattServiceChromeOS::GattServicePropertyChanged(
VLOG(1) << "Service property changed: \"" << property_name << "\", "
<< object_path.value();
- BluetoothGattServiceClient::Properties* properties =
- DBusThreadManager::Get()->GetBluetoothGattServiceClient()->GetProperties(
- object_path);
+ bluez::BluetoothGattServiceClient::Properties* properties =
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothGattServiceClient()
+ ->GetProperties(object_path);
DCHECK(properties);
if (property_name != properties->characteristics.name()) {
@@ -255,9 +263,10 @@ void BluetoothRemoteGattServiceChromeOS::GattCharacteristicAdded(
return;
}
- BluetoothGattCharacteristicClient::Properties* properties =
- DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient()->
- GetProperties(object_path);
+ bluez::BluetoothGattCharacteristicClient::Properties* properties =
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothGattCharacteristicClient()
+ ->GetProperties(object_path);
DCHECK(properties);
if (properties->service.value() != object_path_) {
VLOG(2) << "Remote GATT characteristic does not belong to this service.";
@@ -312,9 +321,10 @@ void BluetoothRemoteGattServiceChromeOS::GattCharacteristicPropertyChanged(
// "Characteristic Extended Properties" descriptor. In this case, kick off
// a service changed observer event to let observers refresh the
// characteristics.
- BluetoothGattCharacteristicClient::Properties* properties =
- DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient()->
- GetProperties(object_path);
+ bluez::BluetoothGattCharacteristicClient::Properties* properties =
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothGattCharacteristicClient()
+ ->GetProperties(object_path);
DCHECK(properties);
DCHECK(adapter_);
« no previous file with comments | « device/bluetooth/bluetooth_remote_gatt_service_chromeos.h ('k') | device/bluetooth/bluetooth_socket_chromeos.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698