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

Side by Side Diff: device/usb/usb_interface_impl.cc

Issue 497363004: Merge components/usb_service into device/usb. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 6 years, 3 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/usb_interface_impl.h ('k') | device/usb/usb_service.h » ('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 #include "components/usb_service/usb_interface_impl.h" 5 #include "device/usb/usb_interface_impl.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "third_party/libusb/src/libusb/libusb.h" 8 #include "third_party/libusb/src/libusb/libusb.h"
9 9
10 namespace usb_service { 10 namespace device {
11 11
12 UsbEndpointDescriptorImpl::UsbEndpointDescriptorImpl( 12 UsbEndpointDescriptorImpl::UsbEndpointDescriptorImpl(
13 scoped_refptr<const UsbConfigDescriptor> config, 13 scoped_refptr<const UsbConfigDescriptor> config,
14 PlatformUsbEndpointDescriptor descriptor) 14 PlatformUsbEndpointDescriptor descriptor)
15 : config_(config), descriptor_(descriptor) { 15 : config_(config), descriptor_(descriptor) {
16 } 16 }
17 17
18 UsbEndpointDescriptorImpl::~UsbEndpointDescriptorImpl() { 18 UsbEndpointDescriptorImpl::~UsbEndpointDescriptorImpl() {
19 } 19 }
20 20
(...skipping 10 matching lines...) Expand all
31 default: 31 default:
32 NOTREACHED(); 32 NOTREACHED();
33 return USB_DIRECTION_INBOUND; 33 return USB_DIRECTION_INBOUND;
34 } 34 }
35 } 35 }
36 36
37 int UsbEndpointDescriptorImpl::GetMaximumPacketSize() const { 37 int UsbEndpointDescriptorImpl::GetMaximumPacketSize() const {
38 return descriptor_->wMaxPacketSize; 38 return descriptor_->wMaxPacketSize;
39 } 39 }
40 40
41 UsbSynchronizationType 41 UsbSynchronizationType UsbEndpointDescriptorImpl::GetSynchronizationType()
42 UsbEndpointDescriptorImpl::GetSynchronizationType() const { 42 const {
43 switch (descriptor_->bmAttributes & LIBUSB_ISO_SYNC_TYPE_MASK) { 43 switch (descriptor_->bmAttributes & LIBUSB_ISO_SYNC_TYPE_MASK) {
44 case LIBUSB_ISO_SYNC_TYPE_NONE: 44 case LIBUSB_ISO_SYNC_TYPE_NONE:
45 return USB_SYNCHRONIZATION_NONE; 45 return USB_SYNCHRONIZATION_NONE;
46 case LIBUSB_ISO_SYNC_TYPE_ASYNC: 46 case LIBUSB_ISO_SYNC_TYPE_ASYNC:
47 return USB_SYNCHRONIZATION_ASYNCHRONOUS; 47 return USB_SYNCHRONIZATION_ASYNCHRONOUS;
48 case LIBUSB_ISO_SYNC_TYPE_ADAPTIVE: 48 case LIBUSB_ISO_SYNC_TYPE_ADAPTIVE:
49 return USB_SYNCHRONIZATION_ADAPTIVE; 49 return USB_SYNCHRONIZATION_ADAPTIVE;
50 case LIBUSB_ISO_SYNC_TYPE_SYNC: 50 case LIBUSB_ISO_SYNC_TYPE_SYNC:
51 return USB_SYNCHRONIZATION_SYNCHRONOUS; 51 return USB_SYNCHRONIZATION_SYNCHRONOUS;
52 default: 52 default:
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 154
155 UsbConfigDescriptorImpl::~UsbConfigDescriptorImpl() { 155 UsbConfigDescriptorImpl::~UsbConfigDescriptorImpl() {
156 libusb_free_config_descriptor(config_); 156 libusb_free_config_descriptor(config_);
157 } 157 }
158 158
159 size_t UsbConfigDescriptorImpl::GetNumInterfaces() const { 159 size_t UsbConfigDescriptorImpl::GetNumInterfaces() const {
160 return config_->bNumInterfaces; 160 return config_->bNumInterfaces;
161 } 161 }
162 162
163 scoped_refptr<const UsbInterfaceDescriptor> 163 scoped_refptr<const UsbInterfaceDescriptor>
164 UsbConfigDescriptorImpl::GetInterface(size_t index) const { 164 UsbConfigDescriptorImpl::GetInterface(size_t index) const {
165 return new UsbInterfaceDescriptorImpl(this, &config_->interface[index]); 165 return new UsbInterfaceDescriptorImpl(this, &config_->interface[index]);
166 } 166 }
167 167
168 } // namespace usb_service 168 } // namespace device
OLDNEW
« no previous file with comments | « device/usb/usb_interface_impl.h ('k') | device/usb/usb_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698