OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 BluetoothGATTRemoteServer_h | 5 #ifndef BluetoothGATTRemoteServer_h |
6 #define BluetoothGATTRemoteServer_h | 6 #define BluetoothGATTRemoteServer_h |
7 | 7 |
8 #include "bindings/core/v8/ScriptWrappable.h" | 8 #include "bindings/core/v8/ScriptWrappable.h" |
9 #include "bindings/modules/v8/UnionTypesModules.h" | 9 #include "bindings/modules/v8/UnionTypesModules.h" |
10 #include "platform/heap/Heap.h" | 10 #include "platform/heap/Heap.h" |
11 #include "public/platform/modules/bluetooth/WebBluetoothGATTRemoteServer.h" | 11 #include "public/platform/modules/bluetooth/WebBluetoothGATTRemoteServer.h" |
| 12 #include "wtf/OwnPtr.h" |
12 #include "wtf/PassOwnPtr.h" | 13 #include "wtf/PassOwnPtr.h" |
13 #include "wtf/text/WTFString.h" | 14 #include "wtf/text/WTFString.h" |
14 | 15 |
15 namespace blink { | 16 namespace blink { |
16 | 17 |
17 class ScriptPromise; | 18 class ScriptPromise; |
18 class ScriptPromiseResolver; | 19 class ScriptPromiseResolver; |
19 class ScriptState; | 20 class ScriptState; |
20 | 21 |
21 // BluetoothGATTRemoteServer provides a way to interact with a connected bluetoo
th peripheral. | 22 // BluetoothGATTRemoteServer provides a way to interact with a connected bluetoo
th peripheral. |
22 // | 23 // |
23 // Callbacks providing WebBluetoothGATTRemoteServer objects are handled by | 24 // Callbacks providing WebBluetoothGATTRemoteServer objects are handled by |
24 // CallbackPromiseAdapter templatized with this class. See this class's | 25 // CallbackPromiseAdapter templatized with this class. See this class's |
25 // "Interface required by CallbackPromiseAdapter" section and the | 26 // "Interface required by CallbackPromiseAdapter" section and the |
26 // CallbackPromiseAdapter class comments. | 27 // CallbackPromiseAdapter class comments. |
27 class BluetoothGATTRemoteServer final | 28 class BluetoothGATTRemoteServer final |
28 : public GarbageCollectedFinalized<BluetoothGATTRemoteServer> | 29 : public GarbageCollectedFinalized<BluetoothGATTRemoteServer> |
29 , public ScriptWrappable { | 30 , public ScriptWrappable { |
30 DEFINE_WRAPPERTYPEINFO(); | 31 DEFINE_WRAPPERTYPEINFO(); |
31 public: | 32 public: |
32 BluetoothGATTRemoteServer(PassOwnPtr<WebBluetoothGATTRemoteServer>); | 33 BluetoothGATTRemoteServer(PassOwnPtr<WebBluetoothGATTRemoteServer>); |
33 | 34 |
34 // Interface required by CallbackPromiseAdapter: | 35 // Interface required by CallbackPromiseAdapter: |
35 typedef WebBluetoothGATTRemoteServer WebType; | 36 using WebType = OwnPtr<WebBluetoothGATTRemoteServer>; |
36 static BluetoothGATTRemoteServer* take(ScriptPromiseResolver*, PassOwnPtr<We
bBluetoothGATTRemoteServer>); | 37 static BluetoothGATTRemoteServer* take(ScriptPromiseResolver*, PassOwnPtr<We
bBluetoothGATTRemoteServer>); |
37 | 38 |
38 // Interface required by Garbage Collectoin: | 39 // Interface required by Garbage Collectoin: |
39 DEFINE_INLINE_TRACE() { } | 40 DEFINE_INLINE_TRACE() { } |
40 | 41 |
41 // IDL exposed interface: | 42 // IDL exposed interface: |
42 bool connected() { return m_webGATT->connected; } | 43 bool connected() { return m_webGATT->connected; } |
43 ScriptPromise getPrimaryService(ScriptState*, const StringOrUnsignedLong& se
rvice, ExceptionState&); | 44 ScriptPromise getPrimaryService(ScriptState*, const StringOrUnsignedLong& se
rvice, ExceptionState&); |
44 | 45 |
45 private: | 46 private: |
46 OwnPtr<WebBluetoothGATTRemoteServer> m_webGATT; | 47 OwnPtr<WebBluetoothGATTRemoteServer> m_webGATT; |
47 }; | 48 }; |
48 | 49 |
49 } // namespace blink | 50 } // namespace blink |
50 | 51 |
51 #endif // BluetoothDevice_h | 52 #endif // BluetoothDevice_h |
OLD | NEW |