Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / device / hid / hid_device_filter.h
blobfbffd2bfdbab0e11ffd448f167ce8eb120d2061f
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
3 // found in the LICENSE file.
5 #ifndef DEVICE_HID_HID_DEVICE_FILTER_H_
6 #define DEVICE_HID_HID_DEVICE_FILTER_H_
8 #include <stdint.h>
9 #include <vector>
11 #include "base/memory/ref_counted.h"
13 namespace device {
15 class HidDeviceInfo;
17 class HidDeviceFilter {
18 public:
19 HidDeviceFilter();
20 ~HidDeviceFilter();
22 void SetVendorId(uint16_t vendor_id);
23 void SetProductId(uint16_t product_id);
24 void SetUsagePage(uint16_t usage_page);
25 void SetUsage(uint16_t usage);
27 bool Matches(scoped_refptr<const HidDeviceInfo> device_info) const;
29 static bool MatchesAny(scoped_refptr<const HidDeviceInfo> device_info,
30 const std::vector<HidDeviceFilter>& filters);
32 private:
33 uint16_t vendor_id_;
34 uint16_t product_id_;
35 uint16_t usage_page_;
36 uint16_t usage_;
37 bool vendor_id_set_ : 1;
38 bool product_id_set_ : 1;
39 bool usage_page_set_ : 1;
40 bool usage_set_ : 1;
43 } // namespace device
45 #endif // DEVICE_HID_HID_DEVICE_FILTER_H_