Index: device/bluetooth/dbus/bluetooth_gatt_service_service_provider.cc |
diff --git a/chromeos/dbus/bluetooth_gatt_service_service_provider.cc b/device/bluetooth/dbus/bluetooth_gatt_service_service_provider.cc |
similarity index 85% |
rename from chromeos/dbus/bluetooth_gatt_service_service_provider.cc |
rename to device/bluetooth/dbus/bluetooth_gatt_service_service_provider.cc |
index 7aeed9b0e3877117da8e1d2deb7ede4c51f17fb9..06b6827fe84b5e51715465572d840829191e9a8d 100644 |
--- a/chromeos/dbus/bluetooth_gatt_service_service_provider.cc |
+++ b/device/bluetooth/dbus/bluetooth_gatt_service_service_provider.cc |
@@ -2,23 +2,22 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "chromeos/dbus/bluetooth_gatt_service_service_provider.h" |
+#include "device/bluetooth/dbus/bluetooth_gatt_service_service_provider.h" |
#include "base/bind.h" |
#include "base/logging.h" |
#include "base/memory/ref_counted.h" |
#include "base/memory/weak_ptr.h" |
#include "base/threading/platform_thread.h" |
-#include "chromeos/dbus/dbus_thread_manager.h" |
-#include "chromeos/dbus/fake_bluetooth_gatt_service_service_provider.h" |
#include "dbus/exported_object.h" |
#include "dbus/message.h" |
+#include "device/bluetooth/dbus/bluez_dbus_manager.h" |
+#include "device/bluetooth/dbus/fake_bluetooth_gatt_service_service_provider.h" |
#include "third_party/cros_system_api/dbus/service_constants.h" |
-namespace chromeos { |
+namespace bluez { |
namespace { |
-const char kErrorInvalidArgs[] = |
- "org.freedesktop.DBus.Error.InvalidArgs"; |
+const char kErrorInvalidArgs[] = "org.freedesktop.DBus.Error.InvalidArgs"; |
const char kErrorPropertyReadOnly[] = |
"org.freedesktop.DBus.Error.PropertyReadOnly"; |
} // namespace |
@@ -47,24 +46,21 @@ class BluetoothGattServiceServiceProviderImpl |
exported_object_ = bus_->GetExportedObject(object_path_); |
exported_object_->ExportMethod( |
- dbus::kDBusPropertiesInterface, |
- dbus::kDBusPropertiesGet, |
+ dbus::kDBusPropertiesInterface, dbus::kDBusPropertiesGet, |
base::Bind(&BluetoothGattServiceServiceProviderImpl::Get, |
weak_ptr_factory_.GetWeakPtr()), |
base::Bind(&BluetoothGattServiceServiceProviderImpl::OnExported, |
weak_ptr_factory_.GetWeakPtr())); |
exported_object_->ExportMethod( |
- dbus::kDBusPropertiesInterface, |
- dbus::kDBusPropertiesSet, |
+ dbus::kDBusPropertiesInterface, dbus::kDBusPropertiesSet, |
base::Bind(&BluetoothGattServiceServiceProviderImpl::Set, |
weak_ptr_factory_.GetWeakPtr()), |
base::Bind(&BluetoothGattServiceServiceProviderImpl::OnExported, |
weak_ptr_factory_.GetWeakPtr())); |
exported_object_->ExportMethod( |
- dbus::kDBusPropertiesInterface, |
- dbus::kDBusPropertiesGetAll, |
+ dbus::kDBusPropertiesInterface, dbus::kDBusPropertiesGetAll, |
base::Bind(&BluetoothGattServiceServiceProviderImpl::GetAll, |
weak_ptr_factory_.GetWeakPtr()), |
base::Bind(&BluetoothGattServiceServiceProviderImpl::OnExported, |
@@ -95,11 +91,10 @@ class BluetoothGattServiceServiceProviderImpl |
std::string interface_name; |
std::string property_name; |
if (!reader.PopString(&interface_name) || |
- !reader.PopString(&property_name) || |
- reader.HasMoreData()) { |
+ !reader.PopString(&property_name) || reader.HasMoreData()) { |
scoped_ptr<dbus::ErrorResponse> error_response = |
- dbus::ErrorResponse::FromMethodCall( |
- method_call, kErrorInvalidArgs, "Expected 'ss'."); |
+ dbus::ErrorResponse::FromMethodCall(method_call, kErrorInvalidArgs, |
+ "Expected 'ss'."); |
response_sender.Run(error_response.Pass()); |
return; |
} |
@@ -155,9 +150,8 @@ class BluetoothGattServiceServiceProviderImpl |
// All of the properties on this interface are read-only, so just return |
// error. |
scoped_ptr<dbus::ErrorResponse> error_response = |
- dbus::ErrorResponse::FromMethodCall( |
- method_call, kErrorPropertyReadOnly, |
- "All properties are read-only."); |
+ dbus::ErrorResponse::FromMethodCall(method_call, kErrorPropertyReadOnly, |
+ "All properties are read-only."); |
response_sender.Run(error_response.Pass()); |
} |
@@ -174,8 +168,8 @@ class BluetoothGattServiceServiceProviderImpl |
std::string interface_name; |
if (!reader.PopString(&interface_name) || reader.HasMoreData()) { |
scoped_ptr<dbus::ErrorResponse> error_response = |
- dbus::ErrorResponse::FromMethodCall( |
- method_call, kErrorInvalidArgs, "Expected 's'."); |
+ dbus::ErrorResponse::FromMethodCall(method_call, kErrorInvalidArgs, |
+ "Expected 's'."); |
response_sender.Run(error_response.Pass()); |
return; |
} |
@@ -221,8 +215,8 @@ class BluetoothGattServiceServiceProviderImpl |
void OnExported(const std::string& interface_name, |
const std::string& method_name, |
bool success) { |
- LOG_IF(WARNING, !success) << "Failed to export " |
- << interface_name << "." << method_name; |
+ LOG_IF(WARNING, !success) << "Failed to export " << interface_name << "." |
+ << method_name; |
} |
// Origin thread (i.e. the UI thread in production). |
@@ -256,11 +250,9 @@ class BluetoothGattServiceServiceProviderImpl |
DISALLOW_COPY_AND_ASSIGN(BluetoothGattServiceServiceProviderImpl); |
}; |
-BluetoothGattServiceServiceProvider::BluetoothGattServiceServiceProvider() { |
-} |
+BluetoothGattServiceServiceProvider::BluetoothGattServiceServiceProvider() {} |
-BluetoothGattServiceServiceProvider::~BluetoothGattServiceServiceProvider() { |
-} |
+BluetoothGattServiceServiceProvider::~BluetoothGattServiceServiceProvider() {} |
// static |
BluetoothGattServiceServiceProvider* |
@@ -269,12 +261,12 @@ BluetoothGattServiceServiceProvider::Create( |
const dbus::ObjectPath& object_path, |
const std::string& uuid, |
const std::vector<dbus::ObjectPath>& includes) { |
- if (!DBusThreadManager::Get()->IsUsingStub(DBusClientBundle::BLUETOOTH)) { |
- return new BluetoothGattServiceServiceProviderImpl( |
- bus, object_path, uuid, includes); |
+ if (!bluez::BluezDBusManager::Get()->IsUsingStub()) { |
+ return new BluetoothGattServiceServiceProviderImpl(bus, object_path, uuid, |
+ includes); |
} |
- return new FakeBluetoothGattServiceServiceProvider( |
- object_path, uuid, includes); |
+ return new FakeBluetoothGattServiceServiceProvider(object_path, uuid, |
+ includes); |
} |
-} // namespace chromeos |
+} // namespace bluez |