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

Side by Side Diff: third_party/WebKit/Source/modules/webusb/USBError.cpp

Issue 1693433003: webusb: Reject the promise if the device is already open. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/webusb/USBError.h" 5 #include "modules/webusb/USBError.h"
6 6
7 #include "core/dom/DOMException.h" 7 #include "core/dom/DOMException.h"
8 #include "core/dom/ExceptionCode.h" 8 #include "core/dom/ExceptionCode.h"
9 #include "public/platform/modules/webusb/WebUSBError.h" 9 #include "public/platform/modules/webusb/WebUSBError.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 DOMException* USBError::take(ScriptPromiseResolver*, const WebUSBError& webError ) 13 DOMException* USBError::take(ScriptPromiseResolver*, const WebUSBError& webError )
14 { 14 {
15 switch (webError.error) { 15 switch (webError.error) {
16 case WebUSBError::Error::InvalidState:
17 return DOMException::create(InvalidStateError, webError.message);
16 case WebUSBError::Error::Network: 18 case WebUSBError::Error::Network:
17 return DOMException::create(NetworkError, webError.message); 19 return DOMException::create(NetworkError, webError.message);
18 case WebUSBError::Error::NotFound: 20 case WebUSBError::Error::NotFound:
19 return DOMException::create(NotFoundError, webError.message); 21 return DOMException::create(NotFoundError, webError.message);
20 case WebUSBError::Error::Security: 22 case WebUSBError::Error::Security:
21 return DOMException::create(SecurityError, webError.message); 23 return DOMException::create(SecurityError, webError.message);
22 } 24 }
23 ASSERT_NOT_REACHED(); 25 ASSERT_NOT_REACHED();
24 return DOMException::create(UnknownError); 26 return DOMException::create(UnknownError);
25 } 27 }
26 28
27 } // namespace blink 29 } // namespace blink
OLDNEW
« no previous file with comments | « device/usb/public/interfaces/device.mojom ('k') | third_party/WebKit/public/platform/modules/webusb/WebUSBError.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698