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