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

Unified Diff: content/renderer/usb/web_usb_device_impl.cc

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | device/usb/mojo/device_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/usb/web_usb_device_impl.cc
diff --git a/content/renderer/usb/web_usb_device_impl.cc b/content/renderer/usb/web_usb_device_impl.cc
index b6040a943172efe33292e20ac07e366c34041087..ebb1786f658021710a8ee6389638893d23874818 100644
--- a/content/renderer/usb/web_usb_device_impl.cc
+++ b/content/renderer/usb/web_usb_device_impl.cc
@@ -24,6 +24,7 @@ namespace {
const char kClaimInterfaceFailed[] = "Unable to claim interface.";
const char kClearHaltFailed[] = "Unable to clear endpoint.";
+const char kDeviceAlreadyOpen[] = "Device has already been opened.";
const char kDeviceNoAccess[] = "Access denied.";
const char kDeviceNotConfigured[] = "Device not configured.";
const char kDeviceUnavailable[] = "Device unavailable.";
@@ -74,6 +75,11 @@ void OnOpenDevice(
blink::WebUSBError::Error::Security,
base::ASCIIToUTF16(kDeviceNoAccess)));
break;
+ case device::usb::OpenDeviceError::ALREADY_OPEN:
+ scoped_callbacks->onError(blink::WebUSBError(
+ blink::WebUSBError::Error::InvalidState,
+ base::ASCIIToUTF16(kDeviceAlreadyOpen)));
+ break;
default:
NOTREACHED();
}
« no previous file with comments | « no previous file | device/usb/mojo/device_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698