| 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 BluetoothDevice_h | 5 #ifndef BluetoothDevice_h |
| 6 #define BluetoothDevice_h | 6 #define BluetoothDevice_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptWrappable.h" | 8 #include "bindings/core/v8/ScriptWrappable.h" |
| 9 #include "platform/heap/Heap.h" | 9 #include "platform/heap/Heap.h" |
| 10 #include "public/platform/modules/bluetooth/WebBluetoothDevice.h" | 10 #include "public/platform/modules/bluetooth/WebBluetoothDevice.h" |
| 11 #include "wtf/OwnPtr.h" | 11 #include "wtf/OwnPtr.h" |
| 12 #include "wtf/PassOwnPtr.h" | 12 #include "wtf/PassOwnPtr.h" |
| 13 #include "wtf/text/WTFString.h" | 13 #include "wtf/text/WTFString.h" |
| 14 | 14 |
| 15 namespace blink { | 15 namespace blink { |
| 16 | 16 |
| 17 class BluetoothAdvertisingData; |
| 17 class ScriptPromise; | 18 class ScriptPromise; |
| 18 class ScriptPromiseResolver; | 19 class ScriptPromiseResolver; |
| 19 class ScriptState; | 20 class ScriptState; |
| 20 | 21 |
| 21 // BluetoothDevice represents a physical bluetooth device in the DOM. See IDL. | 22 // BluetoothDevice represents a physical bluetooth device in the DOM. See IDL. |
| 22 // | 23 // |
| 23 // Callbacks providing WebBluetoothDevice objects are handled by | 24 // Callbacks providing WebBluetoothDevice 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 BluetoothDevice final | 28 class BluetoothDevice final |
| 28 : public GarbageCollectedFinalized<BluetoothDevice> | 29 : public GarbageCollectedFinalized<BluetoothDevice> |
| 29 , public ScriptWrappable { | 30 , public ScriptWrappable { |
| 30 DEFINE_WRAPPERTYPEINFO(); | 31 DEFINE_WRAPPERTYPEINFO(); |
| 31 public: | 32 public: |
| 32 BluetoothDevice(PassOwnPtr<WebBluetoothDevice>); | 33 BluetoothDevice(PassOwnPtr<WebBluetoothDevice>); |
| 33 | 34 |
| 34 ScriptPromise connectGATT(ScriptState*); | 35 ScriptPromise connectGATT(ScriptState*); |
| 35 | 36 |
| 36 // Interface required by CallbackPromiseAdapter: | 37 // Interface required by CallbackPromiseAdapter: |
| 37 using WebType = OwnPtr<WebBluetoothDevice>; | 38 using WebType = OwnPtr<WebBluetoothDevice>; |
| 38 static BluetoothDevice* take(ScriptPromiseResolver*, PassOwnPtr<WebBluetooth
Device>); | 39 static BluetoothDevice* take(ScriptPromiseResolver*, PassOwnPtr<WebBluetooth
Device>); |
| 39 | 40 |
| 40 // Interface required by Garbage Collection: | 41 // Interface required by Garbage Collection: |
| 41 DEFINE_INLINE_TRACE() { } | 42 DEFINE_INLINE_TRACE() { } |
| 42 | 43 |
| 43 // IDL exposed interface: | 44 // IDL exposed interface: |
| 44 String instanceID() { return m_webDevice->instanceID; } | 45 String instanceID() { return m_webDevice->instanceID; } |
| 45 String name() { return m_webDevice->name; } | 46 String name() { return m_webDevice->name; } |
| 47 BluetoothAdvertisingData* adData() { return m_adData; } |
| 46 unsigned deviceClass(bool& isNull); | 48 unsigned deviceClass(bool& isNull); |
| 47 String vendorIDSource(); | 49 String vendorIDSource(); |
| 48 unsigned vendorID(bool& isNull); | 50 unsigned vendorID(bool& isNull); |
| 49 unsigned productID(bool& isNull); | 51 unsigned productID(bool& isNull); |
| 50 unsigned productVersion(bool& isNull); | 52 unsigned productVersion(bool& isNull); |
| 51 bool paired(); | 53 bool paired(); |
| 52 Vector<String> uuids(); | 54 Vector<String> uuids(); |
| 53 | 55 |
| 54 private: | 56 private: |
| 55 OwnPtr<WebBluetoothDevice> m_webDevice; | 57 OwnPtr<WebBluetoothDevice> m_webDevice; |
| 58 Member<BluetoothAdvertisingData> m_adData; |
| 56 }; | 59 }; |
| 57 | 60 |
| 58 } // namespace blink | 61 } // namespace blink |
| 59 | 62 |
| 60 #endif // BluetoothDevice_h | 63 #endif // BluetoothDevice_h |
| OLD | NEW |