OLD | NEW |
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 EXTENSIONS_BROWSER_API_HID_HID_DEVICE_MANAGER_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_HID_HID_DEVICE_MANAGER_H_ |
6 #define EXTENSIONS_BROWSER_API_HID_HID_DEVICE_MANAGER_H_ | 6 #define EXTENSIONS_BROWSER_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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 bool GetDeviceInfo(int resource_id, device::HidDeviceInfo* device_info); | 45 bool GetDeviceInfo(int resource_id, device::HidDeviceInfo* device_info); |
46 | 46 |
47 bool HasPermission(const Extension* extension, | 47 bool HasPermission(const Extension* extension, |
48 const device::HidDeviceInfo& device_info); | 48 const device::HidDeviceInfo& device_info); |
49 | 49 |
50 private: | 50 private: |
51 friend class BrowserContextKeyedAPIFactory<HidDeviceManager>; | 51 friend class BrowserContextKeyedAPIFactory<HidDeviceManager>; |
52 | 52 |
53 static const char* service_name() { return "HidDeviceManager"; } | 53 static const char* service_name() { return "HidDeviceManager"; } |
| 54 static bool IsCalledOnValidThread(); |
54 | 55 |
55 void UpdateDevices(); | 56 void UpdateDevices(); |
56 | 57 |
57 base::ThreadChecker thread_checker_; | |
58 | |
59 int next_resource_id_; | 58 int next_resource_id_; |
60 | 59 |
61 typedef std::map<int, device::HidDeviceId> ResourceIdToDeviceIdMap; | 60 typedef std::map<int, device::HidDeviceId> ResourceIdToDeviceIdMap; |
62 typedef std::map<device::HidDeviceId, int> DeviceIdToResourceIdMap; | 61 typedef std::map<device::HidDeviceId, int> DeviceIdToResourceIdMap; |
63 | 62 |
64 ResourceIdToDeviceIdMap device_ids_; | 63 ResourceIdToDeviceIdMap device_ids_; |
65 DeviceIdToResourceIdMap resource_ids_; | 64 DeviceIdToResourceIdMap resource_ids_; |
66 | 65 |
67 DISALLOW_COPY_AND_ASSIGN(HidDeviceManager); | 66 DISALLOW_COPY_AND_ASSIGN(HidDeviceManager); |
68 }; | 67 }; |
69 | 68 |
70 } // namespace extensions | 69 } // namespace extensions |
71 | 70 |
72 #endif // EXTENSIONS_BROWSER_API_HID_HID_DEVICE_MANAGER_H_ | 71 #endif // EXTENSIONS_BROWSER_API_HID_HID_DEVICE_MANAGER_H_ |
OLD | NEW |