| Index: device/bluetooth/dbus/fake_bluetooth_adapter_client.cc
|
| diff --git a/chromeos/dbus/fake_bluetooth_adapter_client.cc b/device/bluetooth/dbus/fake_bluetooth_adapter_client.cc
|
| similarity index 84%
|
| rename from chromeos/dbus/fake_bluetooth_adapter_client.cc
|
| rename to device/bluetooth/dbus/fake_bluetooth_adapter_client.cc
|
| index 054a69165951c858b7a79587c048bc2e5dbcd948..f9287681793fa1f5123c516eb19485ac8702da93 100644
|
| --- a/chromeos/dbus/fake_bluetooth_adapter_client.cc
|
| +++ b/device/bluetooth/dbus/fake_bluetooth_adapter_client.cc
|
| @@ -2,18 +2,18 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "chromeos/dbus/fake_bluetooth_adapter_client.h"
|
| +#include "device/bluetooth/dbus/fake_bluetooth_adapter_client.h"
|
|
|
| #include "base/location.h"
|
| #include "base/logging.h"
|
| #include "base/single_thread_task_runner.h"
|
| #include "base/thread_task_runner_handle.h"
|
| #include "base/time/time.h"
|
| -#include "chromeos/dbus/dbus_thread_manager.h"
|
| -#include "chromeos/dbus/fake_bluetooth_device_client.h"
|
| +#include "device/bluetooth/dbus/bluez_dbus_manager.h"
|
| +#include "device/bluetooth/dbus/fake_bluetooth_device_client.h"
|
| #include "third_party/cros_system_api/dbus/service_constants.h"
|
|
|
| -namespace chromeos {
|
| +namespace bluez {
|
|
|
| namespace {
|
|
|
| @@ -22,15 +22,11 @@ const int kSimulationIntervalMs = 750;
|
|
|
| } // namespace
|
|
|
| -const char FakeBluetoothAdapterClient::kAdapterPath[] =
|
| - "/fake/hci0";
|
| -const char FakeBluetoothAdapterClient::kAdapterName[] =
|
| - "Fake Adapter";
|
| -const char FakeBluetoothAdapterClient::kAdapterAddress[] =
|
| - "01:1A:2B:1A:2B:03";
|
| +const char FakeBluetoothAdapterClient::kAdapterPath[] = "/fake/hci0";
|
| +const char FakeBluetoothAdapterClient::kAdapterName[] = "Fake Adapter";
|
| +const char FakeBluetoothAdapterClient::kAdapterAddress[] = "01:1A:2B:1A:2B:03";
|
|
|
| -const char FakeBluetoothAdapterClient::kSecondAdapterPath[] =
|
| - "/fake/hci1";
|
| +const char FakeBluetoothAdapterClient::kSecondAdapterPath[] = "/fake/hci1";
|
| const char FakeBluetoothAdapterClient::kSecondAdapterName[] =
|
| "Second Fake Adapter";
|
| const char FakeBluetoothAdapterClient::kSecondAdapterAddress[] =
|
| @@ -39,13 +35,11 @@ const char FakeBluetoothAdapterClient::kSecondAdapterAddress[] =
|
| FakeBluetoothAdapterClient::Properties::Properties(
|
| const PropertyChangedCallback& callback)
|
| : BluetoothAdapterClient::Properties(
|
| - NULL,
|
| - bluetooth_adapter::kBluetoothAdapterInterface,
|
| - callback) {
|
| -}
|
| + NULL,
|
| + bluetooth_adapter::kBluetoothAdapterInterface,
|
| + callback) {}
|
|
|
| -FakeBluetoothAdapterClient::Properties::~Properties() {
|
| -}
|
| +FakeBluetoothAdapterClient::Properties::~Properties() {}
|
|
|
| void FakeBluetoothAdapterClient::Properties::Get(
|
| dbus::PropertyBase* property,
|
| @@ -59,11 +53,10 @@ void FakeBluetoothAdapterClient::Properties::GetAll() {
|
| }
|
|
|
| void FakeBluetoothAdapterClient::Properties::Set(
|
| - dbus::PropertyBase *property,
|
| + dbus::PropertyBase* property,
|
| dbus::PropertySet::SetCallback callback) {
|
| VLOG(1) << "Set " << property->name();
|
| - if (property->name() == powered.name() ||
|
| - property->name() == alias.name() ||
|
| + if (property->name() == powered.name() || property->name() == alias.name() ||
|
| property->name() == discoverable.name() ||
|
| property->name() == discoverable_timeout.name()) {
|
| callback.Run(true);
|
| @@ -96,11 +89,9 @@ FakeBluetoothAdapterClient::FakeBluetoothAdapterClient()
|
| second_properties_->pairable.ReplaceValue(true);
|
| }
|
|
|
| -FakeBluetoothAdapterClient::~FakeBluetoothAdapterClient() {
|
| -}
|
| +FakeBluetoothAdapterClient::~FakeBluetoothAdapterClient() {}
|
|
|
| -void FakeBluetoothAdapterClient::Init(dbus::Bus* bus) {
|
| -}
|
| +void FakeBluetoothAdapterClient::Init(dbus::Bus* bus) {}
|
|
|
| void FakeBluetoothAdapterClient::AddObserver(Observer* observer) {
|
| observers_.AddObserver(observer);
|
| @@ -148,7 +139,7 @@ void FakeBluetoothAdapterClient::StartDiscovery(
|
|
|
| FakeBluetoothDeviceClient* device_client =
|
| static_cast<FakeBluetoothDeviceClient*>(
|
| - DBusThreadManager::Get()->GetBluetoothDeviceClient());
|
| + bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient());
|
| device_client->BeginDiscoverySimulation(dbus::ObjectPath(kAdapterPath));
|
| }
|
| }
|
| @@ -176,7 +167,7 @@ void FakeBluetoothAdapterClient::StopDiscovery(
|
| if (discovering_count_ == 0) {
|
| FakeBluetoothDeviceClient* device_client =
|
| static_cast<FakeBluetoothDeviceClient*>(
|
| - DBusThreadManager::Get()->GetBluetoothDeviceClient());
|
| + bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient());
|
| device_client->EndDiscoverySimulation(dbus::ObjectPath(kAdapterPath));
|
|
|
| if (simulation_interval_ms_ > 100) {
|
| @@ -199,13 +190,13 @@ void FakeBluetoothAdapterClient::RemoveDevice(
|
| return;
|
| }
|
|
|
| - VLOG(1) << "RemoveDevice: " << object_path.value()
|
| - << " " << device_path.value();
|
| + VLOG(1) << "RemoveDevice: " << object_path.value() << " "
|
| + << device_path.value();
|
| callback.Run();
|
|
|
| FakeBluetoothDeviceClient* device_client =
|
| static_cast<FakeBluetoothDeviceClient*>(
|
| - DBusThreadManager::Get()->GetBluetoothDeviceClient());
|
| + bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient());
|
| device_client->RemoveDevice(dbus::ObjectPath(kAdapterPath), device_path);
|
| }
|
|
|
| @@ -244,8 +235,7 @@ FakeBluetoothAdapterClient::GetDiscoveryFilter() {
|
| return discovery_filter_.get();
|
| }
|
|
|
| -void FakeBluetoothAdapterClient::SetVisible(
|
| - bool visible) {
|
| +void FakeBluetoothAdapterClient::SetVisible(bool visible) {
|
| if (visible && !visible_) {
|
| // Adapter becoming visible
|
| visible_ = visible;
|
| @@ -262,8 +252,7 @@ void FakeBluetoothAdapterClient::SetVisible(
|
| }
|
| }
|
|
|
| -void FakeBluetoothAdapterClient::SetSecondVisible(
|
| - bool visible) {
|
| +void FakeBluetoothAdapterClient::SetSecondVisible(bool visible) {
|
| if (visible && !second_visible_) {
|
| // Second adapter becoming visible
|
| second_visible_ = visible;
|
| @@ -292,9 +281,9 @@ void FakeBluetoothAdapterClient::OnPropertyChanged(
|
| }
|
| }
|
|
|
| - FOR_EACH_OBSERVER(BluetoothAdapterClient::Observer, observers_,
|
| - AdapterPropertyChanged(dbus::ObjectPath(kAdapterPath),
|
| - property_name));
|
| + FOR_EACH_OBSERVER(
|
| + BluetoothAdapterClient::Observer, observers_,
|
| + AdapterPropertyChanged(dbus::ObjectPath(kAdapterPath), property_name));
|
| }
|
|
|
| void FakeBluetoothAdapterClient::PostDelayedTask(
|
| @@ -304,4 +293,4 @@ void FakeBluetoothAdapterClient::PostDelayedTask(
|
| base::TimeDelta::FromMilliseconds(simulation_interval_ms_));
|
| }
|
|
|
| -} // namespace chromeos
|
| +} // namespace bluez
|
|
|