Chromium Code Reviews| Index: third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTDescriptor.h |
| diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTDescriptor.h b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTDescriptor.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..bd0198c505c3dcdfc5e141913d76f9822b1bac4d |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTDescriptor.h |
| @@ -0,0 +1,76 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef BluetoothRemoteGATTDescriptor_h |
| +#define BluetoothRemoteGATTDescriptor_h |
| + |
| +#include "bindings/core/v8/ScriptWrappable.h" |
| +#include "core/dom/ActiveDOMObject.h" |
| +#include "core/dom/DOMArrayPiece.h" |
| +#include "core/dom/DOMDataView.h" |
| +#include "modules/EventTargetModules.h" |
| +#include "modules/bluetooth/BluetoothRemoteGATTCharacteristic.h" |
| +#include "modules/bluetooth/BluetoothRemoteGATTService.h" |
| +#include "platform/heap/Handle.h" |
| +#include "public/platform/modules/bluetooth/WebBluetoothRemoteGATTCharacteristic.h" |
| +#include "public/platform/modules/bluetooth/WebBluetoothRemoteGATTDescriptor.h" |
| +#include "public/platform/modules/bluetooth/WebBluetoothRemoteGATTDescriptorInit.h" |
| +#include "wtf/text/WTFString.h" |
| +#include <memory> |
| + |
| +namespace blink { |
| + |
| +class BluetoothCharacteristicProperties; |
| +class BluetoothRemoteGATTCharacteristic; |
| +class ScriptPromise; |
| +class ScriptPromiseResolver; |
| +class ScriptState; |
| + |
| +// BluetoothRemoteGATTDescriptor represents a GATT Descriptor, which is |
| +// a basic data element that provides further information about a peripheral's |
| +// characteristic. |
| + |
| +class BluetoothRemoteGATTDescriptor final |
| + : public GarbageCollectedFinalized<BluetoothRemoteGATTDescriptor>, |
|
ortuno
2016/11/22 03:02:02
Does this need to be Finalized? Could it be just G
dougt
2016/11/29 22:50:48
It needs to be finalized.
../../third_party/WebKi
|
| + public ScriptWrappable { |
| + DEFINE_WRAPPERTYPEINFO(); |
| + |
| + public: |
| + explicit BluetoothRemoteGATTDescriptor( |
| + std::unique_ptr<WebBluetoothRemoteGATTDescriptorInit>, |
| + BluetoothRemoteGATTCharacteristic*); |
| + |
| + // Interface required by CallbackPromiseAdapter. |
| + static BluetoothRemoteGATTDescriptor* take( |
| + std::unique_ptr<WebBluetoothRemoteGATTDescriptorInit>, |
| + BluetoothRemoteGATTCharacteristic*); |
| + |
| + // Save value. |
| + void setValue(DOMDataView*); |
| + |
| + // IDL exposed interface: |
| + BluetoothRemoteGATTCharacteristic* characteristic() { |
| + return m_characteristic; |
| + } |
| + String uuid() { return m_webDescriptor->uuid; } |
| + DOMDataView* value() const { return m_value; } |
| + ScriptPromise readValue(ScriptState*); |
| + ScriptPromise writeValue(ScriptState*, const DOMArrayPiece&); |
| + |
| + // Interface required by garbage collection. |
| + DECLARE_VIRTUAL_TRACE(); |
| + |
| + private: |
| + friend class DescriptorReadValueCallback; |
| + |
| + BluetoothRemoteGATTServer* getGatt() { return m_characteristic->gatt(); } |
| + |
| + std::unique_ptr<WebBluetoothRemoteGATTDescriptorInit> m_webDescriptor; |
| + Member<BluetoothRemoteGATTCharacteristic> m_characteristic; |
| + Member<DOMDataView> m_value; |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // BluetoothRemoteGATTDescriptor_h |