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 #ifndef CONTENT_CHILD_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_ |
6 #define CONTENT_CHILD_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_ | 6 #define CONTENT_RENDERER_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
16 #include "third_party/WebKit/public/platform/modules/bluetooth/WebBluetooth.h" | 16 #include "third_party/WebKit/public/platform/modules/bluetooth/WebBluetooth.h" |
17 #include "third_party/WebKit/public/platform/modules/bluetooth/web_bluetooth.moj om.h" | |
17 | 18 |
18 namespace blink { | 19 namespace blink { |
19 class WebBluetoothRemoteGATTCharacteristic; | 20 class WebBluetoothRemoteGATTCharacteristic; |
20 } | 21 } |
21 | 22 |
22 namespace content { | 23 namespace content { |
23 | 24 |
24 class BluetoothDispatcher; | 25 class BluetoothDispatcher; |
25 class ThreadSafeSender; | 26 class ThreadSafeSender; |
27 class ServiceRegistry; | |
26 | 28 |
27 // Implementation of blink::WebBluetooth. Passes calls through to the thread | 29 // Implementation of blink::WebBluetooth. Passes calls through to the thread |
28 // specific BluetoothDispatcher. | 30 // specific BluetoothDispatcher. |
29 class CONTENT_EXPORT WebBluetoothImpl | 31 class CONTENT_EXPORT WebBluetoothImpl |
30 : NON_EXPORTED_BASE(public blink::WebBluetooth) { | 32 : NON_EXPORTED_BASE(public blink::WebBluetooth) { |
31 public: | 33 public: |
32 explicit WebBluetoothImpl(ThreadSafeSender* thread_safe_sender); | 34 WebBluetoothImpl(ServiceRegistry* service_registry, |
33 WebBluetoothImpl(ThreadSafeSender* thread_safe_sender, int frame_routing_id); | 35 ThreadSafeSender* thread_safe_sender, |
36 int frame_routing_id); | |
34 ~WebBluetoothImpl() override; | 37 ~WebBluetoothImpl() override; |
35 | 38 |
36 // blink::WebBluetooth interface: | 39 // blink::WebBluetooth interface: |
37 void requestDevice( | 40 void requestDevice( |
38 const blink::WebRequestDeviceOptions& options, | 41 const blink::WebRequestDeviceOptions& options, |
39 blink::WebBluetoothRequestDeviceCallbacks* callbacks) override; | 42 blink::WebBluetoothRequestDeviceCallbacks* callbacks) override; |
40 void connect( | 43 void connect( |
41 const blink::WebString& device_id, | 44 const blink::WebString& device_id, |
42 blink::WebBluetoothRemoteGATTServerConnectCallbacks* callbacks) override; | 45 blink::WebBluetoothRemoteGATTServerConnectCallbacks* callbacks) override; |
43 void disconnect(const blink::WebString& device_id) override; | 46 void disconnect(const blink::WebString& device_id) override; |
(...skipping 24 matching lines...) Expand all Loading... | |
68 blink::WebBluetoothRemoteGATTCharacteristic* characteristic, | 71 blink::WebBluetoothRemoteGATTCharacteristic* characteristic, |
69 blink::WebBluetoothNotificationsCallbacks*) override; | 72 blink::WebBluetoothNotificationsCallbacks*) override; |
70 void characteristicObjectRemoved( | 73 void characteristicObjectRemoved( |
71 const blink::WebString& characteristic_instance_id, | 74 const blink::WebString& characteristic_instance_id, |
72 blink::WebBluetoothRemoteGATTCharacteristic* characteristic) override; | 75 blink::WebBluetoothRemoteGATTCharacteristic* characteristic) override; |
73 void registerCharacteristicObject( | 76 void registerCharacteristicObject( |
74 const blink::WebString& characteristic_instance_id, | 77 const blink::WebString& characteristic_instance_id, |
75 blink::WebBluetoothRemoteGATTCharacteristic* characteristic) override; | 78 blink::WebBluetoothRemoteGATTCharacteristic* characteristic) override; |
76 | 79 |
77 private: | 80 private: |
81 void OnWriteValue( | |
Jeffrey Yasskin
2016/03/25 00:48:24
Maybe "OnWriteValueComplete"?
ortuno
2016/03/29 17:58:34
Done.
| |
82 const blink::WebVector<uint8_t>& value, | |
83 scoped_ptr<blink::WebBluetoothWriteValueCallbacks> callbacks, | |
84 blink::mojom::WebBluetoothError error); | |
85 | |
78 BluetoothDispatcher* GetDispatcher(); | 86 BluetoothDispatcher* GetDispatcher(); |
79 | 87 |
88 blink::mojom::WebBluetoothServicePtr& GetWebBluetoothService(); | |
89 ServiceRegistry* service_registry_; | |
Jeffrey Yasskin
2016/03/25 00:48:24
Make this a 'ServiceRegistry* const' if possible.
ortuno
2016/03/29 17:58:34
Done.
| |
90 blink::mojom::WebBluetoothServicePtr web_bluetooth_service_; | |
91 | |
80 const scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 92 const scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
81 const int frame_routing_id_; | 93 const int frame_routing_id_; |
82 | 94 |
83 DISALLOW_COPY_AND_ASSIGN(WebBluetoothImpl); | 95 DISALLOW_COPY_AND_ASSIGN(WebBluetoothImpl); |
84 }; | 96 }; |
85 | 97 |
86 } // namespace content | 98 } // namespace content |
87 | 99 |
88 #endif // CONTENT_CHILD_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_ | 100 #endif // CONTENT_RENDERER_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_ |
OLD | NEW |