| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "device/usb/device_impl.h" | |
| 6 #include "device/usb/type_converters.h" | |
| 7 #include "device/usb/usb_device.h" | |
| 8 | |
| 9 namespace device { | |
| 10 namespace usb { | |
| 11 | |
| 12 DeviceImpl::DeviceImpl(scoped_refptr<UsbDevice> device, | |
| 13 mojo::InterfaceRequest<Device> request) | |
| 14 : binding_(this, request.Pass()), | |
| 15 device_(device), | |
| 16 info_(DeviceInfo::From(*device)) { | |
| 17 // TODO(rockot/reillyg): Support more than just the current configuration. | |
| 18 // Also, converting configuration info should be done in the TypeConverter, | |
| 19 // but GetConfiguration() is non-const so we do it here for now. | |
| 20 const UsbConfigDescriptor* config = device->GetConfiguration(); | |
| 21 info_->configurations = mojo::Array<ConfigurationInfoPtr>::New(0); | |
| 22 if (config) | |
| 23 info_->configurations.push_back(ConfigurationInfo::From(*config)); | |
| 24 } | |
| 25 | |
| 26 DeviceImpl::~DeviceImpl() { | |
| 27 } | |
| 28 | |
| 29 void DeviceImpl::GetDeviceInfo(const GetDeviceInfoCallback& callback) { | |
| 30 callback.Run(info_.Clone()); | |
| 31 } | |
| 32 | |
| 33 } // namespace usb | |
| 34 } // namespace device | |
| OLD | NEW |