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 DEVICE_USB_WEBUSB_DESCRIPTORS_H_ | 5 #ifndef DEVICE_USB_WEBUSB_DESCRIPTORS_H_ |
6 #define DEVICE_USB_WEBUSB_DESCRIPTORS_H_ | 6 #define DEVICE_USB_WEBUSB_DESCRIPTORS_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/callback_forward.h" | 13 #include "base/callback_forward.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/optional.h" |
15 #include "url/gurl.h" | 16 #include "url/gurl.h" |
16 | 17 |
17 namespace device { | 18 namespace device { |
18 | 19 |
19 class UsbDeviceHandle; | 20 class UsbDeviceHandle; |
20 | 21 |
21 struct WebUsbFunctionSubset { | 22 struct WebUsbFunctionSubset { |
22 WebUsbFunctionSubset(); | 23 WebUsbFunctionSubset(); |
23 WebUsbFunctionSubset(const WebUsbFunctionSubset& other); | 24 WebUsbFunctionSubset(const WebUsbFunctionSubset& other); |
24 ~WebUsbFunctionSubset(); | 25 ~WebUsbFunctionSubset(); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 }; | 64 }; |
64 | 65 |
65 bool ParseWebUsbUrlDescriptor(const std::vector<uint8_t>& bytes, GURL* output); | 66 bool ParseWebUsbUrlDescriptor(const std::vector<uint8_t>& bytes, GURL* output); |
66 | 67 |
67 void ReadWebUsbDescriptors( | 68 void ReadWebUsbDescriptors( |
68 scoped_refptr<UsbDeviceHandle> device_handle, | 69 scoped_refptr<UsbDeviceHandle> device_handle, |
69 const base::Callback< | 70 const base::Callback< |
70 void(std::unique_ptr<WebUsbAllowedOrigins> allowed_origins, | 71 void(std::unique_ptr<WebUsbAllowedOrigins> allowed_origins, |
71 const GURL& landing_page)>& callback); | 72 const GURL& landing_page)>& callback); |
72 | 73 |
73 // Check if the origin is allowed. | 74 // Check if the origin is allowed to access a given device, optionally filtering |
| 75 // by configuration and function. |
74 bool FindInWebUsbAllowedOrigins( | 76 bool FindInWebUsbAllowedOrigins( |
75 const device::WebUsbAllowedOrigins* allowed_origins, | 77 const device::WebUsbAllowedOrigins* allowed_origins, |
76 const GURL& origin); | 78 const GURL& origin, |
| 79 base::Optional<uint8_t> configuration_value, |
| 80 base::Optional<uint8_t> first_interface); |
77 | 81 |
78 } // device | 82 } // device |
79 | 83 |
80 #endif // DEVICE_USB_WEBUSB_DESCRIPTORS_H_ | 84 #endif // DEVICE_USB_WEBUSB_DESCRIPTORS_H_ |
OLD | NEW |