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

Unified Diff: components/usb_service/usb_device_filter.h

Issue 462753002: Add usb_service::UsbDeviceFilter class for device matching. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add UsbDevice::RequestUsbAccess to the mock (and fix spelling). 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 | « components/usb_service/usb_device.h ('k') | components/usb_service/usb_device_filter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/usb_service/usb_device_filter.h
diff --git a/components/usb_service/usb_device_filter.h b/components/usb_service/usb_device_filter.h
new file mode 100644
index 0000000000000000000000000000000000000000..76a3b2c73967f6bf2672e610988bdd7298d7e021
--- /dev/null
+++ b/components/usb_service/usb_device_filter.h
@@ -0,0 +1,48 @@
+// 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 COMPONENTS_USB_SERVICE_USB_DEVICE_FILTER_H_
+#define COMPONENTS_USB_SERVICE_USB_DEVICE_FILTER_H_
+
+#include "base/memory/ref_counted.h"
+#include "components/usb_service/usb_service_export.h"
+
+namespace base {
+class Value;
+}
+
+namespace usb_service {
+
+class UsbDevice;
+
+class USB_SERVICE_EXPORT UsbDeviceFilter {
+ public:
+ UsbDeviceFilter();
+ ~UsbDeviceFilter();
+
+ void SetVendorId(uint16 vendor_id);
+ void SetProductId(uint16 product_id);
+ void SetInterfaceClass(uint8 interface_class);
+ void SetInterfaceSubclass(uint8 interface_subclass);
+ void SetInterfaceProtocol(uint8 interface_protocol);
+
+ bool Matches(scoped_refptr<UsbDevice> device);
+ base::Value* ToValue() const;
+
+ private:
+ uint16 vendor_id_;
+ uint16 product_id_;
+ uint8 interface_class_;
+ uint8 interface_subclass_;
+ uint8 interface_protocol_;
+ bool vendor_id_set_ : 1;
+ bool product_id_set_ : 1;
+ bool interface_class_set_ : 1;
+ bool interface_subclass_set_ : 1;
+ bool interface_protocol_set_ : 1;
+};
+
+} // namespace usb_service
+
+#endif // COMPONENTS_USB_SERVICE_USB_DEVICE_FILTER_H_
« no previous file with comments | « components/usb_service/usb_device.h ('k') | components/usb_service/usb_device_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698