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

Side by Side Diff: device/hid/hid_device_filter.h

Issue 825523003: Convert HidDeviceInfo from a struct to a refcounted class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added TODO to remove friend class definitions. Created 5 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 unified diff | Download patch
« no previous file with comments | « device/hid/hid_connection_win.cc ('k') | device/hid/hid_device_filter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef DEVICE_HID_HID_DEVICE_FILTER_H_ 5 #ifndef DEVICE_HID_HID_DEVICE_FILTER_H_
6 #define DEVICE_HID_HID_DEVICE_FILTER_H_ 6 #define DEVICE_HID_HID_DEVICE_FILTER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/memory/ref_counted.h"
12
11 namespace device { 13 namespace device {
12 14
13 struct HidDeviceInfo; 15 class HidDeviceInfo;
14 16
15 class HidDeviceFilter { 17 class HidDeviceFilter {
16 public: 18 public:
17 HidDeviceFilter(); 19 HidDeviceFilter();
18 ~HidDeviceFilter(); 20 ~HidDeviceFilter();
19 21
20 void SetVendorId(uint16_t vendor_id); 22 void SetVendorId(uint16_t vendor_id);
21 void SetProductId(uint16_t product_id); 23 void SetProductId(uint16_t product_id);
22 void SetUsagePage(uint16_t usage_page); 24 void SetUsagePage(uint16_t usage_page);
23 void SetUsage(uint16_t usage); 25 void SetUsage(uint16_t usage);
24 26
25 bool Matches(const HidDeviceInfo& device_info) const; 27 bool Matches(scoped_refptr<const HidDeviceInfo> device_info) const;
26 28
27 static bool MatchesAny(const HidDeviceInfo& device_info, 29 static bool MatchesAny(scoped_refptr<const HidDeviceInfo> device_info,
28 const std::vector<HidDeviceFilter>& filters); 30 const std::vector<HidDeviceFilter>& filters);
29 31
30 private: 32 private:
31 uint16_t vendor_id_; 33 uint16_t vendor_id_;
32 uint16_t product_id_; 34 uint16_t product_id_;
33 uint16_t usage_page_; 35 uint16_t usage_page_;
34 uint16_t usage_; 36 uint16_t usage_;
35 bool vendor_id_set_ : 1; 37 bool vendor_id_set_ : 1;
36 bool product_id_set_ : 1; 38 bool product_id_set_ : 1;
37 bool usage_page_set_ : 1; 39 bool usage_page_set_ : 1;
38 bool usage_set_ : 1; 40 bool usage_set_ : 1;
39 }; 41 };
40 42
41 } // namespace device 43 } // namespace device
42 44
43 #endif // DEVICE_HID_HID_DEVICE_FILTER_H_ 45 #endif // DEVICE_HID_HID_DEVICE_FILTER_H_
OLDNEW
« no previous file with comments | « device/hid/hid_connection_win.cc ('k') | device/hid/hid_device_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698