Chromium Code Reviews| Index: content/child/bluetooth/bluetooth_dispatcher.cc |
| diff --git a/content/child/bluetooth/bluetooth_dispatcher.cc b/content/child/bluetooth/bluetooth_dispatcher.cc |
| index fb1cec8ba73ccd03d2ba023a51eaf5dadc188cba..05a77201011e7f866641ecb776fbaf2b678de788 100644 |
| --- a/content/child/bluetooth/bluetooth_dispatcher.cc |
| +++ b/content/child/bluetooth/bluetooth_dispatcher.cc |
| @@ -12,10 +12,13 @@ |
| #include "content/common/bluetooth/bluetooth_messages.h" |
| #include "third_party/WebKit/public/platform/modules/bluetooth/WebBluetoothDevice.h" |
| #include "third_party/WebKit/public/platform/modules/bluetooth/WebBluetoothError.h" |
| +#include "third_party/WebKit/public/platform/modules/bluetooth/WebBluetoothGATTRemoteServer.h" |
| using blink::WebBluetoothDevice; |
| using blink::WebBluetoothError; |
| using blink::WebBluetoothRequestDeviceCallbacks; |
| +using blink::WebBluetoothGATTRemoteServer; |
|
scheib
2015/04/19 04:44:19
sort these lines. (surprised a script didn't menti
ortuno
2015/04/20 20:09:33
Done.
|
| +using blink::WebBluetoothConnectGATTCallbacks; |
| using blink::WebString; |
| using blink::WebVector; |
| @@ -95,6 +98,7 @@ void BluetoothDispatcher::OnMessageReceived(const IPC::Message& msg) { |
| IPC_MESSAGE_HANDLER(BluetoothMsg_RequestDeviceSuccess, |
| OnRequestDeviceSuccess); |
| IPC_MESSAGE_HANDLER(BluetoothMsg_RequestDeviceError, OnRequestDeviceError); |
| + IPC_MESSAGE_HANDLER(BluetoothMsg_ConnectGATTSuccess, OnConnectGATTSuccess); |
| IPC_MESSAGE_UNHANDLED(handled = false) |
| IPC_END_MESSAGE_MAP() |
| DCHECK(handled) << "Unhandled message:" << msg.type(); |
| @@ -106,6 +110,13 @@ void BluetoothDispatcher::requestDevice( |
| Send(new BluetoothHostMsg_RequestDevice(CurrentWorkerId(), request_id)); |
| } |
| +void BluetoothDispatcher::connectGATT(std::string instance_id, |
| + blink::WebBluetoothConnectGATTCallbacks* callbacks) { |
| + int request_id = pending_connect_requests_.Add(callbacks); |
| + Send(new BluetoothHostMsg_ConnectGATT(CurrentWorkerId(), request_id, |
| + instance_id)); |
| +} |
| + |
| void BluetoothDispatcher::SetBluetoothMockDataSetForTesting( |
| const std::string& name) { |
| Send(new BluetoothHostMsg_SetBluetoothMockDataSetForTesting(name)); |
| @@ -134,6 +145,16 @@ void BluetoothDispatcher::OnRequestDeviceSuccess( |
| pending_requests_.Remove(request_id); |
| } |
| +void BluetoothDispatcher::OnConnectGATTSuccess(int thread_id, |
| + int request_id, |
| + const std::string& instance_id) { |
| + DCHECK(pending_connect_requests_.Lookup(request_id)) << request_id; |
|
Tom Sepez
2015/04/20 15:54:00
This is in the renderer, so it OK to assume that t
scheib
2015/04/20 16:50:12
Right. If the browser is functioning correctly it
|
| + pending_connect_requests_.Lookup(request_id) |
| + ->onSuccess(new WebBluetoothGATTRemoteServer( |
| + WebString::fromUTF8(instance_id), true /* connected */)); |
| + pending_connect_requests_.Remove(request_id); |
| +} |
| + |
| void BluetoothDispatcher::OnRequestDeviceError(int thread_id, |
| int request_id, |
| BluetoothError error_type) { |