summaryrefslogtreecommitdiffstats
path: root/device/usb/mojo/device_impl.h
diff options
context:
space:
mode:
Diffstat (limited to 'device/usb/mojo/device_impl.h')
-rw-r--r--device/usb/mojo/device_impl.h19
1 files changed, 11 insertions, 8 deletions
diff --git a/device/usb/mojo/device_impl.h b/device/usb/mojo/device_impl.h
index 487a7d4..6c77d38 100644
--- a/device/usb/mojo/device_impl.h
+++ b/device/usb/mojo/device_impl.h
@@ -12,8 +12,8 @@
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/scoped_observer.h"
+#include "device/usb/mojo/permission_provider.h"
#include "device/usb/public/interfaces/device.mojom.h"
-#include "device/usb/public/interfaces/permission_provider.mojom.h"
#include "device/usb/usb_device.h"
#include "device/usb/usb_device_handle.h"
#include "mojo/public/cpp/bindings/binding.h"
@@ -27,13 +27,16 @@ class IOBuffer;
namespace device {
namespace usb {
+class PermissionProvider;
+
// Implementation of the public Device interface. Instances of this class are
// constructed by DeviceManagerImpl and are strongly bound to their MessagePipe
// lifetime.
class DeviceImpl : public Device, public device::UsbDevice::Observer {
public:
DeviceImpl(scoped_refptr<UsbDevice> device,
- PermissionProviderPtr permission_provider,
+ DeviceInfoPtr device_info,
+ base::WeakPtr<PermissionProvider> permission_provider,
mojo::InterfaceRequest<Device> request);
~DeviceImpl() override;
@@ -43,9 +46,8 @@ class DeviceImpl : public Device, public device::UsbDevice::Observer {
void CloseHandle();
// Checks interface permissions for control transfers.
- void HasControlTransferPermission(ControlTransferRecipient recipient,
- uint16_t index,
- const base::Callback<void(bool)>& callback);
+ bool HasControlTransferPermission(ControlTransferRecipient recipient,
+ uint16_t index);
// Handles completion of an open request.
void OnOpen(const OpenCallback& callback,
@@ -97,15 +99,16 @@ class DeviceImpl : public Device, public device::UsbDevice::Observer {
const IsochronousTransferOutCallback& callback) override;
// device::UsbDevice::Observer implementation:
- void OnDeviceRemoved(scoped_refptr<device::UsbDevice>) override;
+ void OnDeviceRemoved(scoped_refptr<device::UsbDevice> device) override;
- scoped_refptr<UsbDevice> device_;
+ const scoped_refptr<UsbDevice> device_;
+ const DeviceInfoPtr device_info_;
+ base::WeakPtr<PermissionProvider> permission_provider_;
ScopedObserver<device::UsbDevice, device::UsbDevice::Observer> observer_;
// The device handle. Will be null before the device is opened and after it
// has been closed.
scoped_refptr<UsbDeviceHandle> device_handle_;
- PermissionProviderPtr permission_provider_;
mojo::Binding<Device> binding_;
base::WeakPtrFactory<DeviceImpl> weak_factory_;