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 |
| 10 #include <memory> |
9 #include <vector> | 11 #include <vector> |
10 | 12 |
11 #include "base/callback_forward.h" | 13 #include "base/callback_forward.h" |
12 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
13 #include "url/gurl.h" | 15 #include "url/gurl.h" |
14 | 16 |
15 namespace device { | 17 namespace device { |
16 | 18 |
17 class UsbDeviceHandle; | 19 class UsbDeviceHandle; |
18 | 20 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 uint16_t version; | 59 uint16_t version; |
58 uint8_t vendor_code; | 60 uint8_t vendor_code; |
59 uint8_t landing_page_id; | 61 uint8_t landing_page_id; |
60 GURL landing_page; | 62 GURL landing_page; |
61 }; | 63 }; |
62 | 64 |
63 bool ParseWebUsbUrlDescriptor(const std::vector<uint8_t>& bytes, GURL* output); | 65 bool ParseWebUsbUrlDescriptor(const std::vector<uint8_t>& bytes, GURL* output); |
64 | 66 |
65 void ReadWebUsbDescriptors( | 67 void ReadWebUsbDescriptors( |
66 scoped_refptr<UsbDeviceHandle> device_handle, | 68 scoped_refptr<UsbDeviceHandle> device_handle, |
67 const base::Callback<void(scoped_ptr<WebUsbAllowedOrigins> allowed_origins, | 69 const base::Callback< |
68 const GURL& landing_page)>& callback); | 70 void(std::unique_ptr<WebUsbAllowedOrigins> allowed_origins, |
| 71 const GURL& landing_page)>& callback); |
69 | 72 |
70 // Check if the origin is allowed. | 73 // Check if the origin is allowed. |
71 bool FindInWebUsbAllowedOrigins( | 74 bool FindInWebUsbAllowedOrigins( |
72 const device::WebUsbAllowedOrigins* allowed_origins, | 75 const device::WebUsbAllowedOrigins* allowed_origins, |
73 const GURL& origin); | 76 const GURL& origin); |
74 | 77 |
75 } // device | 78 } // device |
76 | 79 |
77 #endif // DEVICE_USB_WEBUSB_DESCRIPTORS_H_ | 80 #endif // DEVICE_USB_WEBUSB_DESCRIPTORS_H_ |
OLD | NEW |