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