16e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved. 26e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 36e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// found in the LICENSE file. 46e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) 51320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#ifndef DEVICE_USB_USB_DEVICE_FILTER_H_ 61320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#define DEVICE_USB_USB_DEVICE_FILTER_H_ 71320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 81320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#include <vector> 96e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) 106e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)#include "base/memory/ref_counted.h" 116e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) 126e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)namespace base { 136e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)class Value; 146e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)} 156e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) 161320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tuccinamespace device { 176e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) 186e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)class UsbDevice; 196e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) 201320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucciclass UsbDeviceFilter { 216e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) public: 226e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) UsbDeviceFilter(); 236e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) ~UsbDeviceFilter(); 246e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) 256e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) void SetVendorId(uint16 vendor_id); 266e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) void SetProductId(uint16 product_id); 276e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) void SetInterfaceClass(uint8 interface_class); 286e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) void SetInterfaceSubclass(uint8 interface_subclass); 296e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) void SetInterfaceProtocol(uint8 interface_protocol); 306e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) 311320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci bool Matches(scoped_refptr<UsbDevice> device) const; 326e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) base::Value* ToValue() const; 336e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) 341320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci static bool MatchesAny(scoped_refptr<UsbDevice> device, 351320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci const std::vector<UsbDeviceFilter>& filters); 361320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 376e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) private: 386e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) uint16 vendor_id_; 396e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) uint16 product_id_; 406e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) uint8 interface_class_; 416e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) uint8 interface_subclass_; 426e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) uint8 interface_protocol_; 436e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) bool vendor_id_set_ : 1; 446e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) bool product_id_set_ : 1; 456e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) bool interface_class_set_ : 1; 466e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) bool interface_subclass_set_ : 1; 476e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) bool interface_protocol_set_ : 1; 486e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)}; 496e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) 501320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci} // namespace device 516e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) 521320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#endif // DEVICE_USB_USB_DEVICE_FILTER_H_ 53