OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/renderer/bluetooth/web_bluetooth_impl.h" | 5 #include "content/renderer/bluetooth/web_bluetooth_impl.h" |
6 | 6 |
7 #include "content/child/thread_safe_sender.h" | 7 #include "content/child/thread_safe_sender.h" |
8 #include "content/renderer/bluetooth/bluetooth_dispatcher.h" | 8 #include "content/renderer/bluetooth/bluetooth_dispatcher.h" |
9 #include "ipc/ipc_message.h" | 9 #include "ipc/ipc_message.h" |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 void WebBluetoothImpl::requestDevice( | 24 void WebBluetoothImpl::requestDevice( |
25 const blink::WebRequestDeviceOptions& options, | 25 const blink::WebRequestDeviceOptions& options, |
26 blink::WebBluetoothRequestDeviceCallbacks* callbacks) { | 26 blink::WebBluetoothRequestDeviceCallbacks* callbacks) { |
27 GetDispatcher()->requestDevice(frame_routing_id_, options, callbacks); | 27 GetDispatcher()->requestDevice(frame_routing_id_, options, callbacks); |
28 } | 28 } |
29 | 29 |
30 void WebBluetoothImpl::connectGATT( | 30 void WebBluetoothImpl::connectGATT( |
31 const blink::WebString& device_id, | 31 const blink::WebString& device_id, |
32 blink::WebBluetoothConnectGATTCallbacks* callbacks) { | 32 blink::WebBluetoothConnectGATTCallbacks* callbacks) { |
33 GetDispatcher()->connectGATT(device_id, callbacks); | 33 GetDispatcher()->connectGATT(frame_routing_id_, device_id, callbacks); |
34 } | 34 } |
35 | 35 |
36 void WebBluetoothImpl::getPrimaryService( | 36 void WebBluetoothImpl::getPrimaryService( |
37 const blink::WebString& device_id, | 37 const blink::WebString& device_id, |
38 const blink::WebString& service_uuid, | 38 const blink::WebString& service_uuid, |
39 blink::WebBluetoothGetPrimaryServiceCallbacks* callbacks) { | 39 blink::WebBluetoothGetPrimaryServiceCallbacks* callbacks) { |
40 GetDispatcher()->getPrimaryService(device_id, service_uuid, callbacks); | 40 GetDispatcher()->getPrimaryService(frame_routing_id_, device_id, service_uuid, |
| 41 callbacks); |
41 } | 42 } |
42 | 43 |
43 void WebBluetoothImpl::getCharacteristic( | 44 void WebBluetoothImpl::getCharacteristic( |
44 const blink::WebString& service_instance_id, | 45 const blink::WebString& service_instance_id, |
45 const blink::WebString& characteristic_uuid, | 46 const blink::WebString& characteristic_uuid, |
46 blink::WebBluetoothGetCharacteristicCallbacks* callbacks) { | 47 blink::WebBluetoothGetCharacteristicCallbacks* callbacks) { |
47 GetDispatcher()->getCharacteristic(service_instance_id, characteristic_uuid, | 48 GetDispatcher()->getCharacteristic(frame_routing_id_, service_instance_id, |
48 callbacks); | 49 characteristic_uuid, callbacks); |
49 } | 50 } |
50 | 51 |
51 void WebBluetoothImpl::readValue( | 52 void WebBluetoothImpl::readValue( |
52 const blink::WebString& characteristic_instance_id, | 53 const blink::WebString& characteristic_instance_id, |
53 blink::WebBluetoothReadValueCallbacks* callbacks) { | 54 blink::WebBluetoothReadValueCallbacks* callbacks) { |
54 GetDispatcher()->readValue(characteristic_instance_id, callbacks); | 55 GetDispatcher()->readValue(frame_routing_id_, characteristic_instance_id, |
| 56 callbacks); |
55 } | 57 } |
56 | 58 |
57 void WebBluetoothImpl::writeValue( | 59 void WebBluetoothImpl::writeValue( |
58 const blink::WebString& characteristic_instance_id, | 60 const blink::WebString& characteristic_instance_id, |
59 const blink::WebVector<uint8_t>& value, | 61 const blink::WebVector<uint8_t>& value, |
60 blink::WebBluetoothWriteValueCallbacks* callbacks) { | 62 blink::WebBluetoothWriteValueCallbacks* callbacks) { |
61 GetDispatcher()->writeValue(characteristic_instance_id, value, callbacks); | 63 GetDispatcher()->writeValue(frame_routing_id_, characteristic_instance_id, |
| 64 value, callbacks); |
62 } | 65 } |
63 | 66 |
64 void WebBluetoothImpl::startNotifications( | 67 void WebBluetoothImpl::startNotifications( |
65 const blink::WebString& characteristic_instance_id, | 68 const blink::WebString& characteristic_instance_id, |
66 blink::WebBluetoothGATTCharacteristic* characteristic, | 69 blink::WebBluetoothGATTCharacteristic* characteristic, |
67 blink::WebBluetoothNotificationsCallbacks* callbacks) { | 70 blink::WebBluetoothNotificationsCallbacks* callbacks) { |
68 GetDispatcher()->startNotifications(characteristic_instance_id, | 71 GetDispatcher()->startNotifications( |
69 characteristic, callbacks); | 72 frame_routing_id_, characteristic_instance_id, characteristic, callbacks); |
70 } | 73 } |
71 | 74 |
72 void WebBluetoothImpl::stopNotifications( | 75 void WebBluetoothImpl::stopNotifications( |
73 const blink::WebString& characteristic_instance_id, | 76 const blink::WebString& characteristic_instance_id, |
74 blink::WebBluetoothGATTCharacteristic* characteristic, | 77 blink::WebBluetoothGATTCharacteristic* characteristic, |
75 blink::WebBluetoothNotificationsCallbacks* callbacks) { | 78 blink::WebBluetoothNotificationsCallbacks* callbacks) { |
76 GetDispatcher()->stopNotifications(characteristic_instance_id, characteristic, | 79 GetDispatcher()->stopNotifications( |
77 callbacks); | 80 frame_routing_id_, characteristic_instance_id, characteristic, callbacks); |
78 } | 81 } |
79 | 82 |
80 void WebBluetoothImpl::characteristicObjectRemoved( | 83 void WebBluetoothImpl::characteristicObjectRemoved( |
81 const blink::WebString& characteristic_instance_id, | 84 const blink::WebString& characteristic_instance_id, |
82 blink::WebBluetoothGATTCharacteristic* characteristic) { | 85 blink::WebBluetoothGATTCharacteristic* characteristic) { |
83 GetDispatcher()->characteristicObjectRemoved(characteristic_instance_id, | 86 GetDispatcher()->characteristicObjectRemoved( |
84 characteristic); | 87 frame_routing_id_, characteristic_instance_id, characteristic); |
85 } | 88 } |
86 | 89 |
87 void WebBluetoothImpl::registerCharacteristicObject( | 90 void WebBluetoothImpl::registerCharacteristicObject( |
88 const blink::WebString& characteristic_instance_id, | 91 const blink::WebString& characteristic_instance_id, |
89 blink::WebBluetoothGATTCharacteristic* characteristic) { | 92 blink::WebBluetoothGATTCharacteristic* characteristic) { |
90 GetDispatcher()->registerCharacteristicObject(characteristic_instance_id, | 93 GetDispatcher()->registerCharacteristicObject( |
91 characteristic); | 94 frame_routing_id_, characteristic_instance_id, characteristic); |
92 } | 95 } |
93 | 96 |
94 BluetoothDispatcher* WebBluetoothImpl::GetDispatcher() { | 97 BluetoothDispatcher* WebBluetoothImpl::GetDispatcher() { |
95 return BluetoothDispatcher::GetOrCreateThreadSpecificInstance( | 98 return BluetoothDispatcher::GetOrCreateThreadSpecificInstance( |
96 thread_safe_sender_.get()); | 99 thread_safe_sender_.get()); |
97 } | 100 } |
98 | 101 |
99 } // namespace content | 102 } // namespace content |
OLD | NEW |