diff options
| author | reillyg <reillyg@chromium.org> | 2016-02-10 15:29:20 -0800 |
|---|---|---|
| committer | Commit bot <commit-bot@chromium.org> | 2016-02-10 23:31:02 +0000 |
| commit | 64c8f4f25d9fbd2233e476d6276b4c63bcc4813c (patch) | |
| tree | 6b493ace49c49e995601c33d9ef14a94ccfe2f85 /device/devices_app/usb/device_manager_impl.h | |
| parent | d1a4b660eb29113ef2a08f8544ebf1f2b212e6ec (diff) | |
| download | chromium_src-64c8f4f25d9fbd2233e476d6276b4c63bcc4813c.zip chromium_src-64c8f4f25d9fbd2233e476d6276b4c63bcc4813c.tar.gz chromium_src-64c8f4f25d9fbd2233e476d6276b4c63bcc4813c.tar.bz2 | |
Remove //device/devices_app.
This change removes the code to create a Mojo app containing device
services (currently only USB) and instead makes the Mojo bindings for
//device/usb part of that directory.
The Mojo service implementation is still in a separate //device/usb/mojo
target but this will eventually merge into its parent directory as the
Mojo interface becomes the only public interface for //device/usb.
BUG=None
Review URL: https://codereview.chromium.org/1682363002
Cr-Commit-Position: refs/heads/master@{#374778}
Diffstat (limited to 'device/devices_app/usb/device_manager_impl.h')
| -rw-r--r-- | device/devices_app/usb/device_manager_impl.h | 111 |
1 files changed, 0 insertions, 111 deletions
diff --git a/device/devices_app/usb/device_manager_impl.h b/device/devices_app/usb/device_manager_impl.h deleted file mode 100644 index 4e9578d..0000000 --- a/device/devices_app/usb/device_manager_impl.h +++ /dev/null @@ -1,111 +0,0 @@ -// 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 <queue> -#include <set> - -#include "base/macros.h" -#include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" -#include "base/memory/weak_ptr.h" -#include "base/scoped_observer.h" -#include "device/devices_app/usb/public/interfaces/device_manager.mojom.h" -#include "device/devices_app/usb/public/interfaces/permission_provider.mojom.h" -#include "device/usb/usb_service.h" -#include "mojo/public/cpp/bindings/array.h" -#include "mojo/public/cpp/bindings/binding.h" -#include "mojo/public/cpp/bindings/interface_request.h" - -namespace base { -class SequencedTaskRunner; -} - -namespace device { - -class UsbDevice; -class UsbDeviceFilter; -class UsbDeviceHandle; - -namespace usb { - -class DeviceManagerDelegate; - -// Implementation of the public DeviceManager interface. This interface can be -// requested from the devices app located at "mojo:devices", if available. -class DeviceManagerImpl : public DeviceManager, - public device::UsbService::Observer { - public: - using DeviceList = std::vector<scoped_refptr<UsbDevice>>; - using DeviceMap = std::map<std::string, scoped_refptr<device::UsbDevice>>; - - static void Create(PermissionProviderPtr permission_provider, - mojo::InterfaceRequest<DeviceManager> request); - - DeviceManagerImpl(PermissionProviderPtr permission_provider, - mojo::InterfaceRequest<DeviceManager> request); - ~DeviceManagerImpl() override; - - void set_connection_error_handler(const mojo::Closure& error_handler) { - connection_error_handler_ = error_handler; - } - - private: - // DeviceManager implementation: - void GetDevices(EnumerationOptionsPtr options, - const GetDevicesCallback& callback) override; - void GetDeviceChanges(const GetDeviceChangesCallback& callback) override; - void GetDevice(const mojo::String& guid, - mojo::InterfaceRequest<Device> device_request) override; - - // Callbacks to handle the async responses from the underlying UsbService. - void OnGetDevicePermissionCheckComplete( - scoped_refptr<device::UsbDevice> device, - mojo::InterfaceRequest<Device> device_request, - mojo::Array<mojo::String> allowed_guids); - void OnGetDevices(EnumerationOptionsPtr options, - const GetDevicesCallback& callback, - const DeviceList& devices); - - // UsbService::Observer implementation: - void OnDeviceAdded(scoped_refptr<device::UsbDevice> device) override; - void OnDeviceRemoved(scoped_refptr<device::UsbDevice> device) override; - void WillDestroyUsbService() override; - - void MaybeRunDeviceChangesCallback(); - void OnEnumerationPermissionCheckComplete( - const DeviceMap& devices_added, - const DeviceMap& devices_removed, - mojo::Array<mojo::String> allowed_guids); - - PermissionProviderPtr permission_provider_; - - // If there are unfinished calls to GetDeviceChanges their callbacks - // are stored in |device_change_callbacks_|. Otherwise device changes - // are collected in |devices_added_| and |devices_removed_| until the - // next call to GetDeviceChanges. - std::queue<GetDeviceChangesCallback> device_change_callbacks_; - DeviceMap devices_added_; - DeviceMap devices_removed_; - // To ensure that GetDeviceChangesCallbacks are called in the correct order - // only perform a single request to |permission_provider_| at a time. - bool permission_request_pending_ = false; - - UsbService* usb_service_; - ScopedObserver<device::UsbService, device::UsbService::Observer> observer_; - - mojo::Closure connection_error_handler_; - - mojo::Binding<DeviceManager> binding_; - base::WeakPtrFactory<DeviceManagerImpl> weak_factory_; - - DISALLOW_COPY_AND_ASSIGN(DeviceManagerImpl); -}; - -} // namespace usb -} // namespace device - -#endif // DEVICE_USB_DEVICE_MANAGER_IMPL_H_ |
