Chromium Code Reviews| Index: third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTDescriptor.cpp |
| diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTDescriptor.cpp b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTDescriptor.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8fb02c0c44e55256ce07f776838db21feca0f9fd |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTDescriptor.cpp |
| @@ -0,0 +1,55 @@ |
| +// 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. |
| + |
| +#include "modules/bluetooth/BluetoothRemoteGATTDescriptor.h" |
| + |
| +#include "bindings/core/v8/CallbackPromiseAdapter.h" |
| +#include "bindings/core/v8/ScriptPromise.h" |
| +#include "bindings/core/v8/ScriptPromiseResolver.h" |
| +#include "core/dom/DOMDataView.h" |
| +#include "core/dom/DOMException.h" |
| +#include "core/dom/ExceptionCode.h" |
| +#include "core/events/Event.h" |
| +#include "core/inspector/ConsoleMessage.h" |
|
haraken
2016/12/09 00:26:04
Remove unused header includes from this file.
dougt
2016/12/09 19:20:07
Done.
|
| +#include "modules/bluetooth/BluetoothError.h" |
| +#include "modules/bluetooth/BluetoothRemoteGATTService.h" |
| +#include "modules/bluetooth/BluetoothSupplement.h" |
| +#include "public/platform/modules/bluetooth/WebBluetooth.h" |
| +#include <memory> |
| + |
| +namespace blink { |
| + |
| +BluetoothRemoteGATTDescriptor::BluetoothRemoteGATTDescriptor( |
| + std::unique_ptr<WebBluetoothRemoteGATTDescriptorInit> webDescriptor, |
| + BluetoothRemoteGATTCharacteristic* characteristic) |
| + : m_webDescriptor(std::move(webDescriptor)), |
| + m_characteristic(characteristic) {} |
| + |
| +ScriptPromise BluetoothRemoteGATTDescriptor::readValue( |
| + ScriptState* scriptState) { |
| + // TODO(668837): Implement WebBluetooth descriptor.readValue() |
| + return ScriptPromise::rejectWithDOMException( |
| + scriptState, |
| + DOMException::create(NotSupportedError, |
| + "descriptor readValue is not implemented " |
| + "yet. See https://goo.gl/J6ASzs")); |
| +} |
| + |
| +ScriptPromise BluetoothRemoteGATTDescriptor::writeValue( |
| + ScriptState* scriptState, |
| + const DOMArrayPiece& value) { |
| + // TODO(668838): Implement WebBluetooth descriptor.writeValue() |
| + return ScriptPromise::rejectWithDOMException( |
| + scriptState, |
| + DOMException::create(NotSupportedError, |
| + "descriptor writeValue is not implemented " |
| + "yet. See https://goo.gl/J6ASzs")); |
| +} |
| + |
| +DEFINE_TRACE(BluetoothRemoteGATTDescriptor) { |
| + visitor->trace(m_characteristic); |
| + visitor->trace(m_value); |
| +} |
| + |
| +} // namespace blink |