| 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 8ccebdc6bbb1c8b53509a072b0d68695c51bd160..46c4fba950eeceacfe880a861ccb8e82c7bd0580 100644
|
| --- a/content/renderer/usb/web_usb_device_impl.cc
|
| +++ b/content/renderer/usb/web_usb_device_impl.cc
|
| @@ -23,6 +23,7 @@ namespace {
|
| const char kClaimInterfaceFailed[] = "Unable to claim interface.";
|
| const char kClearHaltFailed[] = "Unable to clear endpoint.";
|
| const char kDeviceNoAccess[] = "Access denied.";
|
| +const char kDeviceNotConfigured[] = "Device not configured.";
|
| const char kDeviceNotOpened[] = "Device not opened.";
|
| const char kDeviceUnavailable[] = "Device unavailable.";
|
| const char kDeviceResetFailed[] = "Unable to reset the device.";
|
| @@ -90,6 +91,16 @@ void OnDeviceClosed(
|
| callbacks.PassCallbacks()->onSuccess();
|
| }
|
|
|
| +void OnGetConfiguration(
|
| + ScopedWebCallbacks<blink::WebUSBDeviceGetConfigurationCallbacks> callbacks,
|
| + uint8_t configuration_value) {
|
| + auto scoped_callbacks = callbacks.PassCallbacks();
|
| + if (configuration_value == 0)
|
| + RejectWithDeviceError(kDeviceNotConfigured, scoped_callbacks.Pass());
|
| + else
|
| + scoped_callbacks->onSuccess(configuration_value);
|
| +}
|
| +
|
| void HandlePassFailDeviceOperation(
|
| ScopedWebCallbacks<blink::WebCallbacks<void, const blink::WebUSBError&>>
|
| callbacks,
|
| @@ -171,6 +182,17 @@ void WebUSBDeviceImpl::close(blink::WebUSBDeviceCloseCallbacks* callbacks) {
|
| }
|
| }
|
|
|
| +void WebUSBDeviceImpl::getConfiguration(
|
| + blink::WebUSBDeviceGetConfigurationCallbacks* callbacks) {
|
| + auto scoped_callbacks = MakeScopedUSBCallbacks(callbacks);
|
| + if (!device_) {
|
| + RejectWithDeviceError(kDeviceNotOpened, scoped_callbacks.PassCallbacks());
|
| + } else {
|
| + device_->GetConfiguration(
|
| + base::Bind(&OnGetConfiguration, base::Passed(&scoped_callbacks)));
|
| + }
|
| +}
|
| +
|
| void WebUSBDeviceImpl::setConfiguration(
|
| uint8_t configuration_value,
|
| blink::WebUSBDeviceSetConfigurationCallbacks* callbacks) {
|
|
|