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/USBInterface.h" | 5 #include "modules/webusb/USBInterface.h" |
6 | 6 |
7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
8 #include "device/usb/public/interfaces/device.mojom-blink.h" | 8 #include "device/usb/public/interfaces/device.mojom-blink.h" |
9 #include "modules/webusb/USBAlternateInterface.h" | 9 #include "modules/webusb/USBAlternateInterface.h" |
10 #include "modules/webusb/USBConfiguration.h" | 10 #include "modules/webusb/USBConfiguration.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 USBAlternateInterface* USBInterface::alternate() const { | 52 USBAlternateInterface* USBInterface::alternate() const { |
53 if (m_device->isInterfaceClaimed(m_configurationIndex, m_interfaceIndex)) | 53 if (m_device->isInterfaceClaimed(m_configurationIndex, m_interfaceIndex)) |
54 return USBAlternateInterface::create( | 54 return USBAlternateInterface::create( |
55 this, m_device->selectedAlternateInterface(m_interfaceIndex)); | 55 this, m_device->selectedAlternateInterface(m_interfaceIndex)); |
56 return nullptr; | 56 return nullptr; |
57 } | 57 } |
58 | 58 |
59 HeapVector<Member<USBAlternateInterface>> USBInterface::alternates() const { | 59 HeapVector<Member<USBAlternateInterface>> USBInterface::alternates() const { |
60 HeapVector<Member<USBAlternateInterface>> alternates; | 60 HeapVector<Member<USBAlternateInterface>> alternates; |
61 for (size_t i = 0; i < info().alternates.size(); ++i) | 61 for (size_t i = 0; i < info().alternates.size(); ++i) |
62 alternates.append(USBAlternateInterface::create(this, i)); | 62 alternates.push_back(USBAlternateInterface::create(this, i)); |
63 return alternates; | 63 return alternates; |
64 } | 64 } |
65 | 65 |
66 bool USBInterface::claimed() const { | 66 bool USBInterface::claimed() const { |
67 return m_device->isInterfaceClaimed(m_configurationIndex, m_interfaceIndex); | 67 return m_device->isInterfaceClaimed(m_configurationIndex, m_interfaceIndex); |
68 } | 68 } |
69 | 69 |
70 DEFINE_TRACE(USBInterface) { | 70 DEFINE_TRACE(USBInterface) { |
71 visitor->trace(m_device); | 71 visitor->trace(m_device); |
72 } | 72 } |
73 | 73 |
74 } // namespace blink | 74 } // namespace blink |
OLD | NEW |