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

Unified Diff: Source/modules/bluetooth/BluetoothError.cpp

Issue 650613005: bluetooth: Initial WebBluetooth & WebBluetoothError. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Abandoned initial approach implementing BluetoothMock in Blink. Created 6 years, 2 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: Source/modules/bluetooth/BluetoothError.cpp
diff --git a/Source/modules/bluetooth/BluetoothError.cpp b/Source/modules/bluetooth/BluetoothError.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..b77e3eda99f63ca52ab4d17bccbcef626cf35083
--- /dev/null
+++ b/Source/modules/bluetooth/BluetoothError.cpp
@@ -0,0 +1,32 @@
+// Copyright 2014 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 "config.h"
+#include "modules/bluetooth/BluetoothError.h"
+
+#include "core/dom/ExceptionCode.h"
+#include "public/platform/WebBluetoothError.h"
+#include "wtf/OwnPtr.h"
+
+namespace blink {
+
+PassRefPtrWillBeRawPtr<DOMException> BluetoothError::take(ScriptPromiseResolver*, WebBluetoothError* webErrorRawPointer)
+{
+ OwnPtr<WebBluetoothError> webError = adoptPtr(webErrorRawPointer);
+ switch (webError->errorType) {
+ case WebBluetoothError::SecurityError:
+ return DOMException::create(SecurityError, webError->message);
+ case WebBluetoothError::NotFoundError:
+ return DOMException::create(NotFoundError, webError->message);
+ }
+ ASSERT_NOT_REACHED();
+ return DOMException::create(UnknownError);
+}
+
+void BluetoothError::dispose(WebBluetoothError* webErrorRaw)
+{
+ delete webErrorRaw;
haraken 2014/10/18 11:25:56 Why do we need to manually call 'delete'?
scheib 2014/10/19 03:54:21 This is an object for use by CallbackPromiseAdapte
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698