Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Unified Diff: device/hid/hid_device_filter.h

Issue 514923002: Add more generic filters to the chrome.hid.getDevices API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clean up the chrome.hid documentation even more. Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/hid/hid.gyp ('k') | device/hid/hid_device_filter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/hid/hid_device_filter.h
diff --git a/device/hid/hid_device_filter.h b/device/hid/hid_device_filter.h
new file mode 100644
index 0000000000000000000000000000000000000000..a0abbb746583196f70bfed21e383bdfdbd937f1c
--- /dev/null
+++ b/device/hid/hid_device_filter.h
@@ -0,0 +1,43 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef DEVICE_HID_HID_DEVICE_FILTER_H_
+#define DEVICE_HID_HID_DEVICE_FILTER_H_
+
+#include <stdint.h>
+#include <vector>
+
+namespace device {
+
+struct HidDeviceInfo;
+
+class HidDeviceFilter {
+ public:
+ HidDeviceFilter();
+ ~HidDeviceFilter();
+
+ void SetVendorId(uint16_t vendor_id);
+ void SetProductId(uint16_t product_id);
+ void SetUsagePage(uint16_t usage_page);
+ void SetUsage(uint16_t usage);
+
+ bool Matches(const HidDeviceInfo& device_info) const;
+
+ static bool MatchesAny(const HidDeviceInfo& device_info,
+ const std::vector<HidDeviceFilter>& filters);
+
+ private:
+ uint16_t vendor_id_;
+ uint16_t product_id_;
+ uint16_t usage_page_;
+ uint16_t usage_;
+ bool vendor_id_set_ : 1;
+ bool product_id_set_ : 1;
+ bool usage_page_set_ : 1;
+ bool usage_set_ : 1;
+};
+
+} // namespace device
+
+#endif // DEVICE_HID_HID_DEVICE_FILTER_H_
« no previous file with comments | « device/hid/hid.gyp ('k') | device/hid/hid_device_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698