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

Side by Side 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: Created 5 years, 6 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
(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 #ifndef DEVICE_USB_DEVICE_MANAGER_IMPL_H_
6 #define DEVICE_USB_DEVICE_MANAGER_IMPL_H_
7
8 #include <vector>
9
10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h"
14 #include "device/usb/public/interfaces/device_manager.mojom.h"
15 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h"
16 #include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h"
17
18 namespace device {
19
20 class UsbDevice;
21 class UsbDeviceFilter;
22 class UsbService;
23
24 namespace usb {
25
26 class DeviceManagerDelegate;
27
28 // Implementation of the public DeviceManager interface. Clients in the browser
29 // can connect to this service via DeviceClient::ConnectToUSBDeviceManager.
30 class DeviceManagerImpl : public DeviceManager {
31 public:
32 DeviceManagerImpl(mojo::InterfaceRequest<DeviceManager> request,
33 scoped_ptr<DeviceManagerDelegate> delegate);
34 ~DeviceManagerImpl() override;
35
36 private:
37 // DeviceManager implementation:
38 void GetDevices(EnumerationOptionsPtr options,
39 const GetDevicesCallback& callback) override;
40
41 // Callback to handle the async response from the underlying UsbService.
42 void OnGetDevices(const GetDevicesCallback& callback,
43 const std::vector<UsbDeviceFilter>& filters,
44 const std::vector<scoped_refptr<UsbDevice>>& devices);
45
46 mojo::StrongBinding<DeviceManager> binding_;
47
48 scoped_ptr<DeviceManagerDelegate> delegate_;
49 UsbService* usb_service_;
50
51 base::WeakPtrFactory<DeviceManagerImpl> weak_factory_;
52
53 DISALLOW_COPY_AND_ASSIGN(DeviceManagerImpl);
54 };
55
56 } // namespace usb
57 } // namespace device
58
59 #endif // DEVICE_USB_DEVICE_MANAGER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698