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

Unified Diff: device/devices_app/usb/device_impl.h

Issue 1352683006: Move device opening from DeviceManager to Device. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/usb/web_usb_device_impl.cc ('k') | device/devices_app/usb/device_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/devices_app/usb/device_impl.h
diff --git a/device/devices_app/usb/device_impl.h b/device/devices_app/usb/device_impl.h
index c8278355271ee7b35d0b9bf15a2212a6d553953a..9a7bac4ad44297a51d81f67205da161ab2580771 100644
--- a/device/devices_app/usb/device_impl.h
+++ b/device/devices_app/usb/device_impl.h
@@ -27,7 +27,7 @@ namespace usb {
// lifetime.
class DeviceImpl : public Device {
public:
- DeviceImpl(scoped_refptr<UsbDeviceHandle> device_handle,
+ DeviceImpl(scoped_refptr<UsbDevice> device,
mojo::InterfaceRequest<Device> request);
~DeviceImpl() override;
@@ -37,13 +37,13 @@ class DeviceImpl : public Device {
using MojoTransferOutCallback = mojo::Callback<void(TransferStatus)>;
- // Closes the device if it's open. This will always set |handle_| to null.
+ // Closes the device if it's open. This will always set |device_handle_| to
+ // null.
void CloseHandle();
- // Handles a UsbDeviceHandle::ClaimInterface response.
- void OnClaimInterface(uint8_t interface_number,
- const ClaimInterfaceCallback& callback,
- bool result);
+ // Handles completion of an open request.
+ void OnOpen(const OpenCallback& callback,
+ scoped_refptr<device::UsbDeviceHandle> handle);
// Handles completion of an inbound transfer on the UsbDeviceHandle.
void OnTransferIn(const MojoTransferInCallback& callback,
@@ -73,8 +73,10 @@ class DeviceImpl : public Device {
size_t size);
// Device implementation:
- void Close(const CloseCallback& callback) override;
void GetDeviceInfo(const GetDeviceInfoCallback& callback) override;
+ void GetConfiguration(const GetConfigurationCallback& callback) override;
+ void Open(const OpenCallback& callback) override;
+ void Close(const CloseCallback& callback) override;
void SetConfiguration(uint8_t value,
const SetConfigurationCallback& callback) override;
void ClaimInterface(uint8_t interface_number,
@@ -117,7 +119,9 @@ class DeviceImpl : public Device {
mojo::StrongBinding<Device> binding_;
- // The opened device handle. May be null if the device has been closed.
+ scoped_refptr<UsbDevice> device_;
+ // The device handle. Will be null before the device is opened and after it
+ // has been closed.
scoped_refptr<UsbDeviceHandle> device_handle_;
base::WeakPtrFactory<DeviceImpl> weak_factory_;
« no previous file with comments | « content/renderer/usb/web_usb_device_impl.cc ('k') | device/devices_app/usb/device_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698