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 COMPONENTS_USB_SERVICE_USB_DEVICE_FILTER_H_ | 5 #ifndef DEVICE_USB_USB_DEVICE_FILTER_H_ |
6 #define COMPONENTS_USB_SERVICE_USB_DEVICE_FILTER_H_ | 6 #define DEVICE_USB_USB_DEVICE_FILTER_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "components/usb_service/usb_service_export.h" | |
10 | 9 |
11 namespace base { | 10 namespace base { |
12 class Value; | 11 class Value; |
13 } | 12 } |
14 | 13 |
15 namespace usb_service { | 14 namespace device { |
16 | 15 |
17 class UsbDevice; | 16 class UsbDevice; |
18 | 17 |
19 class USB_SERVICE_EXPORT UsbDeviceFilter { | 18 class UsbDeviceFilter { |
20 public: | 19 public: |
21 UsbDeviceFilter(); | 20 UsbDeviceFilter(); |
22 ~UsbDeviceFilter(); | 21 ~UsbDeviceFilter(); |
23 | 22 |
24 void SetVendorId(uint16 vendor_id); | 23 void SetVendorId(uint16 vendor_id); |
25 void SetProductId(uint16 product_id); | 24 void SetProductId(uint16 product_id); |
26 void SetInterfaceClass(uint8 interface_class); | 25 void SetInterfaceClass(uint8 interface_class); |
27 void SetInterfaceSubclass(uint8 interface_subclass); | 26 void SetInterfaceSubclass(uint8 interface_subclass); |
28 void SetInterfaceProtocol(uint8 interface_protocol); | 27 void SetInterfaceProtocol(uint8 interface_protocol); |
29 | 28 |
30 bool Matches(scoped_refptr<UsbDevice> device); | 29 bool Matches(scoped_refptr<UsbDevice> device); |
31 base::Value* ToValue() const; | 30 base::Value* ToValue() const; |
32 | 31 |
33 private: | 32 private: |
34 uint16 vendor_id_; | 33 uint16 vendor_id_; |
35 uint16 product_id_; | 34 uint16 product_id_; |
36 uint8 interface_class_; | 35 uint8 interface_class_; |
37 uint8 interface_subclass_; | 36 uint8 interface_subclass_; |
38 uint8 interface_protocol_; | 37 uint8 interface_protocol_; |
39 bool vendor_id_set_ : 1; | 38 bool vendor_id_set_ : 1; |
40 bool product_id_set_ : 1; | 39 bool product_id_set_ : 1; |
41 bool interface_class_set_ : 1; | 40 bool interface_class_set_ : 1; |
42 bool interface_subclass_set_ : 1; | 41 bool interface_subclass_set_ : 1; |
43 bool interface_protocol_set_ : 1; | 42 bool interface_protocol_set_ : 1; |
44 }; | 43 }; |
45 | 44 |
46 } // namespace usb_service | 45 } // namespace device |
47 | 46 |
48 #endif // COMPONENTS_USB_SERVICE_USB_DEVICE_FILTER_H_ | 47 #endif // DEVICE_USB_USB_DEVICE_FILTER_H_ |
OLD | NEW |