OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_USB_WEB_USB_PERMISSION_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_USB_WEB_USB_PERMISSION_PROVIDER_H_ |
6 #define CHROME_BROWSER_USB_WEB_USB_PERMISSION_PROVIDER_H_ | 6 #define CHROME_BROWSER_USB_WEB_USB_PERMISSION_PROVIDER_H_ |
7 | 7 |
8 #include "device/devices_app/usb/public/interfaces/permission_provider.mojom.h" | 8 #include "device/devices_app/usb/public/interfaces/permission_provider.mojom.h" |
9 #include "mojo/common/weak_binding_set.h" | 9 #include "mojo/common/weak_binding_set.h" |
10 #include "third_party/mojo/src/mojo/public/cpp/bindings/array.h" | 10 #include "mojo/public/cpp/bindings/array.h" |
11 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h" | 11 #include "mojo/public/cpp/bindings/interface_request.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 class RenderFrameHost; | 14 class RenderFrameHost; |
15 } | 15 } |
16 | 16 |
17 // This implementation of the permission provider interface enforces the rules | 17 // This implementation of the permission provider interface enforces the rules |
18 // of the WebUSB permission model. Devices are checked for WebUSB descriptors | 18 // of the WebUSB permission model. Devices are checked for WebUSB descriptors |
19 // granting access to the render frame's current origin as well as permission | 19 // granting access to the render frame's current origin as well as permission |
20 // granted by the user through a device chooser UI. | 20 // granted by the user through a device chooser UI. |
21 class WebUSBPermissionProvider : public device::usb::PermissionProvider { | 21 class WebUSBPermissionProvider : public device::usb::PermissionProvider { |
(...skipping 18 matching lines...) Expand all Loading... |
40 const HasInterfacePermissionCallback& callback) override; | 40 const HasInterfacePermissionCallback& callback) override; |
41 void Bind( | 41 void Bind( |
42 mojo::InterfaceRequest<device::usb::PermissionProvider> request) override; | 42 mojo::InterfaceRequest<device::usb::PermissionProvider> request) override; |
43 | 43 |
44 private: | 44 private: |
45 mojo::WeakBindingSet<PermissionProvider> bindings_; | 45 mojo::WeakBindingSet<PermissionProvider> bindings_; |
46 content::RenderFrameHost* const render_frame_host_; | 46 content::RenderFrameHost* const render_frame_host_; |
47 }; | 47 }; |
48 | 48 |
49 #endif // CHROME_BROWSER_USB_WEB_USB_PERMISSION_PROVIDER_H_ | 49 #endif // CHROME_BROWSER_USB_WEB_USB_PERMISSION_PROVIDER_H_ |
OLD | NEW |