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

Unified Diff: device/usb/device_manager_impl.h

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_unittest.cc ('k') | device/usb/device_manager_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/usb/device_manager_impl.h
diff --git a/device/usb/device_manager_impl.h b/device/usb/device_manager_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..f9a8119ec6db970ffe16754c6e4e7ec092dccd53
--- /dev/null
+++ b/device/usb/device_manager_impl.h
@@ -0,0 +1,57 @@
+// 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.
+
+#ifndef DEVICE_USB_DEVICE_MANAGER_IMPL_H_
+#define DEVICE_USB_DEVICE_MANAGER_IMPL_H_
+
+#include <vector>
+
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
+#include "device/usb/public/interfaces/device_manager.mojom.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h"
+
+namespace device {
+
+class UsbDevice;
+class UsbDeviceFilter;
+
+namespace usb {
+
+class DeviceManagerDelegate;
+
+// Implementation of the public DeviceManager interface. Clients in the browser
+// can connect to this service via DeviceClient::ConnectToUSBDeviceManager.
+class DeviceManagerImpl : public DeviceManager {
+ public:
+ DeviceManagerImpl(mojo::InterfaceRequest<DeviceManager> request,
+ scoped_ptr<DeviceManagerDelegate> delegate);
+ ~DeviceManagerImpl() override;
+
+ private:
+ // DeviceManager implementation:
+ void GetDevices(EnumerationOptionsPtr options,
+ const GetDevicesCallback& callback) override;
+
+ // Callback to handle the async response from the underlying UsbService.
+ void OnGetDevices(const GetDevicesCallback& callback,
+ const std::vector<UsbDeviceFilter>& filters,
+ const std::vector<scoped_refptr<UsbDevice>>& devices);
+
+ mojo::StrongBinding<DeviceManager> binding_;
+
+ scoped_ptr<DeviceManagerDelegate> delegate_;
+
+ base::WeakPtrFactory<DeviceManagerImpl> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(DeviceManagerImpl);
+};
+
+} // namespace usb
+} // namespace device
+
+#endif // DEVICE_USB_DEVICE_MANAGER_IMPL_H_
« no previous file with comments | « device/usb/device_impl_unittest.cc ('k') | device/usb/device_manager_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698