| 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/text/WTFString.h" | 11 #include "wtf/text/WTFString.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 class ScriptPromise; |
| 15 class ScriptPromiseResolver; | 16 class ScriptPromiseResolver; |
| 17 class ScriptState; |
| 16 | 18 |
| 17 // BluetoothDevice represents a physical bluetooth device in the DOM. See IDL. | 19 // BluetoothDevice represents a physical bluetooth device in the DOM. See IDL. |
| 18 // | 20 // |
| 19 // Callbacks providing WebBluetoothDevice objects are handled by | 21 // Callbacks providing WebBluetoothDevice objects are handled by |
| 20 // CallbackPromiseAdapter templatized with this class. See this class's | 22 // CallbackPromiseAdapter templatized with this class. See this class's |
| 21 // "Interface required by CallbackPromiseAdapter" section and the | 23 // "Interface required by CallbackPromiseAdapter" section and the |
| 22 // CallbackPromiseAdapter class comments. | 24 // CallbackPromiseAdapter class comments. |
| 23 class BluetoothDevice final | 25 class BluetoothDevice final |
| 24 : public GarbageCollectedFinalized<BluetoothDevice> | 26 : public GarbageCollectedFinalized<BluetoothDevice> |
| 25 , public ScriptWrappable { | 27 , public ScriptWrappable { |
| 26 DEFINE_WRAPPERTYPEINFO(); | 28 DEFINE_WRAPPERTYPEINFO(); |
| 27 public: | 29 public: |
| 28 BluetoothDevice(const WebBluetoothDevice&); | 30 BluetoothDevice(const WebBluetoothDevice&); |
| 29 | 31 |
| 30 static BluetoothDevice* create(const WebBluetoothDevice&); | 32 static BluetoothDevice* create(const WebBluetoothDevice&); |
| 31 | 33 |
| 34 ScriptPromise connectGATT(ScriptState*); |
| 35 |
| 32 // Interface required by CallbackPromiseAdapter: | 36 // Interface required by CallbackPromiseAdapter: |
| 33 typedef WebBluetoothDevice WebType; | 37 typedef WebBluetoothDevice WebType; |
| 34 static BluetoothDevice* take(ScriptPromiseResolver*, WebBluetoothDevice*); | 38 static BluetoothDevice* take(ScriptPromiseResolver*, WebBluetoothDevice*); |
| 35 static void dispose(WebBluetoothDevice*); | 39 static void dispose(WebBluetoothDevice*); |
| 36 | 40 |
| 37 // Interface required by Garbage Collection: | 41 // Interface required by Garbage Collection: |
| 38 DEFINE_INLINE_TRACE() { } | 42 DEFINE_INLINE_TRACE() { } |
| 39 | 43 |
| 40 // IDL exposed interface: | 44 // IDL exposed interface: |
| 41 String instanceID() { return m_webDevice.instanceID; } | 45 String instanceID() { return m_webDevice.instanceID; } |
| 42 String name() { return m_webDevice.name; } | 46 String name() { return m_webDevice.name; } |
| 43 unsigned deviceClass(bool& isNull); | 47 unsigned deviceClass(bool& isNull); |
| 44 String vendorIDSource(); | 48 String vendorIDSource(); |
| 45 unsigned vendorID(bool& isNull); | 49 unsigned vendorID(bool& isNull); |
| 46 unsigned productID(bool& isNull); | 50 unsigned productID(bool& isNull); |
| 47 unsigned productVersion(bool& isNull); | 51 unsigned productVersion(bool& isNull); |
| 48 bool paired(); | 52 bool paired(); |
| 49 Vector<String> uuids(); | 53 Vector<String> uuids(); |
| 50 | 54 |
| 51 private: | 55 private: |
| 52 WebBluetoothDevice m_webDevice; | 56 WebBluetoothDevice m_webDevice; |
| 53 }; | 57 }; |
| 54 | 58 |
| 55 } // namespace blink | 59 } // namespace blink |
| 56 | 60 |
| 57 #endif // BluetoothDevice_h | 61 #endif // BluetoothDevice_h |
| OLD | NEW |