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-wtf.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" |
11 #include "modules/webusb/USBDevice.h" | 11 #include "modules/webusb/USBDevice.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 USBInterface* USBInterface::create(const USBConfiguration* configuration, size_t
interfaceIndex) | 15 USBInterface* USBInterface::create(const USBConfiguration* configuration, size_t
interfaceIndex) |
16 { | 16 { |
17 return new USBInterface(configuration->device(), configuration->index(), int
erfaceIndex); | 17 return new USBInterface(configuration->device(), configuration->index(), int
erfaceIndex); |
18 } | 18 } |
(...skipping 11 matching lines...) Expand all Loading... |
30 | 30 |
31 USBInterface::USBInterface(const USBDevice* device, size_t configurationIndex, s
ize_t interfaceIndex) | 31 USBInterface::USBInterface(const USBDevice* device, size_t configurationIndex, s
ize_t interfaceIndex) |
32 : m_device(device) | 32 : m_device(device) |
33 , m_configurationIndex(configurationIndex) | 33 , m_configurationIndex(configurationIndex) |
34 , m_interfaceIndex(interfaceIndex) | 34 , m_interfaceIndex(interfaceIndex) |
35 { | 35 { |
36 ASSERT(m_configurationIndex < m_device->info().configurations.size()); | 36 ASSERT(m_configurationIndex < m_device->info().configurations.size()); |
37 ASSERT(m_interfaceIndex < m_device->info().configurations[m_configurationInd
ex]->interfaces.size()); | 37 ASSERT(m_interfaceIndex < m_device->info().configurations[m_configurationInd
ex]->interfaces.size()); |
38 } | 38 } |
39 | 39 |
40 const device::usb::wtf::InterfaceInfo& USBInterface::info() const | 40 const device::usb::blink::InterfaceInfo& USBInterface::info() const |
41 { | 41 { |
42 return *m_device->info().configurations[m_configurationIndex]->interfaces[m_
interfaceIndex]; | 42 return *m_device->info().configurations[m_configurationIndex]->interfaces[m_
interfaceIndex]; |
43 } | 43 } |
44 | 44 |
45 USBAlternateInterface* USBInterface::alternate() const | 45 USBAlternateInterface* USBInterface::alternate() const |
46 { | 46 { |
47 if (m_device->isInterfaceClaimed(m_configurationIndex, m_interfaceIndex)) | 47 if (m_device->isInterfaceClaimed(m_configurationIndex, m_interfaceIndex)) |
48 return USBAlternateInterface::create(this, m_device->selectedAlternateIn
terface(m_interfaceIndex)); | 48 return USBAlternateInterface::create(this, m_device->selectedAlternateIn
terface(m_interfaceIndex)); |
49 return nullptr; | 49 return nullptr; |
50 } | 50 } |
(...skipping 10 matching lines...) Expand all Loading... |
61 { | 61 { |
62 return m_device->isInterfaceClaimed(m_configurationIndex, m_interfaceIndex); | 62 return m_device->isInterfaceClaimed(m_configurationIndex, m_interfaceIndex); |
63 } | 63 } |
64 | 64 |
65 DEFINE_TRACE(USBInterface) | 65 DEFINE_TRACE(USBInterface) |
66 { | 66 { |
67 visitor->trace(m_device); | 67 visitor->trace(m_device); |
68 } | 68 } |
69 | 69 |
70 } // namespace blink | 70 } // namespace blink |
OLD | NEW |