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

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

Issue 1358763004: Implement getConfiguration in WebUSBDeviceImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 size_t buffer_size) { 109 size_t buffer_size) {
110 callback.Run(mojo::ConvertTo<TransferStatus>(status)); 110 callback.Run(mojo::ConvertTo<TransferStatus>(status));
111 } 111 }
112 112
113 void DeviceImpl::GetDeviceInfo(const GetDeviceInfoCallback& callback) { 113 void DeviceImpl::GetDeviceInfo(const GetDeviceInfoCallback& callback) {
114 callback.Run(DeviceInfo::From(*device_)); 114 callback.Run(DeviceInfo::From(*device_));
115 } 115 }
116 116
117 void DeviceImpl::GetConfiguration(const GetConfigurationCallback& callback) { 117 void DeviceImpl::GetConfiguration(const GetConfigurationCallback& callback) {
118 const UsbConfigDescriptor* config = device_->GetActiveConfiguration(); 118 const UsbConfigDescriptor* config = device_->GetActiveConfiguration();
119 callback.Run(config ? ConfigurationInfo::From(*config) : nullptr); 119 callback.Run(config ? config->configuration_value : 0);
120 } 120 }
121 121
122 void DeviceImpl::Open(const OpenCallback& callback) { 122 void DeviceImpl::Open(const OpenCallback& callback) {
123 device_->Open( 123 device_->Open(
124 base::Bind(&DeviceImpl::OnOpen, weak_factory_.GetWeakPtr(), callback)); 124 base::Bind(&DeviceImpl::OnOpen, weak_factory_.GetWeakPtr(), callback));
125 } 125 }
126 126
127 void DeviceImpl::Close(const CloseCallback& callback) { 127 void DeviceImpl::Close(const CloseCallback& callback) {
128 CloseHandle(); 128 CloseHandle();
129 callback.Run(); 129 callback.Run();
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 } 317 }
318 device_handle_->IsochronousTransfer( 318 device_handle_->IsochronousTransfer(
319 USB_DIRECTION_OUTBOUND, endpoint_address, buffer, transfer_size, 319 USB_DIRECTION_OUTBOUND, endpoint_address, buffer, transfer_size,
320 static_cast<uint32_t>(packets.size()), packet_size, timeout, 320 static_cast<uint32_t>(packets.size()), packet_size, timeout,
321 base::Bind(&DeviceImpl::OnIsochronousTransferOut, 321 base::Bind(&DeviceImpl::OnIsochronousTransferOut,
322 weak_factory_.GetWeakPtr(), callback)); 322 weak_factory_.GetWeakPtr(), callback));
323 } 323 }
324 324
325 } // namespace usb 325 } // namespace usb
326 } // namespace device 326 } // namespace device
OLDNEW
« no previous file with comments | « content/renderer/usb/web_usb_device_impl.cc ('k') | device/devices_app/usb/public/interfaces/device.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698