Chromium Code Reviews| Index: content/renderer/bluetooth/web_bluetooth_impl.cc |
| diff --git a/content/renderer/bluetooth/web_bluetooth_impl.cc b/content/renderer/bluetooth/web_bluetooth_impl.cc |
| index 1f1615ffdd2ce1984c3dc3ba6f4b3c24938c3c1f..7e7230d8b33f92846adbda413c0d505b8898518f 100644 |
| --- a/content/renderer/bluetooth/web_bluetooth_impl.cc |
| +++ b/content/renderer/bluetooth/web_bluetooth_impl.cc |
| @@ -41,11 +41,15 @@ void WebBluetoothImpl::requestDevice( |
| void WebBluetoothImpl::connect( |
| const blink::WebString& device_id, |
| blink::WebBluetoothRemoteGATTServerConnectCallbacks* callbacks) { |
| - GetDispatcher()->connect(frame_routing_id_, device_id, callbacks); |
| + GetWebBluetoothService().RemoteServerConnect( |
| + mojo::String::From(device_id), |
| + base::Bind(&WebBluetoothImpl::OnConnectComplete, base::Unretained(this), |
| + base::Passed(base::WrapUnique(callbacks)))); |
| } |
| void WebBluetoothImpl::disconnect(const blink::WebString& device_id) { |
|
Jeffrey Yasskin
2016/05/03 01:15:57
We need this to cancel every in-progress operation
ortuno
2016/05/03 16:11:54
Acknowledged. Thanks for opening the issue!
|
| - GetDispatcher()->disconnect(frame_routing_id_, device_id); |
| + GetWebBluetoothService().RemoteServerDisconnect( |
| + mojo::String::From(device_id)); |
| } |
| void WebBluetoothImpl::getPrimaryService( |
| @@ -142,6 +146,17 @@ void WebBluetoothImpl::RemoteCharacteristicValueChanged( |
| value.PassStorage())); |
| } |
| +void WebBluetoothImpl::OnConnectComplete( |
| + std::unique_ptr<blink::WebBluetoothRemoteGATTServerConnectCallbacks> |
| + callbacks, |
| + blink::mojom::WebBluetoothError error) { |
| + if (error == blink::mojom::WebBluetoothError::SUCCESS) { |
| + callbacks->onSuccess(); |
| + } else { |
| + callbacks->onError(error); |
| + } |
| +} |
| + |
| void WebBluetoothImpl::OnGetPrimaryServiceComplete( |
| const blink::WebString& device_id, |
| std::unique_ptr<blink::WebBluetoothGetPrimaryServiceCallbacks> callbacks, |