Index: device/bluetooth/bluetooth_device_chromeos.cc |
diff --git a/device/bluetooth/bluetooth_device_chromeos.cc b/device/bluetooth/bluetooth_device_chromeos.cc |
index e0fc0fde0824e01cc0397b5a0c4edc6577ec3357..c8085699ef6b0231a2685fcf9c3a0d3197649672 100644 |
--- a/device/bluetooth/bluetooth_device_chromeos.cc |
+++ b/device/bluetooth/bluetooth_device_chromeos.cc |
@@ -18,6 +18,7 @@ |
#include "chromeos/dbus/dbus_thread_manager.h" |
#include "dbus/bus.h" |
#include "device/bluetooth/bluetooth_adapter_chromeos.h" |
+#include "device/bluetooth/bluetooth_gatt_connection_chromeos.h" |
#include "device/bluetooth/bluetooth_pairing_chromeos.h" |
#include "device/bluetooth/bluetooth_remote_gatt_service_chromeos.h" |
#include "device/bluetooth/bluetooth_socket.h" |
@@ -453,8 +454,13 @@ void BluetoothDeviceChromeOS::ConnectToService( |
void BluetoothDeviceChromeOS::CreateGattConnection( |
const GattConnectionCallback& callback, |
const ConnectErrorCallback& error_callback) { |
- // TODO(armansito): Implement. |
- error_callback.Run(ERROR_UNSUPPORTED_DEVICE); |
+ // TODO(armansito): Until there is a way to create a reference counted GATT |
+ // connection in bluetoothd, simply do a regular connect. |
+ Connect(NULL, |
+ base::Bind(&BluetoothDeviceChromeOS::OnCreateGattConnection, |
+ weak_ptr_factory_.GetWeakPtr(), |
+ callback), |
+ error_callback); |
} |
void BluetoothDeviceChromeOS::StartConnectionMonitor( |
@@ -568,6 +574,14 @@ void BluetoothDeviceChromeOS::OnConnect(bool after_pairing, |
callback.Run(); |
} |
+void BluetoothDeviceChromeOS::OnCreateGattConnection( |
+ const GattConnectionCallback& callback) { |
+ scoped_ptr<device::BluetoothGattConnection> conn( |
+ new BluetoothGattConnectionChromeOS( |
+ adapter_, GetAddress(), object_path_)); |
+ callback.Run(conn.Pass()); |
+} |
+ |
void BluetoothDeviceChromeOS::OnConnectError( |
bool after_pairing, |
const ConnectErrorCallback& error_callback, |