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

Unified Diff: device/bluetooth/dbus/fake_bluetooth_gatt_service_client.cc

Issue 1347193004: Refactor DBusThreadManager to split away BT clients. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: device/bluetooth/dbus/fake_bluetooth_gatt_service_client.cc
diff --git a/chromeos/dbus/fake_bluetooth_gatt_service_client.cc b/device/bluetooth/dbus/fake_bluetooth_gatt_service_client.cc
similarity index 83%
rename from chromeos/dbus/fake_bluetooth_gatt_service_client.cc
rename to device/bluetooth/dbus/fake_bluetooth_gatt_service_client.cc
index 1a566427dadd88239d5d9960300f0496f2d06c35..2e7aa0a87210ffa70b1e556e4a71438c20db2d46 100644
--- a/chromeos/dbus/fake_bluetooth_gatt_service_client.cc
+++ b/device/bluetooth/dbus/fake_bluetooth_gatt_service_client.cc
@@ -2,18 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chromeos/dbus/fake_bluetooth_gatt_service_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_gatt_service_client.h"
#include "base/bind.h"
#include "base/location.h"
#include "base/single_thread_task_runner.h"
#include "base/thread_task_runner_handle.h"
#include "base/time/time.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/fake_bluetooth_gatt_characteristic_client.h"
+#include "device/bluetooth/dbus/bluez_dbus_manager.h"
+#include "device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
-namespace chromeos {
+namespace bluez {
namespace {
@@ -30,13 +30,11 @@ const char FakeBluetoothGattServiceClient::kHeartRateServiceUUID[] =
FakeBluetoothGattServiceClient::Properties::Properties(
const PropertyChangedCallback& callback)
: BluetoothGattServiceClient::Properties(
- NULL,
- bluetooth_gatt_service::kBluetoothGattServiceInterface,
- callback) {
-}
+ NULL,
+ bluetooth_gatt_service::kBluetoothGattServiceInterface,
+ callback) {}
-FakeBluetoothGattServiceClient::Properties::~Properties() {
-}
+FakeBluetoothGattServiceClient::Properties::~Properties() {}
void FakeBluetoothGattServiceClient::Properties::Get(
dbus::PropertyBase* property,
@@ -57,14 +55,11 @@ void FakeBluetoothGattServiceClient::Properties::Set(
}
FakeBluetoothGattServiceClient::FakeBluetoothGattServiceClient()
- : weak_ptr_factory_(this) {
-}
+ : weak_ptr_factory_(this) {}
-FakeBluetoothGattServiceClient::~FakeBluetoothGattServiceClient() {
-}
+FakeBluetoothGattServiceClient::~FakeBluetoothGattServiceClient() {}
-void FakeBluetoothGattServiceClient::Init(dbus::Bus* bus) {
-}
+void FakeBluetoothGattServiceClient::Init(dbus::Bus* bus) {}
void FakeBluetoothGattServiceClient::AddObserver(Observer* observer) {
observers_.AddObserver(observer);
@@ -103,8 +98,7 @@ void FakeBluetoothGattServiceClient::ExposeHeartRateService(
device_path.value() + "/" + kHeartRateServicePathComponent;
heart_rate_service_properties_.reset(new Properties(base::Bind(
&FakeBluetoothGattServiceClient::OnPropertyChanged,
- base::Unretained(this),
- dbus::ObjectPath(heart_rate_service_path_))));
+ base::Unretained(this), dbus::ObjectPath(heart_rate_service_path_))));
heart_rate_service_properties_->uuid.ReplaceValue(kHeartRateServiceUUID);
heart_rate_service_properties_->device.ReplaceValue(device_path);
heart_rate_service_properties_->primary.ReplaceValue(true);
@@ -128,7 +122,8 @@ void FakeBluetoothGattServiceClient::HideHeartRateService() {
VLOG(2) << "Hiding fake Heart Rate Service.";
FakeBluetoothGattCharacteristicClient* char_client =
static_cast<FakeBluetoothGattCharacteristicClient*>(
- DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient());
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothGattCharacteristicClient());
char_client->HideHeartRateCharacteristics();
// Notify observers before deleting the properties structure so that it
@@ -143,8 +138,8 @@ bool FakeBluetoothGattServiceClient::IsHeartRateVisible() const {
return !!heart_rate_service_properties_.get();
}
-dbus::ObjectPath
-FakeBluetoothGattServiceClient::GetHeartRateServicePath() const {
+dbus::ObjectPath FakeBluetoothGattServiceClient::GetHeartRateServicePath()
+ const {
return dbus::ObjectPath(heart_rate_service_path_);
}
@@ -160,17 +155,15 @@ void FakeBluetoothGattServiceClient::OnPropertyChanged(
void FakeBluetoothGattServiceClient::NotifyServiceAdded(
const dbus::ObjectPath& object_path) {
VLOG(2) << "GATT service added: " << object_path.value();
- FOR_EACH_OBSERVER(
- BluetoothGattServiceClient::Observer, observers_,
- GattServiceAdded(object_path));
+ FOR_EACH_OBSERVER(BluetoothGattServiceClient::Observer, observers_,
+ GattServiceAdded(object_path));
}
void FakeBluetoothGattServiceClient::NotifyServiceRemoved(
const dbus::ObjectPath& object_path) {
VLOG(2) << "GATT service removed: " << object_path.value();
- FOR_EACH_OBSERVER(
- BluetoothGattServiceClient::Observer, observers_,
- GattServiceRemoved(object_path));
+ FOR_EACH_OBSERVER(BluetoothGattServiceClient::Observer, observers_,
+ GattServiceRemoved(object_path));
}
void FakeBluetoothGattServiceClient::ExposeHeartRateCharacteristics() {
@@ -180,7 +173,8 @@ void FakeBluetoothGattServiceClient::ExposeHeartRateCharacteristics() {
}
FakeBluetoothGattCharacteristicClient* char_client =
static_cast<FakeBluetoothGattCharacteristicClient*>(
- DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient());
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothGattCharacteristicClient());
char_client->ExposeHeartRateCharacteristics(
dbus::ObjectPath(heart_rate_service_path_));
@@ -192,4 +186,4 @@ void FakeBluetoothGattServiceClient::ExposeHeartRateCharacteristics() {
heart_rate_service_properties_->characteristics.ReplaceValue(char_paths);
}
-} // namespace chromeos
+} // namespace bluez

Powered by Google App Engine
This is Rietveld 408576698