| 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 "modules/webusb/USBEndpoint.h" | 5 #include "modules/webusb/USBEndpoint.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
| 8 #include "core/dom/DOMException.h" | 8 #include "core/dom/DOMException.h" |
| 9 #include "device/usb/public/interfaces/device.mojom-wtf.h" | 9 #include "device/usb/public/interfaces/device.mojom-blink.h" |
| 10 #include "modules/webusb/USBAlternateInterface.h" | 10 #include "modules/webusb/USBAlternateInterface.h" |
| 11 | 11 |
| 12 using device::usb::wtf::EndpointType; | 12 using device::usb::blink::EndpointType; |
| 13 using device::usb::wtf::TransferDirection; | 13 using device::usb::blink::TransferDirection; |
| 14 | 14 |
| 15 namespace blink { | 15 namespace blink { |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 String convertDirectionToEnum(const TransferDirection& direction) | 19 String convertDirectionToEnum(const TransferDirection& direction) |
| 20 { | 20 { |
| 21 switch (direction) { | 21 switch (direction) { |
| 22 case TransferDirection::INBOUND: | 22 case TransferDirection::INBOUND: |
| 23 return "in"; | 23 return "in"; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 } | 65 } |
| 66 | 66 |
| 67 USBEndpoint::USBEndpoint(const USBAlternateInterface* alternate, size_t endpoint
Index) | 67 USBEndpoint::USBEndpoint(const USBAlternateInterface* alternate, size_t endpoint
Index) |
| 68 : m_alternate(alternate) | 68 : m_alternate(alternate) |
| 69 , m_endpointIndex(endpointIndex) | 69 , m_endpointIndex(endpointIndex) |
| 70 { | 70 { |
| 71 ASSERT(m_alternate); | 71 ASSERT(m_alternate); |
| 72 ASSERT(m_endpointIndex < m_alternate->info().endpoints.size()); | 72 ASSERT(m_endpointIndex < m_alternate->info().endpoints.size()); |
| 73 } | 73 } |
| 74 | 74 |
| 75 const device::usb::wtf::EndpointInfo& USBEndpoint::info() const | 75 const device::usb::blink::EndpointInfo& USBEndpoint::info() const |
| 76 { | 76 { |
| 77 const device::usb::wtf::AlternateInterfaceInfo& alternateInfo = m_alternate-
>info(); | 77 const device::usb::blink::AlternateInterfaceInfo& alternateInfo = m_alternat
e->info(); |
| 78 ASSERT(m_endpointIndex < alternateInfo.endpoints.size()); | 78 ASSERT(m_endpointIndex < alternateInfo.endpoints.size()); |
| 79 return *alternateInfo.endpoints[m_endpointIndex]; | 79 return *alternateInfo.endpoints[m_endpointIndex]; |
| 80 } | 80 } |
| 81 | 81 |
| 82 String USBEndpoint::direction() const | 82 String USBEndpoint::direction() const |
| 83 { | 83 { |
| 84 return convertDirectionToEnum(info().direction); | 84 return convertDirectionToEnum(info().direction); |
| 85 } | 85 } |
| 86 | 86 |
| 87 String USBEndpoint::type() const | 87 String USBEndpoint::type() const |
| 88 { | 88 { |
| 89 return convertTypeToEnum(info().type); | 89 return convertTypeToEnum(info().type); |
| 90 } | 90 } |
| 91 | 91 |
| 92 DEFINE_TRACE(USBEndpoint) | 92 DEFINE_TRACE(USBEndpoint) |
| 93 { | 93 { |
| 94 visitor->trace(m_alternate); | 94 visitor->trace(m_alternate); |
| 95 } | 95 } |
| 96 | 96 |
| 97 } // namespace blink | 97 } // namespace blink |
| OLD | NEW |