Chromium Code Reviews| Index: chrome/browser/chromeos/bluetooth/bluetooth_device_dbus.cc |
| diff --git a/chrome/browser/chromeos/bluetooth/bluetooth_device.cc b/chrome/browser/chromeos/bluetooth/bluetooth_device_dbus.cc |
| similarity index 77% |
| rename from chrome/browser/chromeos/bluetooth/bluetooth_device.cc |
| rename to chrome/browser/chromeos/bluetooth/bluetooth_device_dbus.cc |
| index ba19dc58e703c48d4eca56faae4fe98529191128..a0461b49d8844d654a55a478d83cbbc3919dbe3d 100644 |
| --- a/chrome/browser/chromeos/bluetooth/bluetooth_device.cc |
| +++ b/chrome/browser/chromeos/bluetooth/bluetooth_device_dbus.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 "chrome/browser/chromeos/bluetooth/bluetooth_device.h" |
| +#include "chrome/browser/chromeos/bluetooth/bluetooth_device_dbus.h" |
| #include <map> |
| #include <string> |
| @@ -17,9 +17,9 @@ |
| #include "base/string_util.h" |
| #include "base/utf_string_conversions.h" |
| #include "base/values.h" |
| -#include "chrome/browser/chromeos/bluetooth/bluetooth_adapter.h" |
| +#include "chrome/browser/chromeos/bluetooth/bluetooth_adapter_dbus.h" |
| #include "chrome/browser/chromeos/bluetooth/bluetooth_service_record.h" |
| -#include "chrome/browser/chromeos/bluetooth/bluetooth_socket.h" |
| +#include "chrome/browser/chromeos/bluetooth/bluetooth_socket_posix.h" |
| #include "chrome/browser/chromeos/bluetooth/bluetooth_utils.h" |
| #include "chrome/common/chrome_switches.h" |
| #include "chromeos/dbus/bluetooth_adapter_client.h" |
| @@ -27,6 +27,7 @@ |
| #include "chromeos/dbus/bluetooth_device_client.h" |
| #include "chromeos/dbus/bluetooth_input_client.h" |
| #include "chromeos/dbus/bluetooth_out_of_band_client.h" |
| +#include "chromeos/dbus/bluetooth_out_of_band_pairing_data.h" |
| #include "chromeos/dbus/dbus_thread_manager.h" |
| #include "chromeos/dbus/introspectable_client.h" |
| #include "dbus/bus.h" |
| @@ -37,7 +38,7 @@ |
| namespace chromeos { |
| -BluetoothDevice::BluetoothDevice(BluetoothAdapter* adapter) |
| +BluetoothDeviceDBus::BluetoothDeviceDBus(BluetoothAdapterDBus* adapter) |
| : adapter_(adapter), |
| bluetooth_class_(0), |
| visible_(false), |
| @@ -48,12 +49,12 @@ BluetoothDevice::BluetoothDevice(BluetoothAdapter* adapter) |
| weak_ptr_factory_(this) { |
| } |
| -BluetoothDevice::~BluetoothDevice() { |
| +BluetoothDeviceDBus::~BluetoothDeviceDBus() { |
| } |
| -const std::string& BluetoothDevice::address() const { return address_; } |
| +const std::string& BluetoothDeviceDBus::address() const { return address_; } |
| -string16 BluetoothDevice::GetName() const { |
| +string16 BluetoothDeviceDBus::GetName() const { |
| if (!name_.empty()) { |
| return UTF8ToUTF16(name_); |
| } else { |
| @@ -61,7 +62,7 @@ string16 BluetoothDevice::GetName() const { |
| } |
| } |
| -BluetoothDevice::DeviceType BluetoothDevice::GetDeviceType() const { |
| +BluetoothDevice::DeviceType BluetoothDeviceDBus::GetDeviceType() const { |
|
keybuk
2012/09/13 23:57:30
This method can probably go in the base class, sin
youngki
2012/09/17 21:53:02
Done. I added bluetooth_device.cc to put the imple
|
| // https://www.bluetooth.org/Technical/AssignedNumbers/baseband.htm |
| switch ((bluetooth_class_ & 0x1f00) >> 8) { |
| case 0x01: |
| @@ -121,9 +122,9 @@ BluetoothDevice::DeviceType BluetoothDevice::GetDeviceType() const { |
| return DEVICE_UNKNOWN; |
| } |
| -string16 BluetoothDevice::GetAddressWithLocalizedDeviceTypeName() const { |
| +string16 BluetoothDeviceDBus::GetAddressWithLocalizedDeviceTypeName() const { |
| string16 address = UTF8ToUTF16(address_); |
| - DeviceType device_type = GetDeviceType(); |
| + BluetoothDevice::DeviceType device_type = GetDeviceType(); |
| switch (device_type) { |
| case DEVICE_COMPUTER: |
| return l10n_util::GetStringFUTF16(IDS_BLUETOOTH_DEVICE_COMPUTER, |
| @@ -157,12 +158,12 @@ string16 BluetoothDevice::GetAddressWithLocalizedDeviceTypeName() const { |
| } |
| } |
| -bool BluetoothDevice::IsSupported() const { |
| +bool BluetoothDeviceDBus::IsSupported() const { |
| if (CommandLine::ForCurrentProcess()->HasSwitch( |
| switches::kEnableUnsupportedBluetoothDevices)) |
| return true; |
| - DeviceType device_type = GetDeviceType(); |
| + BluetoothDevice::DeviceType device_type = GetDeviceType(); |
| return (device_type == DEVICE_JOYSTICK || |
| device_type == DEVICE_GAMEPAD || |
| device_type == DEVICE_KEYBOARD || |
| @@ -171,50 +172,55 @@ bool BluetoothDevice::IsSupported() const { |
| device_type == DEVICE_KEYBOARD_MOUSE_COMBO); |
| } |
| -bool BluetoothDevice::IsPaired() const { return !object_path_.value().empty(); } |
| +bool BluetoothDeviceDBus::IsPaired() const { |
| + return !object_path_.value().empty(); |
| +} |
| -bool BluetoothDevice::IsBonded() const { return bonded_; } |
| +bool BluetoothDeviceDBus::IsBonded() const { return bonded_; } |
| -bool BluetoothDevice::IsConnected() const { |
| +bool BluetoothDeviceDBus::IsConnected() const { |
| // TODO(keybuk): examine protocol-specific connected state, such as Input |
| return connected_; |
| } |
| -void BluetoothDevice::GetServiceRecords(const ServiceRecordsCallback& callback, |
| - const ErrorCallback& error_callback) { |
| +void BluetoothDeviceDBus::GetServiceRecords( |
| + const ServiceRecordsCallback& callback, |
| + const ErrorCallback& error_callback) { |
| DBusThreadManager::Get()->GetBluetoothDeviceClient()-> |
| DiscoverServices( |
| object_path_, |
| "", // empty pattern to browse all services |
| - base::Bind(&BluetoothDevice::CollectServiceRecordsCallback, |
| + base::Bind(&BluetoothDeviceDBus::CollectServiceRecordsCallback, |
| weak_ptr_factory_.GetWeakPtr(), |
| callback, |
| error_callback)); |
| } |
| -bool BluetoothDevice::ProvidesServiceWithUUID(const std::string& uuid) const { |
| - const BluetoothDevice::ServiceList& services = GetServices(); |
| - for (BluetoothDevice::ServiceList::const_iterator iter = services.begin(); |
| - iter != services.end(); ++iter) { |
| +bool BluetoothDeviceDBus::ProvidesServiceWithUUID( |
| + const std::string& uuid) const { |
| + const BluetoothDeviceDBus::ServiceList& services = GetServices(); |
| + for (BluetoothDeviceDBus::ServiceList::const_iterator iter = |
| + services.begin(); |
| + iter != services.end(); ++iter) { |
| if (bluetooth_utils::CanonicalUuid(*iter) == uuid) |
| return true; |
| } |
| return false; |
| } |
| -void BluetoothDevice::ProvidesServiceWithName(const std::string& name, |
| +void BluetoothDeviceDBus::ProvidesServiceWithName(const std::string& name, |
| const ProvidesServiceCallback& callback) { |
| GetServiceRecords( |
| - base::Bind(&BluetoothDevice::SearchServicesForNameCallback, |
| + base::Bind(&BluetoothDeviceDBus::SearchServicesForNameCallback, |
| weak_ptr_factory_.GetWeakPtr(), |
| name, |
| callback), |
| - base::Bind(&BluetoothDevice::SearchServicesForNameErrorCallback, |
| + base::Bind(&BluetoothDeviceDBus::SearchServicesForNameErrorCallback, |
| weak_ptr_factory_.GetWeakPtr(), |
| callback)); |
| } |
| -void BluetoothDevice::Connect(PairingDelegate* pairing_delegate, |
| +void BluetoothDeviceDBus::Connect(PairingDelegate* pairing_delegate, |
| const base::Closure& callback, |
| const ErrorCallback& error_callback) { |
| if (IsPaired() || IsBonded() || IsConnected()) { |
| @@ -226,11 +232,11 @@ void BluetoothDevice::Connect(PairingDelegate* pairing_delegate, |
| DBusThreadManager::Get()->GetBluetoothAdapterClient()-> |
| CreateDevice(adapter_->object_path_, |
| address_, |
| - base::Bind(&BluetoothDevice::ConnectCallback, |
| + base::Bind(&BluetoothDeviceDBus::ConnectCallback, |
| weak_ptr_factory_.GetWeakPtr(), |
| callback, |
| error_callback), |
| - base::Bind(&BluetoothDevice::ConnectErrorCallback, |
| + base::Bind(&BluetoothDeviceDBus::ConnectErrorCallback, |
| weak_ptr_factory_.GetWeakPtr(), |
| error_callback)); |
| } else { |
| @@ -259,21 +265,22 @@ void BluetoothDevice::Connect(PairingDelegate* pairing_delegate, |
| DVLOG(1) << "Pairing: " << address_; |
| DBusThreadManager::Get()->GetBluetoothAdapterClient()-> |
| - CreatePairedDevice(adapter_->object_path_, |
| - address_, |
| - agent_path, |
| - bluetooth_agent::kDisplayYesNoCapability, |
| - base::Bind(&BluetoothDevice::ConnectCallback, |
| - weak_ptr_factory_.GetWeakPtr(), |
| - callback, |
| - error_callback), |
| - base::Bind(&BluetoothDevice::ConnectErrorCallback, |
| - weak_ptr_factory_.GetWeakPtr(), |
| - error_callback)); |
| + CreatePairedDevice( |
| + adapter_->object_path_, |
| + address_, |
| + agent_path, |
| + bluetooth_agent::kDisplayYesNoCapability, |
| + base::Bind(&BluetoothDeviceDBus::ConnectCallback, |
| + weak_ptr_factory_.GetWeakPtr(), |
| + callback, |
| + error_callback), |
| + base::Bind(&BluetoothDeviceDBus::ConnectErrorCallback, |
| + weak_ptr_factory_.GetWeakPtr(), |
| + error_callback)); |
| } |
| } |
| -void BluetoothDevice::SetPinCode(const std::string& pincode) { |
| +void BluetoothDeviceDBus::SetPinCode(const std::string& pincode) { |
| if (!agent_.get() || pincode_callback_.is_null()) |
| return; |
| @@ -281,7 +288,7 @@ void BluetoothDevice::SetPinCode(const std::string& pincode) { |
| pincode_callback_.Reset(); |
| } |
| -void BluetoothDevice::SetPasskey(uint32 passkey) { |
| +void BluetoothDeviceDBus::SetPasskey(uint32 passkey) { |
| if (!agent_.get() || passkey_callback_.is_null()) |
| return; |
| @@ -289,7 +296,7 @@ void BluetoothDevice::SetPasskey(uint32 passkey) { |
| passkey_callback_.Reset(); |
| } |
| -void BluetoothDevice::ConfirmPairing() { |
| +void BluetoothDeviceDBus::ConfirmPairing() { |
| if (!agent_.get() || confirmation_callback_.is_null()) |
| return; |
| @@ -297,7 +304,7 @@ void BluetoothDevice::ConfirmPairing() { |
| confirmation_callback_.Reset(); |
| } |
| -void BluetoothDevice::RejectPairing() { |
| +void BluetoothDeviceDBus::RejectPairing() { |
| if (!agent_.get()) |
| return; |
| @@ -315,7 +322,7 @@ void BluetoothDevice::RejectPairing() { |
| } |
| } |
| -void BluetoothDevice::CancelPairing() { |
| +void BluetoothDeviceDBus::CancelPairing() { |
| if (!agent_.get()) |
| return; |
| @@ -333,39 +340,40 @@ void BluetoothDevice::CancelPairing() { |
| } |
| } |
| -void BluetoothDevice::Disconnect(const base::Closure& callback, |
| +void BluetoothDeviceDBus::Disconnect(const base::Closure& callback, |
| const ErrorCallback& error_callback) { |
| DBusThreadManager::Get()->GetBluetoothDeviceClient()-> |
| Disconnect(object_path_, |
| - base::Bind(&BluetoothDevice::DisconnectCallback, |
| + base::Bind(&BluetoothDeviceDBus::DisconnectCallback, |
| weak_ptr_factory_.GetWeakPtr(), |
| callback, |
| error_callback)); |
| } |
| -void BluetoothDevice::Forget(const ErrorCallback& error_callback) { |
| +void BluetoothDeviceDBus::Forget(const ErrorCallback& error_callback) { |
| DBusThreadManager::Get()->GetBluetoothAdapterClient()-> |
| RemoveDevice(adapter_->object_path_, |
| object_path_, |
| - base::Bind(&BluetoothDevice::ForgetCallback, |
| + base::Bind(&BluetoothDeviceDBus::ForgetCallback, |
| weak_ptr_factory_.GetWeakPtr(), |
| error_callback)); |
| } |
| -void BluetoothDevice::ConnectToService(const std::string& service_uuid, |
| - const SocketCallback& callback) { |
| +void BluetoothDeviceDBus::ConnectToService(const std::string& service_uuid, |
| + const SocketCallback& callback) { |
| GetServiceRecords( |
| - base::Bind(&BluetoothDevice::GetServiceRecordsForConnectCallback, |
| + base::Bind(&BluetoothDeviceDBus::GetServiceRecordsForConnectCallback, |
| weak_ptr_factory_.GetWeakPtr(), |
| service_uuid, |
| callback), |
| - base::Bind(&BluetoothDevice::GetServiceRecordsForConnectErrorCallback, |
| - weak_ptr_factory_.GetWeakPtr(), |
| - callback)); |
| + base::Bind( |
| + &BluetoothDeviceDBus::GetServiceRecordsForConnectErrorCallback, |
| + weak_ptr_factory_.GetWeakPtr(), |
| + callback)); |
| } |
| -void BluetoothDevice::SetOutOfBandPairingData( |
| +void BluetoothDeviceDBus::SetOutOfBandPairingData( |
| const chromeos::BluetoothOutOfBandPairingData& data, |
| const base::Closure& callback, |
| const ErrorCallback& error_callback) { |
| @@ -374,36 +382,36 @@ void BluetoothDevice::SetOutOfBandPairingData( |
| object_path_, |
| address(), |
| data, |
| - base::Bind(&BluetoothDevice::OnRemoteDataCallback, |
| + base::Bind(&BluetoothDeviceDBus::OnRemoteDataCallback, |
| weak_ptr_factory_.GetWeakPtr(), |
| callback, |
| error_callback)); |
| } |
| -void BluetoothDevice::ClearOutOfBandPairingData( |
| +void BluetoothDeviceDBus::ClearOutOfBandPairingData( |
| const base::Closure& callback, |
| const ErrorCallback& error_callback) { |
| DBusThreadManager::Get()->GetBluetoothOutOfBandClient()-> |
| RemoveRemoteData( |
| object_path_, |
| address(), |
| - base::Bind(&BluetoothDevice::OnRemoteDataCallback, |
| + base::Bind(&BluetoothDeviceDBus::OnRemoteDataCallback, |
| weak_ptr_factory_.GetWeakPtr(), |
| callback, |
| error_callback)); |
| } |
| -void BluetoothDevice::SetObjectPath(const dbus::ObjectPath& object_path) { |
| +void BluetoothDeviceDBus::SetObjectPath(const dbus::ObjectPath& object_path) { |
| DCHECK(object_path_ == dbus::ObjectPath("")); |
| object_path_ = object_path; |
| } |
| -void BluetoothDevice::RemoveObjectPath() { |
| +void BluetoothDeviceDBus::RemoveObjectPath() { |
| DCHECK(object_path_ != dbus::ObjectPath("")); |
| object_path_ = dbus::ObjectPath(""); |
| } |
| -void BluetoothDevice::Update( |
| +void BluetoothDeviceDBus::Update( |
| const BluetoothDeviceClient::Properties* properties, |
| bool update_state) { |
| std::string address = properties->address.value(); |
| @@ -430,7 +438,7 @@ void BluetoothDevice::Update( |
| } |
| } |
| -void BluetoothDevice::ConnectCallback(const base::Closure& callback, |
| +void BluetoothDeviceDBus::ConnectCallback(const base::Closure& callback, |
| const ErrorCallback& error_callback, |
| const dbus::ObjectPath& device_path) { |
| DVLOG(1) << "Connection successful: " << device_path.value(); |
| @@ -451,7 +459,7 @@ void BluetoothDevice::ConnectCallback(const base::Closure& callback, |
| DBusThreadManager::Get()->GetBluetoothDeviceClient()-> |
| GetProperties(object_path_)->trusted.Set( |
| true, |
| - base::Bind(&BluetoothDevice::OnSetTrusted, |
| + base::Bind(&BluetoothDeviceDBus::OnSetTrusted, |
| weak_ptr_factory_.GetWeakPtr(), |
| callback, |
| error_callback)); |
| @@ -460,15 +468,16 @@ void BluetoothDevice::ConnectCallback(const base::Closure& callback, |
| ConnectApplications(callback, error_callback); |
| } |
| -void BluetoothDevice::ConnectErrorCallback(const ErrorCallback& error_callback, |
| - const std::string& error_name, |
| - const std::string& error_message) { |
| +void BluetoothDeviceDBus::ConnectErrorCallback( |
| + const ErrorCallback& error_callback, |
| + const std::string& error_name, |
| + const std::string& error_message) { |
| LOG(WARNING) << "Connection failed: " << address_ |
| << ": " << error_name << ": " << error_message; |
| error_callback.Run(); |
| } |
| -void BluetoothDevice::CollectServiceRecordsCallback( |
| +void BluetoothDeviceDBus::CollectServiceRecordsCallback( |
| const ServiceRecordsCallback& callback, |
| const ErrorCallback& error_callback, |
| const dbus::ObjectPath& device_path, |
| @@ -488,7 +497,7 @@ void BluetoothDevice::CollectServiceRecordsCallback( |
| callback.Run(records); |
| } |
| -void BluetoothDevice::OnSetTrusted(const base::Closure& callback, |
| +void BluetoothDeviceDBus::OnSetTrusted(const base::Closure& callback, |
| const ErrorCallback& error_callback, |
| bool success) { |
| if (success) { |
| @@ -499,19 +508,19 @@ void BluetoothDevice::OnSetTrusted(const base::Closure& callback, |
| } |
| } |
| -void BluetoothDevice::ConnectApplications(const base::Closure& callback, |
| +void BluetoothDeviceDBus::ConnectApplications(const base::Closure& callback, |
| const ErrorCallback& error_callback) { |
| // Introspect the device object to determine supported applications. |
| DBusThreadManager::Get()->GetIntrospectableClient()-> |
| Introspect(bluetooth_device::kBluetoothDeviceServiceName, |
| object_path_, |
| - base::Bind(&BluetoothDevice::OnIntrospect, |
| + base::Bind(&BluetoothDeviceDBus::OnIntrospect, |
| weak_ptr_factory_.GetWeakPtr(), |
| callback, |
| error_callback)); |
| } |
| -void BluetoothDevice::OnIntrospect(const base::Closure& callback, |
| +void BluetoothDeviceDBus::OnIntrospect(const base::Closure& callback, |
| const ErrorCallback& error_callback, |
| const std::string& service_name, |
| const dbus::ObjectPath& device_path, |
| @@ -539,11 +548,11 @@ void BluetoothDevice::OnIntrospect(const base::Closure& callback, |
| // Supports Input interface. |
| DBusThreadManager::Get()->GetBluetoothInputClient()-> |
| Connect(object_path_, |
| - base::Bind(&BluetoothDevice::OnConnect, |
| + base::Bind(&BluetoothDeviceDBus::OnConnect, |
| weak_ptr_factory_.GetWeakPtr(), |
| callback, |
| *iter), |
| - base::Bind(&BluetoothDevice::OnConnectError, |
| + base::Bind(&BluetoothDeviceDBus::OnConnectError, |
| weak_ptr_factory_.GetWeakPtr(), |
| error_callback, *iter)); |
| } |
| @@ -558,7 +567,7 @@ void BluetoothDevice::OnIntrospect(const base::Closure& callback, |
| callback.Run(); |
| } |
| -void BluetoothDevice::OnConnect(const base::Closure& callback, |
| +void BluetoothDeviceDBus::OnConnect(const base::Closure& callback, |
| const std::string& interface_name, |
| const dbus::ObjectPath& device_path) { |
| DVLOG(1) << "Application connection successful: " << device_path.value() |
| @@ -576,7 +585,7 @@ void BluetoothDevice::OnConnect(const base::Closure& callback, |
| } |
| } |
| -void BluetoothDevice::OnConnectError(const ErrorCallback& error_callback, |
| +void BluetoothDeviceDBus::OnConnectError(const ErrorCallback& error_callback, |
| const std::string& interface_name, |
| const dbus::ObjectPath& device_path, |
| const std::string& error_name, |
| @@ -586,7 +595,7 @@ void BluetoothDevice::OnConnectError(const ErrorCallback& error_callback, |
| error_callback.Run(); |
| } |
| -void BluetoothDevice::DisconnectCallback(const base::Closure& callback, |
| +void BluetoothDeviceDBus::DisconnectCallback(const base::Closure& callback, |
| const ErrorCallback& error_callback, |
| const dbus::ObjectPath& device_path, |
| bool success) { |
| @@ -600,7 +609,7 @@ void BluetoothDevice::DisconnectCallback(const base::Closure& callback, |
| } |
| } |
| -void BluetoothDevice::ForgetCallback(const ErrorCallback& error_callback, |
| +void BluetoothDeviceDBus::ForgetCallback(const ErrorCallback& error_callback, |
| const dbus::ObjectPath& adapter_path, |
| bool success) { |
| // It's quite normal that this path never gets called on success; we use a |
| @@ -614,12 +623,12 @@ void BluetoothDevice::ForgetCallback(const ErrorCallback& error_callback, |
| } |
| } |
| -void BluetoothDevice::SearchServicesForNameErrorCallback( |
| +void BluetoothDeviceDBus::SearchServicesForNameErrorCallback( |
| const ProvidesServiceCallback& callback) { |
| callback.Run(false); |
| } |
| -void BluetoothDevice::SearchServicesForNameCallback( |
| +void BluetoothDeviceDBus::SearchServicesForNameCallback( |
| const std::string& name, |
| const ProvidesServiceCallback& callback, |
| const ServiceRecordList& list) { |
| @@ -633,12 +642,12 @@ void BluetoothDevice::SearchServicesForNameCallback( |
| callback.Run(false); |
| } |
| -void BluetoothDevice::GetServiceRecordsForConnectErrorCallback( |
| +void BluetoothDeviceDBus::GetServiceRecordsForConnectErrorCallback( |
| const SocketCallback& callback) { |
| callback.Run(NULL); |
| } |
| -void BluetoothDevice::GetServiceRecordsForConnectCallback( |
| +void BluetoothDeviceDBus::GetServiceRecordsForConnectCallback( |
| const std::string& service_uuid, |
| const SocketCallback& callback, |
| const ServiceRecordList& list) { |
| @@ -647,7 +656,7 @@ void BluetoothDevice::GetServiceRecordsForConnectCallback( |
| if ((*i)->uuid() == service_uuid) { |
| // If multiple service records are found, use the first one that works. |
| scoped_refptr<BluetoothSocket> socket( |
| - BluetoothSocket::CreateBluetoothSocket(**i)); |
| + BluetoothSocketPosix::CreateBluetoothSocket(**i)); |
| if (socket.get() != NULL) { |
| callback.Run(socket); |
| return; |
| @@ -657,7 +666,7 @@ void BluetoothDevice::GetServiceRecordsForConnectCallback( |
| callback.Run(NULL); |
| } |
| -void BluetoothDevice::OnRemoteDataCallback(const base::Closure& callback, |
| +void BluetoothDeviceDBus::OnRemoteDataCallback(const base::Closure& callback, |
| const ErrorCallback& error_callback, |
| bool success) { |
| if (success) |
| @@ -666,11 +675,12 @@ void BluetoothDevice::OnRemoteDataCallback(const base::Closure& callback, |
| error_callback.Run(); |
| } |
| -void BluetoothDevice::DisconnectRequested(const dbus::ObjectPath& object_path) { |
| +void BluetoothDeviceDBus::DisconnectRequested( |
| + const dbus::ObjectPath& object_path) { |
| DCHECK(object_path == object_path_); |
| } |
| -void BluetoothDevice::Release() { |
| +void BluetoothDeviceDBus::Release() { |
| DCHECK(agent_.get()); |
| DVLOG(1) << "Release: " << address_; |
| @@ -685,8 +695,8 @@ void BluetoothDevice::Release() { |
| agent_.reset(); |
| } |
| -void BluetoothDevice::RequestPinCode(const dbus::ObjectPath& device_path, |
| - const PinCodeCallback& callback) { |
| +void BluetoothDeviceDBus::RequestPinCode(const dbus::ObjectPath& device_path, |
| + const PinCodeCallback& callback) { |
| DCHECK(agent_.get()); |
| DVLOG(1) << "RequestPinCode: " << device_path.value(); |
| @@ -696,8 +706,8 @@ void BluetoothDevice::RequestPinCode(const dbus::ObjectPath& device_path, |
| pairing_delegate_->RequestPinCode(this); |
| } |
| -void BluetoothDevice::RequestPasskey(const dbus::ObjectPath& device_path, |
| - const PasskeyCallback& callback) { |
| +void BluetoothDeviceDBus::RequestPasskey(const dbus::ObjectPath& device_path, |
| + const PasskeyCallback& callback) { |
| DCHECK(agent_.get()); |
| DCHECK(device_path == object_path_); |
| DVLOG(1) << "RequestPasskey: " << device_path.value(); |
| @@ -708,8 +718,8 @@ void BluetoothDevice::RequestPasskey(const dbus::ObjectPath& device_path, |
| pairing_delegate_->RequestPasskey(this); |
| } |
| -void BluetoothDevice::DisplayPinCode(const dbus::ObjectPath& device_path, |
| - const std::string& pincode) { |
| +void BluetoothDeviceDBus::DisplayPinCode(const dbus::ObjectPath& device_path, |
| + const std::string& pincode) { |
| DCHECK(agent_.get()); |
| DCHECK(device_path == object_path_); |
| DVLOG(1) << "DisplayPinCode: " << device_path.value() << " " << pincode; |
| @@ -718,8 +728,8 @@ void BluetoothDevice::DisplayPinCode(const dbus::ObjectPath& device_path, |
| pairing_delegate_->DisplayPinCode(this, pincode); |
| } |
| -void BluetoothDevice::DisplayPasskey(const dbus::ObjectPath& device_path, |
| - uint32 passkey) { |
| +void BluetoothDeviceDBus::DisplayPasskey(const dbus::ObjectPath& device_path, |
| + uint32 passkey) { |
| DCHECK(agent_.get()); |
| DCHECK(device_path == object_path_); |
| DVLOG(1) << "DisplayPasskey: " << device_path.value() << " " << passkey; |
| @@ -728,7 +738,7 @@ void BluetoothDevice::DisplayPasskey(const dbus::ObjectPath& device_path, |
| pairing_delegate_->DisplayPasskey(this, passkey); |
| } |
| -void BluetoothDevice::RequestConfirmation( |
| +void BluetoothDeviceDBus::RequestConfirmation( |
| const dbus::ObjectPath& device_path, |
| uint32 passkey, |
| const ConfirmationCallback& callback) { |
| @@ -742,9 +752,9 @@ void BluetoothDevice::RequestConfirmation( |
| pairing_delegate_->ConfirmPasskey(this, passkey); |
| } |
| -void BluetoothDevice::Authorize(const dbus::ObjectPath& device_path, |
| - const std::string& uuid, |
| - const ConfirmationCallback& callback) { |
| +void BluetoothDeviceDBus::Authorize(const dbus::ObjectPath& device_path, |
| + const std::string& uuid, |
| + const ConfirmationCallback& callback) { |
| DCHECK(agent_.get()); |
| DCHECK(device_path == object_path_); |
| LOG(WARNING) << "Rejected authorization for service: " << uuid |
| @@ -752,15 +762,16 @@ void BluetoothDevice::Authorize(const dbus::ObjectPath& device_path, |
| callback.Run(REJECTED); |
| } |
| -void BluetoothDevice::ConfirmModeChange(Mode mode, |
| - const ConfirmationCallback& callback) { |
| +void BluetoothDeviceDBus::ConfirmModeChange( |
| + Mode mode, |
| + const ConfirmationCallback& callback) { |
| DCHECK(agent_.get()); |
| LOG(WARNING) << "Rejected adapter-level mode change: " << mode |
| << " made on agent for device: " << address_; |
| callback.Run(REJECTED); |
| } |
| -void BluetoothDevice::Cancel() { |
| +void BluetoothDeviceDBus::Cancel() { |
| DCHECK(agent_.get()); |
| DVLOG(1) << "Cancel: " << address_; |
| @@ -770,8 +781,9 @@ void BluetoothDevice::Cancel() { |
| // static |
| -BluetoothDevice* BluetoothDevice::Create(BluetoothAdapter* adapter) { |
| - return new BluetoothDevice(adapter); |
| +BluetoothDeviceDBus* BluetoothDeviceDBus::Create( |
| + BluetoothAdapterDBus* adapter) { |
| + return new BluetoothDeviceDBus(adapter); |
| } |
| } // namespace chromeos |