Update V8 to version 4.6.55.
[chromium-blink-merge.git] / device / devices_app / usb / device_manager_impl.h
blob57f64a7a3719bfc6e1c40c66d1ba837f0f7d6076
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.
5 #ifndef DEVICE_USB_DEVICE_MANAGER_IMPL_H_
6 #define DEVICE_USB_DEVICE_MANAGER_IMPL_H_
8 #include <vector>
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/devices_app/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"
18 namespace base {
19 class SequencedTaskRunner;
22 namespace device {
24 class UsbDevice;
25 class UsbDeviceFilter;
26 class UsbDeviceHandle;
28 namespace usb {
30 class DeviceManagerDelegate;
32 // Implementation of the public DeviceManager interface. This interface can be
33 // requested from the devices app located at "system:devices", if available.
34 class DeviceManagerImpl : public DeviceManager {
35 public:
36 DeviceManagerImpl(
37 mojo::InterfaceRequest<DeviceManager> request,
38 scoped_ptr<DeviceManagerDelegate> delegate,
39 scoped_refptr<base::SequencedTaskRunner> service_task_runner);
40 ~DeviceManagerImpl() override;
42 void set_connection_error_handler(const mojo::Closure& error_handler);
44 private:
45 // DeviceManager implementation:
46 void GetDevices(EnumerationOptionsPtr options,
47 const GetDevicesCallback& callback) override;
48 void OpenDevice(const mojo::String& guid,
49 mojo::InterfaceRequest<Device> device_request,
50 const OpenDeviceCallback& callback) override;
52 // Callback to handle the async response from the underlying UsbService.
53 void OnGetDevices(EnumerationOptionsPtr options,
54 const GetDevicesCallback& callback,
55 const std::vector<scoped_refptr<UsbDevice>>& devices);
57 mojo::StrongBinding<DeviceManager> binding_;
59 scoped_ptr<DeviceManagerDelegate> delegate_;
60 scoped_refptr<base::SequencedTaskRunner> service_task_runner_;
62 base::WeakPtrFactory<DeviceManagerImpl> weak_factory_;
64 DISALLOW_COPY_AND_ASSIGN(DeviceManagerImpl);
67 } // namespace usb
68 } // namespace device
70 #endif // DEVICE_USB_DEVICE_MANAGER_IMPL_H_