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

Unified Diff: device/usb/usb_device_filter.h

Issue 2615353002: Typemap device.usb.DeviceFilter to device::UsbDeviceFilter. (Closed)
Patch Set: Addressed juncai@'s feedback. Created 3 years, 11 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/usb/public/interfaces/typemaps.gni ('k') | device/usb/usb_device_filter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/usb/usb_device_filter.h
diff --git a/device/usb/usb_device_filter.h b/device/usb/usb_device_filter.h
index d70526427375bc6e0dce843660536284c4e55f62..6f2936da96a1e62dc6f52e805b3d063f71ddffa0 100644
--- a/device/usb/usb_device_filter.h
+++ b/device/usb/usb_device_filter.h
@@ -11,6 +11,7 @@
#include <vector>
#include "base/memory/ref_counted.h"
+#include "base/optional.h"
namespace base {
class Value;
@@ -20,35 +21,22 @@ namespace device {
class UsbDevice;
-class UsbDeviceFilter {
- public:
+struct UsbDeviceFilter {
UsbDeviceFilter();
UsbDeviceFilter(const UsbDeviceFilter& other);
~UsbDeviceFilter();
- void SetVendorId(uint16_t vendor_id);
- void SetProductId(uint16_t product_id);
- void SetInterfaceClass(uint8_t interface_class);
- void SetInterfaceSubclass(uint8_t interface_subclass);
- void SetInterfaceProtocol(uint8_t interface_protocol);
-
bool Matches(scoped_refptr<UsbDevice> device) const;
std::unique_ptr<base::Value> ToValue() const;
static bool MatchesAny(scoped_refptr<UsbDevice> device,
const std::vector<UsbDeviceFilter>& filters);
- private:
- uint16_t vendor_id_;
- uint16_t product_id_;
- uint8_t interface_class_;
- uint8_t interface_subclass_;
- uint8_t 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;
+ base::Optional<uint16_t> vendor_id;
+ base::Optional<uint16_t> product_id;
+ base::Optional<uint8_t> interface_class;
+ base::Optional<uint8_t> interface_subclass;
+ base::Optional<uint8_t> interface_protocol;
};
} // namespace device
« no previous file with comments | « device/usb/public/interfaces/typemaps.gni ('k') | device/usb/usb_device_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698