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

Unified Diff: third_party/WebKit/Source/modules/webusb/USBConfiguration.cpp

Issue 1850023002: Consume Mojo services directly in Blink's WebUSB implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't do assignments in if statements. Created 4 years, 8 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
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
« no previous file with comments | « third_party/WebKit/Source/modules/webusb/USBConfiguration.h ('k') | third_party/WebKit/Source/modules/webusb/USBController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698