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

Side by Side Diff: Source/modules/webusb/USBInterface.cpp

Issue 1270983002: WebUSB bindings part 4 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: punctuation Created 5 years, 4 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 | « Source/modules/webusb/USBInterface.h ('k') | Source/modules/webusb/USBInterface.idl » ('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 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 "config.h" 5 #include "config.h"
6 #include "modules/webusb/USBInterface.h" 6 #include "modules/webusb/USBInterface.h"
7 7
8 #include "bindings/core/v8/ExceptionState.h" 8 #include "bindings/core/v8/ExceptionState.h"
9 #include "modules/webusb/USBAlternateInterface.h"
9 #include "modules/webusb/USBConfiguration.h" 10 #include "modules/webusb/USBConfiguration.h"
10 11
11 namespace blink { 12 namespace blink {
12 13
13 USBInterface* USBInterface::create(const USBConfiguration* configuration, size_t interfaceIndex) 14 USBInterface* USBInterface::create(const USBConfiguration* configuration, size_t interfaceIndex)
14 { 15 {
15 return new USBInterface(configuration, interfaceIndex); 16 return new USBInterface(configuration, interfaceIndex);
16 } 17 }
17 18
18 USBInterface* USBInterface::create(const USBConfiguration* configuration, size_t interfaceNumber, ExceptionState& exceptionState) 19 USBInterface* USBInterface::create(const USBConfiguration* configuration, size_t interfaceNumber, ExceptionState& exceptionState)
(...skipping 12 matching lines...) Expand all
31 { 32 {
32 ASSERT(m_configuration); 33 ASSERT(m_configuration);
33 ASSERT(m_interfaceIndex < m_configuration->info().interfaces.size()); 34 ASSERT(m_interfaceIndex < m_configuration->info().interfaces.size());
34 } 35 }
35 36
36 const WebUSBDeviceInfo::Interface& USBInterface::info() const 37 const WebUSBDeviceInfo::Interface& USBInterface::info() const
37 { 38 {
38 return m_configuration->info().interfaces[m_interfaceIndex]; 39 return m_configuration->info().interfaces[m_interfaceIndex];
39 } 40 }
40 41
42 HeapVector<Member<USBAlternateInterface>> USBInterface::alternates() const
43 {
44 HeapVector<Member<USBAlternateInterface>> alternates;
45 for (size_t i = 0; i < info().alternates.size(); ++i)
46 alternates.append(USBAlternateInterface::create(this, i));
47 return alternates;
48 }
49
41 uint8_t USBInterface::interfaceNumber() const 50 uint8_t USBInterface::interfaceNumber() const
42 { 51 {
43 return info().interfaceNumber; 52 return info().interfaceNumber;
44 } 53 }
45 54
46 DEFINE_TRACE(USBInterface) 55 DEFINE_TRACE(USBInterface)
47 { 56 {
48 visitor->trace(m_configuration); 57 visitor->trace(m_configuration);
49 } 58 }
50 59
51 } // namespace blink 60 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/webusb/USBInterface.h ('k') | Source/modules/webusb/USBInterface.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698