Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(666)

Unified Diff: third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTDescriptor.cpp

Issue 2466223002: Implement WebBluetooth getDescriptor[s] (Closed)
Patch Set: Implement WebBluetooth getDescriptor[s] Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..4184c2d18be5394ab47af74c4de4ccfcbd44199b
--- /dev/null
+++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTDescriptor.cpp
@@ -0,0 +1,53 @@
+// 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 "core/dom/DOMException.h"
+#include "modules/bluetooth/BluetoothRemoteGATTService.h"
+#include <memory>
+
+namespace blink {
+
+BluetoothRemoteGATTDescriptor::BluetoothRemoteGATTDescriptor(
+ mojom::blink::WebBluetoothRemoteGATTDescriptorPtr descriptor,
+ BluetoothRemoteGATTCharacteristic* characteristic)
+ : m_descriptor(std::move(descriptor)), m_characteristic(characteristic) {}
+
+BluetoothRemoteGATTDescriptor* BluetoothRemoteGATTDescriptor::create(
+ mojom::blink::WebBluetoothRemoteGATTDescriptorPtr descriptor,
+
+ BluetoothRemoteGATTCharacteristic* characteristic) {
+ BluetoothRemoteGATTDescriptor* result =
+ new BluetoothRemoteGATTDescriptor(std::move(descriptor), characteristic);
+ return result;
+}
+
+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

Powered by Google App Engine
This is Rietveld 408576698