| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "device/usb/usb_device_filter.h" | 5 #include "device/usb/usb_device_filter.h" |
| 6 | 6 |
| 7 #include "base/values.h" | 7 #include "base/values.h" |
| 8 #include "device/usb/usb_descriptors.h" | 8 #include "device/usb/usb_descriptors.h" |
| 9 #include "device/usb/usb_device.h" | 9 #include "device/usb/usb_device.h" |
| 10 | 10 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 if (device->vendor_id() != vendor_id_) { | 61 if (device->vendor_id() != vendor_id_) { |
| 62 return false; | 62 return false; |
| 63 } | 63 } |
| 64 | 64 |
| 65 if (product_id_set_ && device->product_id() != product_id_) { | 65 if (product_id_set_ && device->product_id() != product_id_) { |
| 66 return false; | 66 return false; |
| 67 } | 67 } |
| 68 } | 68 } |
| 69 | 69 |
| 70 if (interface_class_set_) { | 70 if (interface_class_set_) { |
| 71 const UsbConfigDescriptor* config = device->GetConfiguration(); | 71 const UsbConfigDescriptor* config = device->GetCurrentConfiguration(); |
| 72 if (!config) { | 72 if (!config) { |
| 73 return false; | 73 return false; |
| 74 } | 74 } |
| 75 | 75 |
| 76 // TODO(reillyg): Check device configuration if the class is not defined at | 76 // TODO(reillyg): Check device configuration if the class is not defined at |
| 77 // a per-interface level. This is not really important because most devices | 77 // a per-interface level. This is not really important because most devices |
| 78 // have per-interface classes. The only counter-examples I know of are hubs. | 78 // have per-interface classes. The only counter-examples I know of are hubs. |
| 79 | 79 |
| 80 bool foundMatch = false; | 80 bool foundMatch = false; |
| 81 for (const UsbInterfaceDescriptor& iface : config->interfaces) { | 81 for (const UsbInterfaceDescriptor& iface : config->interfaces) { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 i != filters.end(); | 126 i != filters.end(); |
| 127 ++i) { | 127 ++i) { |
| 128 if (i->Matches(device)) { | 128 if (i->Matches(device)) { |
| 129 return true; | 129 return true; |
| 130 } | 130 } |
| 131 } | 131 } |
| 132 return false; | 132 return false; |
| 133 } | 133 } |
| 134 | 134 |
| 135 } // namespace device | 135 } // namespace device |
| OLD | NEW |