Index: device/bluetooth/bluetooth_device.cc |
diff --git a/device/bluetooth/bluetooth_device.cc b/device/bluetooth/bluetooth_device.cc |
index 2f1513bf972177e2daa9c455a65ebf3f9e4d7583..fc16650ed236efab3a00a0a6f00e76bc4b0ecdae 100644 |
--- a/device/bluetooth/bluetooth_device.cc |
+++ b/device/bluetooth/bluetooth_device.cc |
@@ -203,16 +203,19 @@ bool BluetoothDevice::IsTrustable() const { |
return false; |
} |
-void BluetoothDevice::CreateGattConnection( |
+scoped_ptr<device::BluetoothGattConnection> |
+BluetoothDevice::CreateGattConnection( |
const GattConnectionCallback& callback, |
const ConnectErrorCallback& error_callback) { |
create_gatt_connection_success_callbacks_.push_back(callback); |
create_gatt_connection_error_callbacks_.push_back(error_callback); |
- if (IsGattConnected()) |
- return DidConnectGatt(); |
+ if (IsGattConnected()) { |
+ DidConnectGatt(); |
+ return ExistingGattConnection().Pass(); |
+ } |
- CreateGattConnectionImpl(); |
+ return CreateGattConnectionImpl().Pass(); |
} |
std::vector<BluetoothGattService*> |
@@ -289,9 +292,9 @@ BluetoothDevice::UUIDList BluetoothDevice::GetServiceDataUUIDs() const { |
} |
void BluetoothDevice::DidConnectGatt() { |
+ VLOG(1) << "BluetoothDevice::DidConnectGatt"; |
for (const auto& callback : create_gatt_connection_success_callbacks_) { |
- callback.Run( |
- make_scoped_ptr(new BluetoothGattConnection(adapter_, GetAddress()))); |
+ callback.Run(); |
} |
create_gatt_connection_success_callbacks_.clear(); |
create_gatt_connection_error_callbacks_.clear(); |