| Index: device/bluetooth/bluetooth_device_experimental_chromeos.cc
|
| diff --git a/device/bluetooth/bluetooth_device_experimental_chromeos.cc b/device/bluetooth/bluetooth_device_experimental_chromeos.cc
|
| index 92b4d94089581ce717cc4c19ab925b8f8e7204ea..bbdba343e2442fe79e4d56fc806b8eef7e8ef74a 100644
|
| --- a/device/bluetooth/bluetooth_device_experimental_chromeos.cc
|
| +++ b/device/bluetooth/bluetooth_device_experimental_chromeos.cc
|
| @@ -16,6 +16,7 @@
|
| #include "chromeos/dbus/experimental_bluetooth_input_client.h"
|
| #include "dbus/bus.h"
|
| #include "device/bluetooth/bluetooth_adapter_experimental_chromeos.h"
|
| +#include "device/bluetooth/bluetooth_profile_experimental_chromeos.h"
|
| #include "device/bluetooth/bluetooth_socket.h"
|
| #include "third_party/cros_system_api/dbus/service_constants.h"
|
|
|
| @@ -359,8 +360,24 @@ void BluetoothDeviceExperimentalChromeOS::ConnectToProfile(
|
| device::BluetoothProfile* profile,
|
| const base::Closure& callback,
|
| const ErrorCallback& error_callback) {
|
| - // TODO(keybuk): implement
|
| - error_callback.Run();
|
| + BluetoothProfileExperimentalChromeOS* profile_chromeos =
|
| + static_cast<BluetoothProfileExperimentalChromeOS*>(profile);
|
| + VLOG(1) << object_path_.value() << ": Connecting profile: "
|
| + << profile_chromeos->uuid();
|
| + DBusThreadManager::Get()->GetExperimentalBluetoothDeviceClient()->
|
| + ConnectProfile(
|
| + object_path_,
|
| + profile_chromeos->uuid(),
|
| + base::Bind(
|
| + &BluetoothDeviceExperimentalChromeOS::OnConnectProfile,
|
| + weak_ptr_factory_.GetWeakPtr(),
|
| + profile,
|
| + callback),
|
| + base::Bind(
|
| + &BluetoothDeviceExperimentalChromeOS::OnConnectProfileError,
|
| + weak_ptr_factory_.GetWeakPtr(),
|
| + profile,
|
| + error_callback));
|
| }
|
|
|
| void BluetoothDeviceExperimentalChromeOS::SetOutOfBandPairingData(
|
| @@ -794,4 +811,27 @@ void BluetoothDeviceExperimentalChromeOS::RecordPairingResult(
|
| UMA_PAIRING_RESULT_COUNT);
|
| }
|
|
|
| +void BluetoothDeviceExperimentalChromeOS::OnConnectProfile(
|
| + device::BluetoothProfile* profile,
|
| + const base::Closure& callback) {
|
| + BluetoothProfileExperimentalChromeOS* profile_chromeos =
|
| + static_cast<BluetoothProfileExperimentalChromeOS*>(profile);
|
| + VLOG(1) << object_path_.value() << ": Profile connected: "
|
| + << profile_chromeos->uuid();
|
| + callback.Run();
|
| +}
|
| +
|
| +void BluetoothDeviceExperimentalChromeOS::OnConnectProfileError(
|
| + device::BluetoothProfile* profile,
|
| + const ErrorCallback& error_callback,
|
| + const std::string& error_name,
|
| + const std::string& error_message) {
|
| + BluetoothProfileExperimentalChromeOS* profile_chromeos =
|
| + static_cast<BluetoothProfileExperimentalChromeOS*>(profile);
|
| + VLOG(1) << object_path_.value() << ": Profile connection failed: "
|
| + << profile_chromeos->uuid() << ": "
|
| + << error_name << ": " << error_message;
|
| + error_callback.Run();
|
| +}
|
| +
|
| } // namespace chromeos
|
|
|