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

Unified Diff: device/usb/device_impl.cc

Issue 1155163008: Build a basic Mojo service framework for device/usb (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DISALLOW Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/usb/device_impl.h ('k') | device/usb/device_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/usb/device_impl.cc
diff --git a/device/usb/device_impl.cc b/device/usb/device_impl.cc
new file mode 100644
index 0000000000000000000000000000000000000000..2011bdcdcc6c9541a3a3a93ab616645115226b92
--- /dev/null
+++ b/device/usb/device_impl.cc
@@ -0,0 +1,34 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "device/usb/device_impl.h"
+#include "device/usb/type_converters.h"
+#include "device/usb/usb_device.h"
+
+namespace device {
+namespace usb {
+
+DeviceImpl::DeviceImpl(scoped_refptr<UsbDevice> device,
+ mojo::InterfaceRequest<Device> request)
+ : binding_(this, request.Pass()),
+ device_(device),
+ info_(DeviceInfo::From(*device)) {
+ // TODO(rockot/reillyg): Support more than just the current configuration.
+ // Also, converting configuration info should be done in the TypeConverter,
+ // but GetConfiguration() is non-const so we do it here for now.
+ const UsbConfigDescriptor* config = device->GetConfiguration();
+ info_->configurations = mojo::Array<ConfigurationInfoPtr>::New(0);
+ if (config)
+ info_->configurations.push_back(ConfigurationInfo::From(*config));
+}
+
+DeviceImpl::~DeviceImpl() {
+}
+
+void DeviceImpl::GetDeviceInfo(const GetDeviceInfoCallback& callback) {
+ callback.Run(info_.Clone());
+}
+
+} // namespace usb
+} // namespace device
« no previous file with comments | « device/usb/device_impl.h ('k') | device/usb/device_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698