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 <memory> |
7 #include <utility> | 8 #include <utility> |
8 | 9 |
9 #include "base/values.h" | 10 #include "base/values.h" |
10 #include "device/usb/usb_descriptors.h" | 11 #include "device/usb/usb_descriptors.h" |
11 #include "device/usb/usb_device.h" | 12 #include "device/usb/usb_device.h" |
12 | 13 |
13 namespace device { | 14 namespace device { |
14 | 15 |
15 namespace { | 16 namespace { |
16 | 17 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 } | 84 } |
84 } | 85 } |
85 } | 86 } |
86 | 87 |
87 return false; | 88 return false; |
88 } | 89 } |
89 | 90 |
90 return true; | 91 return true; |
91 } | 92 } |
92 | 93 |
93 scoped_ptr<base::Value> UsbDeviceFilter::ToValue() const { | 94 std::unique_ptr<base::Value> UsbDeviceFilter::ToValue() const { |
94 scoped_ptr<base::DictionaryValue> obj(new base::DictionaryValue()); | 95 std::unique_ptr<base::DictionaryValue> obj(new base::DictionaryValue()); |
95 | 96 |
96 if (vendor_id_set_) { | 97 if (vendor_id_set_) { |
97 obj->SetInteger(kVendorIdKey, vendor_id_); | 98 obj->SetInteger(kVendorIdKey, vendor_id_); |
98 if (product_id_set_) { | 99 if (product_id_set_) { |
99 obj->SetInteger(kProductIdKey, product_id_); | 100 obj->SetInteger(kProductIdKey, product_id_); |
100 } | 101 } |
101 } | 102 } |
102 | 103 |
103 if (interface_class_set_) { | 104 if (interface_class_set_) { |
104 obj->SetInteger(kInterfaceClassKey, interface_class_); | 105 obj->SetInteger(kInterfaceClassKey, interface_class_); |
(...skipping 15 matching lines...) Expand all Loading... |
120 i != filters.end(); | 121 i != filters.end(); |
121 ++i) { | 122 ++i) { |
122 if (i->Matches(device)) { | 123 if (i->Matches(device)) { |
123 return true; | 124 return true; |
124 } | 125 } |
125 } | 126 } |
126 return false; | 127 return false; |
127 } | 128 } |
128 | 129 |
129 } // namespace device | 130 } // namespace device |
OLD | NEW |