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 | 10 |
10 namespace content { | 11 namespace content { |
11 | 12 |
12 WebBluetoothImpl::WebBluetoothImpl(ThreadSafeSender* thread_safe_sender) | 13 WebBluetoothImpl::WebBluetoothImpl(ThreadSafeSender* thread_safe_sender) |
13 : thread_safe_sender_(thread_safe_sender) { | 14 : WebBluetoothImpl(thread_safe_sender, MSG_ROUTING_NONE) {} |
14 } | 15 |
| 16 WebBluetoothImpl::WebBluetoothImpl(ThreadSafeSender* thread_safe_sender, |
| 17 int frame_routing_id) |
| 18 : thread_safe_sender_(thread_safe_sender), |
| 19 frame_routing_id_(frame_routing_id) {} |
15 | 20 |
16 WebBluetoothImpl::~WebBluetoothImpl() { | 21 WebBluetoothImpl::~WebBluetoothImpl() { |
17 } | 22 } |
18 | 23 |
19 void WebBluetoothImpl::requestDevice( | 24 void WebBluetoothImpl::requestDevice( |
20 const blink::WebRequestDeviceOptions& options, | 25 const blink::WebRequestDeviceOptions& options, |
21 blink::WebBluetoothRequestDeviceCallbacks* callbacks) { | 26 blink::WebBluetoothRequestDeviceCallbacks* callbacks) { |
22 GetDispatcher()->requestDevice(options, callbacks); | 27 GetDispatcher()->requestDevice(frame_routing_id_, options, callbacks); |
23 } | 28 } |
24 | 29 |
25 void WebBluetoothImpl::connectGATT(const blink::WebString& device_instance_id, | 30 void WebBluetoothImpl::connectGATT(const blink::WebString& device_instance_id, |
26 blink::WebBluetoothConnectGATTCallbacks* callbacks) { | 31 blink::WebBluetoothConnectGATTCallbacks* callbacks) { |
27 GetDispatcher()->connectGATT(device_instance_id, callbacks); | 32 GetDispatcher()->connectGATT(device_instance_id, callbacks); |
28 } | 33 } |
29 | 34 |
30 void WebBluetoothImpl::getPrimaryService( | 35 void WebBluetoothImpl::getPrimaryService( |
31 const blink::WebString& device_instance_id, | 36 const blink::WebString& device_instance_id, |
32 const blink::WebString& service_uuid, | 37 const blink::WebString& service_uuid, |
(...skipping 22 matching lines...) Expand all Loading... |
55 blink::WebBluetoothWriteValueCallbacks* callbacks) { | 60 blink::WebBluetoothWriteValueCallbacks* callbacks) { |
56 GetDispatcher()->writeValue(characteristic_instance_id, value, callbacks); | 61 GetDispatcher()->writeValue(characteristic_instance_id, value, callbacks); |
57 } | 62 } |
58 | 63 |
59 BluetoothDispatcher* WebBluetoothImpl::GetDispatcher() { | 64 BluetoothDispatcher* WebBluetoothImpl::GetDispatcher() { |
60 return BluetoothDispatcher::GetOrCreateThreadSpecificInstance( | 65 return BluetoothDispatcher::GetOrCreateThreadSpecificInstance( |
61 thread_safe_sender_.get()); | 66 thread_safe_sender_.get()); |
62 } | 67 } |
63 | 68 |
64 } // namespace content | 69 } // namespace content |
OLD | NEW |