| 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 #ifndef DEVICE_USB_USB_DEVICE_FILTER_H_ | 5 #ifndef DEVICE_USB_USB_DEVICE_FILTER_H_ |
| 6 #define DEVICE_USB_USB_DEVICE_FILTER_H_ | 6 #define DEVICE_USB_USB_DEVICE_FILTER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> |
| 10 #include <vector> | 11 #include <vector> |
| 11 | 12 |
| 12 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 | 14 |
| 15 namespace base { | 15 namespace base { |
| 16 class Value; | 16 class Value; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace device { | 19 namespace device { |
| 20 | 20 |
| 21 class UsbDevice; | 21 class UsbDevice; |
| 22 | 22 |
| 23 class UsbDeviceFilter { | 23 class UsbDeviceFilter { |
| 24 public: | 24 public: |
| 25 UsbDeviceFilter(); | 25 UsbDeviceFilter(); |
| 26 UsbDeviceFilter(const UsbDeviceFilter& other); | 26 UsbDeviceFilter(const UsbDeviceFilter& other); |
| 27 ~UsbDeviceFilter(); | 27 ~UsbDeviceFilter(); |
| 28 | 28 |
| 29 void SetVendorId(uint16_t vendor_id); | 29 void SetVendorId(uint16_t vendor_id); |
| 30 void SetProductId(uint16_t product_id); | 30 void SetProductId(uint16_t product_id); |
| 31 void SetInterfaceClass(uint8_t interface_class); | 31 void SetInterfaceClass(uint8_t interface_class); |
| 32 void SetInterfaceSubclass(uint8_t interface_subclass); | 32 void SetInterfaceSubclass(uint8_t interface_subclass); |
| 33 void SetInterfaceProtocol(uint8_t interface_protocol); | 33 void SetInterfaceProtocol(uint8_t interface_protocol); |
| 34 | 34 |
| 35 bool Matches(scoped_refptr<UsbDevice> device) const; | 35 bool Matches(scoped_refptr<UsbDevice> device) const; |
| 36 scoped_ptr<base::Value> ToValue() const; | 36 std::unique_ptr<base::Value> ToValue() const; |
| 37 | 37 |
| 38 static bool MatchesAny(scoped_refptr<UsbDevice> device, | 38 static bool MatchesAny(scoped_refptr<UsbDevice> device, |
| 39 const std::vector<UsbDeviceFilter>& filters); | 39 const std::vector<UsbDeviceFilter>& filters); |
| 40 | 40 |
| 41 private: | 41 private: |
| 42 uint16_t vendor_id_; | 42 uint16_t vendor_id_; |
| 43 uint16_t product_id_; | 43 uint16_t product_id_; |
| 44 uint8_t interface_class_; | 44 uint8_t interface_class_; |
| 45 uint8_t interface_subclass_; | 45 uint8_t interface_subclass_; |
| 46 uint8_t interface_protocol_; | 46 uint8_t interface_protocol_; |
| 47 bool vendor_id_set_ : 1; | 47 bool vendor_id_set_ : 1; |
| 48 bool product_id_set_ : 1; | 48 bool product_id_set_ : 1; |
| 49 bool interface_class_set_ : 1; | 49 bool interface_class_set_ : 1; |
| 50 bool interface_subclass_set_ : 1; | 50 bool interface_subclass_set_ : 1; |
| 51 bool interface_protocol_set_ : 1; | 51 bool interface_protocol_set_ : 1; |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 } // namespace device | 54 } // namespace device |
| 55 | 55 |
| 56 #endif // DEVICE_USB_USB_DEVICE_FILTER_H_ | 56 #endif // DEVICE_USB_USB_DEVICE_FILTER_H_ |
| OLD | NEW |