Index: third_party/WebKit/Source/modules/webusb/USBConfiguration.cpp |
diff --git a/third_party/WebKit/Source/modules/webusb/USBConfiguration.cpp b/third_party/WebKit/Source/modules/webusb/USBConfiguration.cpp |
index 6a662c086cb265e1a545178d45a10d8f79347c69..cd6599393d7a7fd2f712272a82ae3b6b0493b74e 100644 |
--- a/third_party/WebKit/Source/modules/webusb/USBConfiguration.cpp |
+++ b/third_party/WebKit/Source/modules/webusb/USBConfiguration.cpp |
@@ -5,6 +5,7 @@ |
#include "modules/webusb/USBConfiguration.h" |
#include "bindings/core/v8/ExceptionState.h" |
+#include "device/usb/public/interfaces/device.mojom-wtf.h" |
#include "modules/webusb/USBDevice.h" |
#include "modules/webusb/USBInterface.h" |
@@ -17,23 +18,15 @@ USBConfiguration* USBConfiguration::create(const USBDevice* device, size_t confi |
USBConfiguration* USBConfiguration::create(const USBDevice* device, size_t configurationValue, ExceptionState& exceptionState) |
{ |
- for (size_t i = 0; i < device->info().configurations.size(); ++i) { |
- if (device->info().configurations[i].configurationValue == configurationValue) |
+ const auto& configurations = device->info().configurations; |
+ for (size_t i = 0; i < configurations.size(); ++i) { |
+ if (configurations[i]->configuration_value == configurationValue) |
return new USBConfiguration(device, i); |
} |
exceptionState.throwRangeError("Invalid configuration value."); |
return nullptr; |
} |
-USBConfiguration* USBConfiguration::createFromValue(const USBDevice* device, uint8_t configurationValue) |
-{ |
- for (size_t i = 0; i < device->info().configurations.size(); ++i) { |
- if (device->info().configurations[i].configurationValue == configurationValue) |
- return new USBConfiguration(device, i); |
- } |
- return nullptr; |
-} |
- |
USBConfiguration::USBConfiguration(const USBDevice* device, size_t configurationIndex) |
: m_device(device) |
, m_configurationIndex(configurationIndex) |
@@ -52,19 +45,9 @@ size_t USBConfiguration::index() const |
return m_configurationIndex; |
} |
-const WebUSBDeviceInfo::Configuration& USBConfiguration::info() const |
-{ |
- return m_device->info().configurations[m_configurationIndex]; |
-} |
- |
-uint8_t USBConfiguration::configurationValue() const |
-{ |
- return info().configurationValue; |
-} |
- |
-String USBConfiguration::configurationName() const |
+const device::usb::wtf::ConfigurationInfo& USBConfiguration::info() const |
{ |
- return info().configurationName; |
+ return *m_device->info().configurations[m_configurationIndex]; |
} |
HeapVector<Member<USBInterface>> USBConfiguration::interfaces() const |