Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: third_party/WebKit/public/platform/modules/bluetooth/WebBluetooth.h

Issue 2142813003: bluetooth: Avoid including non-blink mojo bindings in blink code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Add DCHECK for enum Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 WebBluetooth_h 5 #ifndef WebBluetooth_h
6 #define WebBluetooth_h 6 #define WebBluetooth_h
7 7
8 #include "public/platform/WebCallbacks.h" 8 #include "public/platform/WebCallbacks.h"
9 #include "public/platform/WebString.h" 9 #include "public/platform/WebString.h"
10 #include "public/platform/WebVector.h" 10 #include "public/platform/WebVector.h"
11 #include "public/platform/modules/bluetooth/WebBluetoothError.h"
12 #include "public/platform/modules/bluetooth/web_bluetooth.mojom.h"
13 11
14 #include <memory> 12 #include <memory>
15 13
16 namespace blink { 14 namespace blink {
17 15
18 class WebBluetoothDevice; 16 class WebBluetoothDevice;
19 class WebBluetoothRemoteGATTCharacteristic; 17 class WebBluetoothRemoteGATTCharacteristic;
20 18
21 struct WebBluetoothDeviceInit; 19 struct WebBluetoothDeviceInit;
22 struct WebBluetoothRemoteGATTCharacteristicInit; 20 struct WebBluetoothRemoteGATTCharacteristicInit;
23 struct WebBluetoothRemoteGATTService; 21 struct WebBluetoothRemoteGATTService;
24 struct WebRequestDeviceOptions; 22 struct WebRequestDeviceOptions;
25 23
26 // Success and failure callbacks for requestDevice. 24 // Success and failure callbacks for requestDevice.
27 using WebBluetoothRequestDeviceCallbacks = WebCallbacks<std::unique_ptr<WebBluet oothDeviceInit>, const WebBluetoothError&>; 25 using WebBluetoothRequestDeviceCallbacks = WebCallbacks<std::unique_ptr<WebBluet oothDeviceInit>, int32_t /* Corresponds to WebBluetoothError in web_bluetooth.mo jom */>;
28 26
29 // Success and failure callbacks for GattServer.connect(). 27 // Success and failure callbacks for GattServer.connect().
30 using WebBluetoothRemoteGATTServerConnectCallbacks = WebCallbacks<void, const We bBluetoothError&>; 28 using WebBluetoothRemoteGATTServerConnectCallbacks = WebCallbacks<void, int32_t /* Corresponds to WebBluetoothError in web_bluetooth.mojom */>;
31 29
32 // Success and failure callbacks for getPrimaryService(s). 30 // Success and failure callbacks for getPrimaryService(s).
33 using WebBluetoothGetPrimaryServicesCallbacks = WebCallbacks<const WebVector<Web BluetoothRemoteGATTService*>&, const WebBluetoothError&>; 31 using WebBluetoothGetPrimaryServicesCallbacks = WebCallbacks<const WebVector<Web BluetoothRemoteGATTService*>&, int32_t /* Corresponds to WebBluetoothError in we b_bluetooth.mojom */>;
34 32
35 // Success and failure callbacks for getCharacteristic(s). 33 // Success and failure callbacks for getCharacteristic(s).
36 using WebBluetoothGetCharacteristicsCallbacks = WebCallbacks<const WebVector<Web BluetoothRemoteGATTCharacteristicInit*>&, const WebBluetoothError&>; 34 using WebBluetoothGetCharacteristicsCallbacks = WebCallbacks<const WebVector<Web BluetoothRemoteGATTCharacteristicInit*>&, int32_t /* Corresponds to WebBluetooth Error in web_bluetooth.mojom */>;
37 35
38 // Success and failure callbacks for readValue. 36 // Success and failure callbacks for readValue.
39 using WebBluetoothReadValueCallbacks = WebCallbacks<const WebVector<uint8_t>&, c onst WebBluetoothError&>; 37 using WebBluetoothReadValueCallbacks = WebCallbacks<const WebVector<uint8_t>&, i nt32_t /* Corresponds to WebBluetoothError in web_bluetooth.mojom */>;
40 38
41 // Success and failure callbacks for writeValue. 39 // Success and failure callbacks for writeValue.
42 using WebBluetoothWriteValueCallbacks = WebCallbacks<const WebVector<uint8_t>&, const WebBluetoothError&>; 40 using WebBluetoothWriteValueCallbacks = WebCallbacks<const WebVector<uint8_t>&, int32_t /* Corresponds to WebBluetoothError in web_bluetooth.mojom */>;
43 41
44 // Success and failure callbacks for characteristic.startNotifications and 42 // Success and failure callbacks for characteristic.startNotifications and
45 // characteristic.stopNotifications. 43 // characteristic.stopNotifications.
46 using WebBluetoothNotificationsCallbacks = WebCallbacks<void, const WebBluetooth Error&>; 44 using WebBluetoothNotificationsCallbacks = WebCallbacks<void, int32_t /* Corresp onds to WebBluetoothError in web_bluetooth.mojom */>;
47 45
48 class WebBluetooth { 46 class WebBluetooth {
49 public: 47 public:
50 virtual ~WebBluetooth() { } 48 virtual ~WebBluetooth() { }
51 49
52 // Bluetooth Methods: 50 // Bluetooth Methods:
53 // See https://webbluetoothchrome.github.io/web-bluetooth/#device-discovery 51 // See https://webbluetoothchrome.github.io/web-bluetooth/#device-discovery
54 // WebBluetoothRequestDeviceCallbacks ownership transferred to the client. 52 // WebBluetoothRequestDeviceCallbacks ownership transferred to the client.
55 virtual void requestDevice(const WebRequestDeviceOptions&, WebBluetoothReque stDeviceCallbacks*) { } 53 virtual void requestDevice(const WebRequestDeviceOptions&, WebBluetoothReque stDeviceCallbacks*) { }
56 54
57 // BluetoothDevice methods: 55 // BluetoothDevice methods:
58 56
59 // BluetoothRemoteGATTServer methods: 57 // BluetoothRemoteGATTServer methods:
60 // See https://webbluetoothchrome.github.io/web-bluetooth/#idl-def-bluetooth gattremoteserver 58 // See https://webbluetoothchrome.github.io/web-bluetooth/#idl-def-bluetooth gattremoteserver
61 virtual void connect(const WebString& deviceId, 59 virtual void connect(const WebString& deviceId,
62 WebBluetoothDevice* device, 60 WebBluetoothDevice* device,
63 WebBluetoothRemoteGATTServerConnectCallbacks*) {} 61 WebBluetoothRemoteGATTServerConnectCallbacks*) {}
64 virtual void disconnect(const WebString& deviceId) = 0; 62 virtual void disconnect(const WebString& deviceId) = 0;
65 virtual void getPrimaryServices(const WebString& deviceId, 63 virtual void getPrimaryServices(const WebString& deviceId,
66 mojom::WebBluetoothGATTQueryQuantity, 64 int32_t quantity /* Corresponds to WebBluetoothGATTQueryQuantity in web_ bluetooth.mojom */,
67 const WebString& servicesUUID, 65 const WebString& servicesUUID,
68 WebBluetoothGetPrimaryServicesCallbacks*) = 0; 66 WebBluetoothGetPrimaryServicesCallbacks*) = 0;
69 67
70 // BluetoothRemoteGATTService methods: 68 // BluetoothRemoteGATTService methods:
71 // See https://webbluetoothchrome.github.io/web-bluetooth/#idl-def-bluetooth gattservice 69 // See https://webbluetoothchrome.github.io/web-bluetooth/#idl-def-bluetooth gattservice
72 virtual void getCharacteristics(const WebString& serviceInstanceID, 70 virtual void getCharacteristics(const WebString& serviceInstanceID,
73 mojom::WebBluetoothGATTQueryQuantity, 71 int32_t quantity /* Corresponds to WebBluetoothGATTQueryQuantity in web_ bluetooth.mojom */,
74 const WebString& characteristicsUUID, 72 const WebString& characteristicsUUID,
75 WebBluetoothGetCharacteristicsCallbacks*) = 0; 73 WebBluetoothGetCharacteristicsCallbacks*) = 0;
76 74
77 // BluetoothRemoteGATTCharacteristic methods: 75 // BluetoothRemoteGATTCharacteristic methods:
78 // See https://webbluetoothchrome.github.io/web-bluetooth/#bluetoothgattchar acteristic 76 // See https://webbluetoothchrome.github.io/web-bluetooth/#bluetoothgattchar acteristic
79 virtual void readValue(const WebString& characteristicInstanceID, 77 virtual void readValue(const WebString& characteristicInstanceID,
80 WebBluetoothReadValueCallbacks*) { } 78 WebBluetoothReadValueCallbacks*) { }
81 virtual void writeValue(const WebString& characteristicInstanceID, 79 virtual void writeValue(const WebString& characteristicInstanceID,
82 const WebVector<uint8_t>& value, 80 const WebVector<uint8_t>& value,
83 WebBluetoothWriteValueCallbacks*) {} 81 WebBluetoothWriteValueCallbacks*) {}
84 virtual void startNotifications(const WebString& characteristicInstanceID, 82 virtual void startNotifications(const WebString& characteristicInstanceID,
85 WebBluetoothNotificationsCallbacks*) {} 83 WebBluetoothNotificationsCallbacks*) {}
86 virtual void stopNotifications(const WebString& characteristicInstanceID, 84 virtual void stopNotifications(const WebString& characteristicInstanceID,
87 WebBluetoothNotificationsCallbacks*) {} 85 WebBluetoothNotificationsCallbacks*) {}
88 86
89 // Called when addEventListener is called on a characteristic. 87 // Called when addEventListener is called on a characteristic.
90 virtual void registerCharacteristicObject( 88 virtual void registerCharacteristicObject(
91 const WebString& characteristicInstanceID, 89 const WebString& characteristicInstanceID,
92 WebBluetoothRemoteGATTCharacteristic*) = 0; 90 WebBluetoothRemoteGATTCharacteristic*) = 0;
93 virtual void characteristicObjectRemoved( 91 virtual void characteristicObjectRemoved(
94 const WebString& characteristicInstanceID, 92 const WebString& characteristicInstanceID,
95 WebBluetoothRemoteGATTCharacteristic*) {} 93 WebBluetoothRemoteGATTCharacteristic*) {}
96 }; 94 };
97 95
98 } // namespace blink 96 } // namespace blink
99 97
100 #endif // WebBluetooth_h 98 #endif // WebBluetooth_h
OLDNEW
« no previous file with comments | « third_party/WebKit/public/blink_headers.gypi ('k') | third_party/WebKit/public/platform/modules/bluetooth/WebBluetoothError.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698