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

Side by Side Diff: third_party/WebKit/Source/modules/webusb/USBInterface.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
« no previous file with comments | « third_party/WebKit/Source/modules/webusb/USBInterface.h ('k') | no next file » | 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 "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 25 matching lines...) Expand all
36 size_t interface_index) 36 size_t interface_index)
37 : device_(device), 37 : device_(device),
38 configuration_index_(configuration_index), 38 configuration_index_(configuration_index),
39 interface_index_(interface_index) { 39 interface_index_(interface_index) {
40 ASSERT(configuration_index_ < device_->Info().configurations.size()); 40 ASSERT(configuration_index_ < device_->Info().configurations.size());
41 ASSERT( 41 ASSERT(
42 interface_index_ < 42 interface_index_ <
43 device_->Info().configurations[configuration_index_]->interfaces.size()); 43 device_->Info().configurations[configuration_index_]->interfaces.size());
44 } 44 }
45 45
46 const device::usb::blink::InterfaceInfo& USBInterface::Info() const { 46 const device::mojom::blink::UsbInterfaceInfo& USBInterface::Info() const {
47 return *device_->Info() 47 return *device_->Info()
48 .configurations[configuration_index_] 48 .configurations[configuration_index_]
49 ->interfaces[interface_index_]; 49 ->interfaces[interface_index_];
50 } 50 }
51 51
52 USBAlternateInterface* USBInterface::alternate() const { 52 USBAlternateInterface* USBInterface::alternate() const {
53 if (device_->IsInterfaceClaimed(configuration_index_, interface_index_)) 53 if (device_->IsInterfaceClaimed(configuration_index_, interface_index_))
54 return USBAlternateInterface::Create( 54 return USBAlternateInterface::Create(
55 this, device_->SelectedAlternateInterface(interface_index_)); 55 this, device_->SelectedAlternateInterface(interface_index_));
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.push_back(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 device_->IsInterfaceClaimed(configuration_index_, interface_index_); 67 return device_->IsInterfaceClaimed(configuration_index_, interface_index_);
68 } 68 }
69 69
70 DEFINE_TRACE(USBInterface) { 70 DEFINE_TRACE(USBInterface) {
71 visitor->Trace(device_); 71 visitor->Trace(device_);
72 } 72 }
73 73
74 } // namespace blink 74 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/webusb/USBInterface.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698