OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_USB_MOJO_PERMISSION_PROVIDER_H_ | 5 #ifndef DEVICE_USB_MOJO_PERMISSION_PROVIDER_H_ |
6 #define DEVICE_USB_MOJO_PERMISSION_PROVIDER_H_ | 6 #define DEVICE_USB_MOJO_PERMISSION_PROVIDER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
| 10 #include "base/memory/ref_counted.h" |
| 11 |
10 namespace device { | 12 namespace device { |
| 13 |
| 14 class UsbDevice; |
| 15 |
11 namespace usb { | 16 namespace usb { |
12 | 17 |
13 class DeviceInfo; | |
14 | |
15 // An implementation of this interface must be provided to a DeviceManager in | 18 // An implementation of this interface must be provided to a DeviceManager in |
16 // order to implement device permission checks. | 19 // order to implement device permission checks. |
17 class PermissionProvider { | 20 class PermissionProvider { |
18 public: | 21 public: |
19 PermissionProvider(); | 22 PermissionProvider(); |
20 virtual ~PermissionProvider(); | 23 virtual ~PermissionProvider(); |
21 | 24 |
22 virtual bool HasDevicePermission(const DeviceInfo& device_info) const = 0; | 25 virtual bool HasDevicePermission( |
| 26 scoped_refptr<const UsbDevice> device) const = 0; |
23 virtual bool HasConfigurationPermission( | 27 virtual bool HasConfigurationPermission( |
24 uint8_t requested_configuration, | 28 uint8_t requested_configuration, |
25 const DeviceInfo& device_info) const = 0; | 29 scoped_refptr<const UsbDevice> device) const = 0; |
26 virtual bool HasFunctionPermission(uint8_t requested_function, | 30 virtual bool HasFunctionPermission( |
27 uint8_t configuration_value, | 31 uint8_t requested_function, |
28 const DeviceInfo& device_info) const = 0; | 32 uint8_t configuration_value, |
| 33 scoped_refptr<const UsbDevice> device) const = 0; |
29 virtual void IncrementConnectionCount() = 0; | 34 virtual void IncrementConnectionCount() = 0; |
30 virtual void DecrementConnectionCount() = 0; | 35 virtual void DecrementConnectionCount() = 0; |
31 }; | 36 }; |
32 | 37 |
33 } // namespace usb | 38 } // namespace usb |
34 } // namespace device | 39 } // namespace device |
35 | 40 |
36 #endif // DEVICE_USB_MOJO_PERMISSION_PROVIDER_H_ | 41 #endif // DEVICE_USB_MOJO_PERMISSION_PROVIDER_H_ |
OLD | NEW |