| 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 <utility> |
| 8 |
| 7 #include "base/values.h" | 9 #include "base/values.h" |
| 8 #include "device/usb/usb_descriptors.h" | 10 #include "device/usb/usb_descriptors.h" |
| 9 #include "device/usb/usb_device.h" | 11 #include "device/usb/usb_device.h" |
| 10 | 12 |
| 11 namespace device { | 13 namespace device { |
| 12 | 14 |
| 13 namespace { | 15 namespace { |
| 14 | 16 |
| 15 const char kProductIdKey[] = "productId"; | 17 const char kProductIdKey[] = "productId"; |
| 16 const char kVendorIdKey[] = "vendorId"; | 18 const char kVendorIdKey[] = "vendorId"; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 if (interface_class_set_) { | 101 if (interface_class_set_) { |
| 100 obj->SetInteger(kInterfaceClassKey, interface_class_); | 102 obj->SetInteger(kInterfaceClassKey, interface_class_); |
| 101 if (interface_subclass_set_) { | 103 if (interface_subclass_set_) { |
| 102 obj->SetInteger(kInterfaceSubclassKey, interface_subclass_); | 104 obj->SetInteger(kInterfaceSubclassKey, interface_subclass_); |
| 103 if (interface_protocol_set_) { | 105 if (interface_protocol_set_) { |
| 104 obj->SetInteger(kInterfaceProtocolKey, interface_protocol_); | 106 obj->SetInteger(kInterfaceProtocolKey, interface_protocol_); |
| 105 } | 107 } |
| 106 } | 108 } |
| 107 } | 109 } |
| 108 | 110 |
| 109 return obj.Pass(); | 111 return std::move(obj); |
| 110 } | 112 } |
| 111 | 113 |
| 112 // static | 114 // static |
| 113 bool UsbDeviceFilter::MatchesAny(scoped_refptr<UsbDevice> device, | 115 bool UsbDeviceFilter::MatchesAny(scoped_refptr<UsbDevice> device, |
| 114 const std::vector<UsbDeviceFilter>& filters) { | 116 const std::vector<UsbDeviceFilter>& filters) { |
| 115 for (std::vector<UsbDeviceFilter>::const_iterator i = filters.begin(); | 117 for (std::vector<UsbDeviceFilter>::const_iterator i = filters.begin(); |
| 116 i != filters.end(); | 118 i != filters.end(); |
| 117 ++i) { | 119 ++i) { |
| 118 if (i->Matches(device)) { | 120 if (i->Matches(device)) { |
| 119 return true; | 121 return true; |
| 120 } | 122 } |
| 121 } | 123 } |
| 122 return false; | 124 return false; |
| 123 } | 125 } |
| 124 | 126 |
| 125 } // namespace device | 127 } // namespace device |
| OLD | NEW |