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 #include "device/usb/webusb_descriptors.h" | 5 #include "device/usb/webusb_descriptors.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <iterator> | 9 #include <iterator> |
10 #include <map> | 10 #include <map> |
(...skipping 27 matching lines...) Expand all Loading... |
38 // These constants are defined by the WebUSB specification: | 38 // These constants are defined by the WebUSB specification: |
39 // http://wicg.github.io/webusb/ | 39 // http://wicg.github.io/webusb/ |
40 const uint8_t kGetAllowedOriginsRequest = 0x01; | 40 const uint8_t kGetAllowedOriginsRequest = 0x01; |
41 const uint8_t kGetUrlRequest = 0x02; | 41 const uint8_t kGetUrlRequest = 0x02; |
42 | 42 |
43 const uint8_t kWebUsbCapabilityUUID[16] = { | 43 const uint8_t kWebUsbCapabilityUUID[16] = { |
44 // Little-endian encoding of {3408b638-09a9-47a0-8bfd-a0768815b665}. | 44 // Little-endian encoding of {3408b638-09a9-47a0-8bfd-a0768815b665}. |
45 0x38, 0xB6, 0x08, 0x34, 0xA9, 0x09, 0xA0, 0x47, | 45 0x38, 0xB6, 0x08, 0x34, 0xA9, 0x09, 0xA0, 0x47, |
46 0x8B, 0xFD, 0xA0, 0x76, 0x88, 0x15, 0xB6, 0x65}; | 46 0x8B, 0xFD, 0xA0, 0x76, 0x88, 0x15, 0xB6, 0x65}; |
47 | 47 |
48 const int kControlTransferTimeout = 60000; // 1 minute | 48 const int kControlTransferTimeout = 2000; // 2 seconds |
49 | 49 |
50 using ReadWebUsbDescriptorsCallback = | 50 using ReadWebUsbDescriptorsCallback = |
51 base::Callback<void(std::unique_ptr<WebUsbAllowedOrigins> allowed_origins, | 51 base::Callback<void(std::unique_ptr<WebUsbAllowedOrigins> allowed_origins, |
52 const GURL& landing_page)>; | 52 const GURL& landing_page)>; |
53 | 53 |
54 using ReadWebUsbAllowedOriginsCallback = | 54 using ReadWebUsbAllowedOriginsCallback = |
55 base::Callback<void(std::unique_ptr<WebUsbAllowedOrigins> allowed_origins)>; | 55 base::Callback<void(std::unique_ptr<WebUsbAllowedOrigins> allowed_origins)>; |
56 | 56 |
57 // Parses a WebUSB Function Subset Header: | 57 // Parses a WebUSB Function Subset Header: |
58 // http://wicg.github.io/webusb/#dfn-function-subset-header | 58 // http://wicg.github.io/webusb/#dfn-function-subset-header |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 | 602 |
603 if (base::ContainsValue(function.origins, origin)) | 603 if (base::ContainsValue(function.origins, origin)) |
604 return true; | 604 return true; |
605 } | 605 } |
606 } | 606 } |
607 | 607 |
608 return false; | 608 return false; |
609 } | 609 } |
610 | 610 |
611 } // namespace device | 611 } // namespace device |
OLD | NEW |