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

Side by Side Diff: chrome/browser/extensions/api/hid/hid_device_manager.h

Issue 258733002: Block some HID devices from chrome.hid. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test TODO Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/extensions/api/hid/hid_device_manager.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 CHROME_BROWSER_EXTENSIONS_API_HID_HID_DEVICE_MANAGER_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_HID_HID_DEVICE_MANAGER_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_HID_HID_DEVICE_MANAGER_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_HID_HID_DEVICE_MANAGER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 26 matching lines...) Expand all
37 37
38 bool GetDeviceInfo(int resource_id, device::HidDeviceInfo* device_info); 38 bool GetDeviceInfo(int resource_id, device::HidDeviceInfo* device_info);
39 39
40 private: 40 private:
41 friend class BrowserContextKeyedAPIFactory<HidDeviceManager>; 41 friend class BrowserContextKeyedAPIFactory<HidDeviceManager>;
42 42
43 static const char* service_name() { return "HidDeviceManager"; } 43 static const char* service_name() { return "HidDeviceManager"; }
44 44
45 void UpdateDevices(); 45 void UpdateDevices();
46 46
47 // Determines if a given device interface should be accessible to API
48 // consumers. In order for a device interface to be accessible, ALL of its
49 // specified usages must be accessible.
50 static bool IsDeviceAccessible(const device::HidDeviceInfo& device_info);
51
52 // Determines if a given usage is available to API consumers. This is used to
53 // blacklist usages which could be security or privacy concerns.
54 static bool IsUsageAccessible(const device::HidUsageAndPage& usage_and_page);
55
47 base::ThreadChecker thread_checker_; 56 base::ThreadChecker thread_checker_;
48 57
49 int next_resource_id_; 58 int next_resource_id_;
50 59
51 typedef std::map<int, device::HidDeviceId> ResourceIdToDeviceIdMap; 60 typedef std::map<int, device::HidDeviceId> ResourceIdToDeviceIdMap;
52 typedef std::map<device::HidDeviceId, int> DeviceIdToResourceIdMap; 61 typedef std::map<device::HidDeviceId, int> DeviceIdToResourceIdMap;
53 62
54 ResourceIdToDeviceIdMap device_ids_; 63 ResourceIdToDeviceIdMap device_ids_;
55 DeviceIdToResourceIdMap resource_ids_; 64 DeviceIdToResourceIdMap resource_ids_;
56 65
57 DISALLOW_COPY_AND_ASSIGN(HidDeviceManager); 66 DISALLOW_COPY_AND_ASSIGN(HidDeviceManager);
58 }; 67 };
59 68
60 } // namespace extensions 69 } // namespace extensions
61 70
62 #endif // CHROME_BROWSER_EXTENSIONS_API_HID_HID_DEVICE_MANAGER_H_ 71 #endif // CHROME_BROWSER_EXTENSIONS_API_HID_HID_DEVICE_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/hid/hid_device_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698