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

Side by Side Diff: device/devices_app/usb/device_impl.cc

Issue 1265833005: Get all the UsbConfigDescriptor for the device configuration (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use const auto 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
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 "device/devices_app/usb/device_impl.h" 5 #include "device/devices_app/usb/device_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "device/devices_app/usb/type_converters.h" 10 #include "device/devices_app/usb/type_converters.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 if (!device_handle_) { 116 if (!device_handle_) {
117 callback.Run(DeviceInfoPtr()); 117 callback.Run(DeviceInfoPtr());
118 return; 118 return;
119 } 119 }
120 120
121 // TODO(rockot/reillyg): Support more than just the current configuration. 121 // TODO(rockot/reillyg): Support more than just the current configuration.
122 // Also, converting configuration info should be done in the TypeConverter, 122 // Also, converting configuration info should be done in the TypeConverter,
123 // but GetConfiguration() is non-const so we do it here for now. 123 // but GetConfiguration() is non-const so we do it here for now.
124 DeviceInfoPtr info = DeviceInfo::From(*device_handle_->GetDevice()); 124 DeviceInfoPtr info = DeviceInfo::From(*device_handle_->GetDevice());
125 const UsbConfigDescriptor* config = 125 const UsbConfigDescriptor* config =
126 device_handle_->GetDevice()->GetConfiguration(); 126 device_handle_->GetDevice()->GetActiveConfiguration();
127 info->configurations = mojo::Array<ConfigurationInfoPtr>::New(0); 127 info->configurations = mojo::Array<ConfigurationInfoPtr>::New(0);
Reilly Grant (use Gerrit) 2015/08/04 23:47:08 Please update this method to fill info->configurat
juncai 2015/08/05 15:42:17 I will do this in another patch.
128 if (config) 128 if (config)
129 info->configurations.push_back(ConfigurationInfo::From(*config)); 129 info->configurations.push_back(ConfigurationInfo::From(*config));
130 callback.Run(info.Pass()); 130 callback.Run(info.Pass());
131 } 131 }
132 132
133 void DeviceImpl::SetConfiguration(uint8_t value, 133 void DeviceImpl::SetConfiguration(uint8_t value,
134 const SetConfigurationCallback& callback) { 134 const SetConfigurationCallback& callback) {
135 if (!device_handle_) { 135 if (!device_handle_) {
136 callback.Run(false); 136 callback.Run(false);
137 return; 137 return;
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 } 339 }
340 device_handle_->IsochronousTransfer( 340 device_handle_->IsochronousTransfer(
341 USB_DIRECTION_OUTBOUND, endpoint_number, buffer, transfer_size, 341 USB_DIRECTION_OUTBOUND, endpoint_number, buffer, transfer_size,
342 static_cast<uint32_t>(packets.size()), packet_size, timeout, 342 static_cast<uint32_t>(packets.size()), packet_size, timeout,
343 base::Bind(&DeviceImpl::OnIsochronousTransferOut, 343 base::Bind(&DeviceImpl::OnIsochronousTransferOut,
344 weak_factory_.GetWeakPtr(), callback)); 344 weak_factory_.GetWeakPtr(), callback));
345 } 345 }
346 346
347 } // namespace usb 347 } // namespace usb
348 } // namespace device 348 } // namespace device
OLDNEW
« no previous file with comments | « chrome/browser/devtools/device/usb/android_usb_device.cc ('k') | device/devices_app/usb/device_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698