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

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

Issue 1264483005: Add WebUSB bindings and client interface [part 2] (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: enum class Created 5 years, 4 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') | public/platform/modules/webusb/WebUSBDevice.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..c3574f2ad6aece997a245fb9925c9c4c653db4b8
--- /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"
+
+namespace blink {
+
+DOMException* USBError::take(ScriptPromiseResolver*, PassOwnPtr<WebUSBError> webError)
+{
+ switch (webError->error) {
+ case WebUSBError::Error::Device:
+ case WebUSBError::Error::Security:
+ case WebUSBError::Error::Service:
+ case WebUSBError::Error::Transfer:
+ // TODO(rockot): Differentiate between different error types.
+ 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') | public/platform/modules/webusb/WebUSBDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698