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

Side by Side Diff: device/usb/mojo/type_converters.cc

Issue 1830833002: Track USB endpoint state in Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@copy_interface
Patch Set: Addressed nits. Created 4 years, 9 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 | « no previous file | third_party/WebKit/LayoutTests/usb/usbDevice.html » ('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 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/mojo/type_converters.h" 5 #include "device/usb/mojo/type_converters.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 NOTREACHED(); 131 NOTREACHED();
132 return device::usb::EndpointType::BULK; 132 return device::usb::EndpointType::BULK;
133 } 133 }
134 } 134 }
135 135
136 // static 136 // static
137 device::usb::EndpointInfoPtr 137 device::usb::EndpointInfoPtr
138 TypeConverter<device::usb::EndpointInfoPtr, device::UsbEndpointDescriptor>:: 138 TypeConverter<device::usb::EndpointInfoPtr, device::UsbEndpointDescriptor>::
139 Convert(const device::UsbEndpointDescriptor& endpoint) { 139 Convert(const device::UsbEndpointDescriptor& endpoint) {
140 device::usb::EndpointInfoPtr info = device::usb::EndpointInfo::New(); 140 device::usb::EndpointInfoPtr info = device::usb::EndpointInfo::New();
141 info->endpoint_number = endpoint.address; 141 info->endpoint_number = endpoint.address & 0xf;
142 info->direction = 142 info->direction =
143 ConvertTo<device::usb::TransferDirection>(endpoint.direction); 143 ConvertTo<device::usb::TransferDirection>(endpoint.direction);
144 info->type = ConvertTo<device::usb::EndpointType>(endpoint.transfer_type); 144 info->type = ConvertTo<device::usb::EndpointType>(endpoint.transfer_type);
145 info->packet_size = static_cast<uint32_t>(endpoint.maximum_packet_size); 145 info->packet_size = static_cast<uint32_t>(endpoint.maximum_packet_size);
146 return info; 146 return info;
147 } 147 }
148 148
149 // static 149 // static
150 device::usb::AlternateInterfaceInfoPtr 150 device::usb::AlternateInterfaceInfoPtr
151 TypeConverter<device::usb::AlternateInterfaceInfoPtr, 151 TypeConverter<device::usb::AlternateInterfaceInfoPtr,
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 Convert(const device::UsbDeviceHandle::IsochronousPacket& packet) { 279 Convert(const device::UsbDeviceHandle::IsochronousPacket& packet) {
280 device::usb::IsochronousPacketPtr info = 280 device::usb::IsochronousPacketPtr info =
281 device::usb::IsochronousPacket::New(); 281 device::usb::IsochronousPacket::New();
282 info->length = packet.length; 282 info->length = packet.length;
283 info->transferred_length = packet.transferred_length; 283 info->transferred_length = packet.transferred_length;
284 info->status = mojo::ConvertTo<device::usb::TransferStatus>(packet.status); 284 info->status = mojo::ConvertTo<device::usb::TransferStatus>(packet.status);
285 return info; 285 return info;
286 } 286 }
287 287
288 } // namespace mojo 288 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/usb/usbDevice.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698