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 #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 |
| 23 namespace usb { |
| 24 |
| 25 class DeviceManagerDelegate; |
| 26 |
| 27 // Implementation of the public DeviceManager interface. Clients in the browser |
| 28 // can connect to this service via DeviceClient::ConnectToUSBDeviceManager. |
| 29 class DeviceManagerImpl : public DeviceManager { |
| 30 public: |
| 31 DeviceManagerImpl(mojo::InterfaceRequest<DeviceManager> request, |
| 32 scoped_ptr<DeviceManagerDelegate> delegate); |
| 33 ~DeviceManagerImpl() override; |
| 34 |
| 35 private: |
| 36 // DeviceManager implementation: |
| 37 void GetDevices(EnumerationOptionsPtr options, |
| 38 const GetDevicesCallback& callback) override; |
| 39 |
| 40 // Callback to handle the async response from the underlying UsbService. |
| 41 void OnGetDevices(const GetDevicesCallback& callback, |
| 42 const std::vector<UsbDeviceFilter>& filters, |
| 43 const std::vector<scoped_refptr<UsbDevice>>& devices); |
| 44 |
| 45 mojo::StrongBinding<DeviceManager> binding_; |
| 46 |
| 47 scoped_ptr<DeviceManagerDelegate> delegate_; |
| 48 |
| 49 base::WeakPtrFactory<DeviceManagerImpl> weak_factory_; |
| 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(DeviceManagerImpl); |
| 52 }; |
| 53 |
| 54 } // namespace usb |
| 55 } // namespace device |
| 56 |
| 57 #endif // DEVICE_USB_DEVICE_MANAGER_IMPL_H_ |
OLD | NEW |