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

Side by Side Diff: third_party/WebKit/Source/modules/webusb/USBAlternateInterface.cpp

Issue 2821723002: Move classes in the device.usb Mojo namespace to device.mojom (Closed)
Patch Set: mcasas@ nits Created 3 years, 8 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
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 "modules/webusb/USBAlternateInterface.h" 5 #include "modules/webusb/USBAlternateInterface.h"
6 6
7 #include "bindings/core/v8/ExceptionState.h" 7 #include "bindings/core/v8/ExceptionState.h"
8 #include "modules/webusb/USBEndpoint.h" 8 #include "modules/webusb/USBEndpoint.h"
9 #include "modules/webusb/USBInterface.h" 9 #include "modules/webusb/USBInterface.h"
10 10
(...skipping 18 matching lines...) Expand all
29 return nullptr; 29 return nullptr;
30 } 30 }
31 31
32 USBAlternateInterface::USBAlternateInterface(const USBInterface* interface, 32 USBAlternateInterface::USBAlternateInterface(const USBInterface* interface,
33 size_t alternate_index) 33 size_t alternate_index)
34 : interface_(interface), alternate_index_(alternate_index) { 34 : interface_(interface), alternate_index_(alternate_index) {
35 ASSERT(interface_); 35 ASSERT(interface_);
36 ASSERT(alternate_index_ < interface_->Info().alternates.size()); 36 ASSERT(alternate_index_ < interface_->Info().alternates.size());
37 } 37 }
38 38
39 const device::usb::blink::AlternateInterfaceInfo& USBAlternateInterface::Info() 39 const device::mojom::blink::UsbAlternateInterfaceInfo&
40 const { 40 USBAlternateInterface::Info() const {
41 const device::usb::blink::InterfaceInfo& interface_info = interface_->Info(); 41 const device::mojom::blink::UsbInterfaceInfo& interface_info =
42 interface_->Info();
42 ASSERT(alternate_index_ < interface_info.alternates.size()); 43 ASSERT(alternate_index_ < interface_info.alternates.size());
43 return *interface_info.alternates[alternate_index_]; 44 return *interface_info.alternates[alternate_index_];
44 } 45 }
45 46
46 HeapVector<Member<USBEndpoint>> USBAlternateInterface::endpoints() const { 47 HeapVector<Member<USBEndpoint>> USBAlternateInterface::endpoints() const {
47 HeapVector<Member<USBEndpoint>> endpoints; 48 HeapVector<Member<USBEndpoint>> endpoints;
48 for (size_t i = 0; i < Info().endpoints.size(); ++i) 49 for (size_t i = 0; i < Info().endpoints.size(); ++i)
49 endpoints.push_back(USBEndpoint::Create(this, i)); 50 endpoints.push_back(USBEndpoint::Create(this, i));
50 return endpoints; 51 return endpoints;
51 } 52 }
52 53
53 DEFINE_TRACE(USBAlternateInterface) { 54 DEFINE_TRACE(USBAlternateInterface) {
54 visitor->Trace(interface_); 55 visitor->Trace(interface_);
55 } 56 }
56 57
57 } // namespace blink 58 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698