| 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-blink.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::mojom::blink::UsbEndpointType; | 12 using device::mojom::blink::UsbTransferType; |
| 13 using device::mojom::blink::UsbTransferDirection; | 13 using device::mojom::blink::UsbTransferDirection; |
| 14 | 14 |
| 15 namespace blink { | 15 namespace blink { |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 String ConvertDirectionToEnum(const UsbTransferDirection& direction) { | 19 String ConvertDirectionToEnum(const UsbTransferDirection& direction) { |
| 20 switch (direction) { | 20 switch (direction) { |
| 21 case UsbTransferDirection::INBOUND: | 21 case UsbTransferDirection::INBOUND: |
| 22 return "in"; | 22 return "in"; |
| 23 case UsbTransferDirection::OUTBOUND: | 23 case UsbTransferDirection::OUTBOUND: |
| 24 return "out"; | 24 return "out"; |
| 25 default: | 25 default: |
| 26 ASSERT_NOT_REACHED(); | 26 ASSERT_NOT_REACHED(); |
| 27 return ""; | 27 return ""; |
| 28 } | 28 } |
| 29 } | 29 } |
| 30 | 30 |
| 31 String ConvertTypeToEnum(const UsbEndpointType& type) { | 31 String ConvertTypeToEnum(const UsbTransferType& type) { |
| 32 switch (type) { | 32 switch (type) { |
| 33 case UsbEndpointType::BULK: | 33 case UsbTransferType::BULK: |
| 34 return "bulk"; | 34 return "bulk"; |
| 35 case UsbEndpointType::INTERRUPT: | 35 case UsbTransferType::INTERRUPT: |
| 36 return "interrupt"; | 36 return "interrupt"; |
| 37 case UsbEndpointType::ISOCHRONOUS: | 37 case UsbTransferType::ISOCHRONOUS: |
| 38 return "isochronous"; | 38 return "isochronous"; |
| 39 default: | 39 default: |
| 40 ASSERT_NOT_REACHED(); | 40 ASSERT_NOT_REACHED(); |
| 41 return ""; | 41 return ""; |
| 42 } | 42 } |
| 43 } | 43 } |
| 44 | 44 |
| 45 } // namespace | 45 } // namespace |
| 46 | 46 |
| 47 USBEndpoint* USBEndpoint::Create(const USBAlternateInterface* alternate, | 47 USBEndpoint* USBEndpoint::Create(const USBAlternateInterface* alternate, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 88 |
| 89 String USBEndpoint::type() const { | 89 String USBEndpoint::type() const { |
| 90 return ConvertTypeToEnum(Info().type); | 90 return ConvertTypeToEnum(Info().type); |
| 91 } | 91 } |
| 92 | 92 |
| 93 DEFINE_TRACE(USBEndpoint) { | 93 DEFINE_TRACE(USBEndpoint) { |
| 94 visitor->Trace(alternate_); | 94 visitor->Trace(alternate_); |
| 95 } | 95 } |
| 96 | 96 |
| 97 } // namespace blink | 97 } // namespace blink |
| OLD | NEW |