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

Unified Diff: Source/modules/webusb/USBError.cpp

Issue 1245363002: Add WebUSB bindings and client interface (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: iface ctors, OWNERS, rebase Created 5 years, 5 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
« no previous file with comments | « Source/modules/webusb/USBError.h ('k') | Source/modules/webusb/USBInTransferResult.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/webusb/USBError.cpp
diff --git a/Source/modules/webusb/USBError.cpp b/Source/modules/webusb/USBError.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..7bbeb254414bd3019a475f7ad291a76c80161428
--- /dev/null
+++ b/Source/modules/webusb/USBError.cpp
@@ -0,0 +1,28 @@
+// Copyright 2015 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/webusb/USBError.h"
+
+#include "core/dom/DOMException.h"
+#include "core/dom/ExceptionCode.h"
+#include "public/platform/modules/webusb/WebUSBError.h"
+#include "wtf/OwnPtr.h"
+
+namespace blink {
+
+DOMException* USBError::take(ScriptPromiseResolver*, PassOwnPtr<WebUSBError> webError)
+{
+ switch (webError->errorType) {
+ case WebUSBError::SecurityError:
+ case WebUSBError::DeviceError:
+ case WebUSBError::ServiceError:
+ case WebUSBError::TransferError:
+ return DOMException::create(AbortError, webError->message);
+ }
+ ASSERT_NOT_REACHED();
+ return DOMException::create(UnknownError);
+}
+
+} // namespace blink
« no previous file with comments | « Source/modules/webusb/USBError.h ('k') | Source/modules/webusb/USBInTransferResult.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698