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

Unified Diff: device/usb/usb_device_filter.cc

Issue 1337413003: Match against all configurations in UsbDeviceFilter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update printer detector tests. Created 5 years, 3 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 | « device/usb/mock_usb_device.cc ('k') | device/usb/usb_device_filter_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/usb/usb_device_filter.cc
diff --git a/device/usb/usb_device_filter.cc b/device/usb/usb_device_filter.cc
index 796b514e2348d8853143f135fc707c9f3ebc9868..fb0618bdd7264f31e75822afdf19b21237a1d1aa 100644
--- a/device/usb/usb_device_filter.cc
+++ b/device/usb/usb_device_filter.cc
@@ -68,29 +68,19 @@ bool UsbDeviceFilter::Matches(scoped_refptr<UsbDevice> device) const {
}
if (interface_class_set_) {
- const UsbConfigDescriptor* config = device->GetActiveConfiguration();
- if (!config) {
- return false;
- }
-
- // TODO(reillyg): Check device configuration if the class is not defined at
- // a per-interface level. This is not really important because most devices
- // have per-interface classes. The only counter-examples I know of are hubs.
-
- bool foundMatch = false;
- for (const UsbInterfaceDescriptor& iface : config->interfaces) {
- if (iface.interface_class == interface_class_ &&
- (!interface_subclass_set_ ||
- (iface.interface_subclass == interface_subclass_ &&
- (!interface_protocol_set_ ||
- iface.interface_protocol == interface_protocol_)))) {
- foundMatch = true;
+ for (const UsbConfigDescriptor& config : device->configurations()) {
+ for (const UsbInterfaceDescriptor& iface : config.interfaces) {
+ if (iface.interface_class == interface_class_ &&
+ (!interface_subclass_set_ ||
+ (iface.interface_subclass == interface_subclass_ &&
+ (!interface_protocol_set_ ||
+ iface.interface_protocol == interface_protocol_)))) {
+ return true;
+ }
}
}
- if (!foundMatch) {
- return false;
- }
+ return false;
}
return true;
« no previous file with comments | « device/usb/mock_usb_device.cc ('k') | device/usb/usb_device_filter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698