Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(695)

Side by Side Diff: device/usb/usb_descriptors.h

Issue 2821813002: Use Mojo enum types in the C++ USB interface (Closed)
Patch Set: Fix up //device/usb dependencies in //extensions/browser/api Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « device/usb/public/interfaces/device.mojom ('k') | device/usb/usb_descriptors.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_USB_DESCRIPTORS_H_ 5 #ifndef DEVICE_USB_USB_DESCRIPTORS_H_
6 #define DEVICE_USB_USB_DESCRIPTORS_H_ 6 #define DEVICE_USB_USB_DESCRIPTORS_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
11 #include <memory> 11 #include <memory>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/callback_forward.h" 14 #include "base/callback_forward.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/strings/string16.h" 16 #include "base/strings/string16.h"
17 #include "device/usb/public/interfaces/device.mojom.h"
17 18
18 namespace device { 19 namespace device {
19 20
20 class UsbDeviceHandle; 21 class UsbDeviceHandle;
21 22
22 enum UsbTransferType { 23 using UsbTransferType = mojom::UsbTransferType;
23 USB_TRANSFER_CONTROL = 0, 24 using UsbTransferDirection = mojom::UsbTransferDirection;
24 USB_TRANSFER_ISOCHRONOUS,
25 USB_TRANSFER_BULK,
26 USB_TRANSFER_INTERRUPT,
27 };
28
29 enum UsbEndpointDirection {
30 USB_DIRECTION_INBOUND = 0,
31 USB_DIRECTION_OUTBOUND,
32 };
33 25
34 enum UsbSynchronizationType { 26 enum UsbSynchronizationType {
35 USB_SYNCHRONIZATION_NONE = 0, 27 USB_SYNCHRONIZATION_NONE = 0,
36 USB_SYNCHRONIZATION_ASYNCHRONOUS, 28 USB_SYNCHRONIZATION_ASYNCHRONOUS,
37 USB_SYNCHRONIZATION_ADAPTIVE, 29 USB_SYNCHRONIZATION_ADAPTIVE,
38 USB_SYNCHRONIZATION_SYNCHRONOUS, 30 USB_SYNCHRONIZATION_SYNCHRONOUS,
39 }; 31 };
40 32
41 enum UsbUsageType { 33 enum UsbUsageType {
42 // Isochronous endpoint usages. 34 // Isochronous endpoint usages.
(...skipping 11 matching lines...) Expand all
54 UsbEndpointDescriptor(const uint8_t* data); 46 UsbEndpointDescriptor(const uint8_t* data);
55 UsbEndpointDescriptor(uint8_t address, 47 UsbEndpointDescriptor(uint8_t address,
56 uint8_t attributes, 48 uint8_t attributes,
57 uint16_t maximum_packet_size, 49 uint16_t maximum_packet_size,
58 uint8_t polling_interval); 50 uint8_t polling_interval);
59 UsbEndpointDescriptor() = delete; 51 UsbEndpointDescriptor() = delete;
60 UsbEndpointDescriptor(const UsbEndpointDescriptor& other); 52 UsbEndpointDescriptor(const UsbEndpointDescriptor& other);
61 ~UsbEndpointDescriptor(); 53 ~UsbEndpointDescriptor();
62 54
63 uint8_t address; 55 uint8_t address;
64 UsbEndpointDirection direction; 56 UsbTransferDirection direction;
65 uint16_t maximum_packet_size; 57 uint16_t maximum_packet_size;
66 UsbSynchronizationType synchronization_type; 58 UsbSynchronizationType synchronization_type;
67 UsbTransferType transfer_type; 59 UsbTransferType transfer_type;
68 UsbUsageType usage_type; 60 UsbUsageType usage_type;
69 uint8_t polling_interval; 61 uint8_t polling_interval;
70 std::vector<uint8_t> extra_data; 62 std::vector<uint8_t> extra_data;
71 }; 63 };
72 64
73 struct UsbInterfaceDescriptor { 65 struct UsbInterfaceDescriptor {
74 UsbInterfaceDescriptor(const uint8_t* data); 66 UsbInterfaceDescriptor(const uint8_t* data);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 141
150 void ReadUsbStringDescriptors( 142 void ReadUsbStringDescriptors(
151 scoped_refptr<UsbDeviceHandle> device_handle, 143 scoped_refptr<UsbDeviceHandle> device_handle,
152 std::unique_ptr<std::map<uint8_t, base::string16>> index_map, 144 std::unique_ptr<std::map<uint8_t, base::string16>> index_map,
153 const base::Callback< 145 const base::Callback<
154 void(std::unique_ptr<std::map<uint8_t, base::string16>>)>& callback); 146 void(std::unique_ptr<std::map<uint8_t, base::string16>>)>& callback);
155 147
156 } // namespace device 148 } // namespace device
157 149
158 #endif // DEVICE_USB_USB_DESCRIPTORS_H_ 150 #endif // DEVICE_USB_USB_DESCRIPTORS_H_
OLDNEW
« no previous file with comments | « device/usb/public/interfaces/device.mojom ('k') | device/usb/usb_descriptors.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698