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

Unified Diff: third_party/WebKit/Source/modules/webusb/USBInterface.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/USBInterface.cpp
diff --git a/third_party/WebKit/Source/modules/webusb/USBInterface.cpp b/third_party/WebKit/Source/modules/webusb/USBInterface.cpp
index 7b952e6693687854da9a6df4ed1ed35f4bc203dc..32e0bf50761de9cd727e7c7c010bc4ef4f97e5c1 100644
--- a/third_party/WebKit/Source/modules/webusb/USBInterface.cpp
+++ b/third_party/WebKit/Source/modules/webusb/USBInterface.cpp
@@ -5,6 +5,7 @@
#include "modules/webusb/USBInterface.h"
#include "bindings/core/v8/ExceptionState.h"
+#include "device/usb/public/interfaces/device.mojom-wtf.h"
#include "modules/webusb/USBAlternateInterface.h"
#include "modules/webusb/USBConfiguration.h"
#include "modules/webusb/USBDevice.h"
@@ -20,7 +21,7 @@ USBInterface* USBInterface::create(const USBConfiguration* configuration, size_t
{
const auto& interfaces = configuration->info().interfaces;
for (size_t i = 0; i < interfaces.size(); ++i) {
- if (interfaces[i].interfaceNumber == interfaceNumber)
+ if (interfaces[i]->interface_number == interfaceNumber)
return new USBInterface(configuration->device(), configuration->index(), i);
}
exceptionState.throwRangeError("Invalid interface index.");
@@ -33,12 +34,12 @@ USBInterface::USBInterface(const USBDevice* device, size_t configurationIndex, s
, m_interfaceIndex(interfaceIndex)
{
ASSERT(m_configurationIndex < m_device->info().configurations.size());
- ASSERT(m_interfaceIndex < m_device->info().configurations[m_configurationIndex].interfaces.size());
+ ASSERT(m_interfaceIndex < m_device->info().configurations[m_configurationIndex]->interfaces.size());
}
-const WebUSBDeviceInfo::Interface& USBInterface::info() const
+const device::usb::wtf::InterfaceInfo& USBInterface::info() const
{
- return m_device->info().configurations[m_configurationIndex].interfaces[m_interfaceIndex];
+ return *m_device->info().configurations[m_configurationIndex]->interfaces[m_interfaceIndex];
}
USBAlternateInterface* USBInterface::alternate() const
@@ -56,11 +57,6 @@ HeapVector<Member<USBAlternateInterface>> USBInterface::alternates() const
return alternates;
}
-uint8_t USBInterface::interfaceNumber() const
-{
- return info().interfaceNumber;
-}
-
bool USBInterface::claimed() const
{
return m_device->isInterfaceClaimed(m_configurationIndex, m_interfaceIndex);

Powered by Google App Engine
This is Rietveld 408576698