| Index: chrome/browser/usb/usb_device.h
|
| diff --git a/chrome/browser/usb/usb_device.h b/chrome/browser/usb/usb_device.h
|
| index 8891ad0c53735236333935cfd2b9aff9563f6207..d89f679792fb7d22dd54e619db3d745debe5f2af 100644
|
| --- a/chrome/browser/usb/usb_device.h
|
| +++ b/chrome/browser/usb/usb_device.h
|
| @@ -9,6 +9,7 @@
|
| #include <vector>
|
|
|
| #include "base/basictypes.h"
|
| +#include "base/callback.h"
|
| #include "base/memory/ref_counted.h"
|
| #include "base/threading/thread_checker.h"
|
| #include "chrome/browser/usb/usb_interface.h"
|
| @@ -28,6 +29,16 @@ class UsbDevice : public base::RefCountedThreadSafe<UsbDevice> {
|
| PlatformUsbDevice platform_device() const { return platform_device_; }
|
| uint16 vendor_id() const { return vendor_id_; }
|
| uint16 product_id() const { return product_id_; }
|
| + uint32 unique_id() const { return unique_id_; }
|
| +
|
| +#if defined(OS_CHROMEOS)
|
| + // On ChromeOS, if an interface of a claimed device is not claimed, the
|
| + // permission broker can change the owner of the device so that the unclaimed
|
| + // interfaces can be used. If this argument is missing, permission broker will
|
| + // not be used and this method fails if the device is claimed.
|
| + virtual void RequestUsbAcess(
|
| + int interface_id, const base::Callback<void(bool success)>& callback);
|
| +#endif // OS_CHROMEOS
|
|
|
| // Creates a UsbDeviceHandle for further manipulation.
|
| // Blocking method. Must be called on FILE thread.
|
| @@ -52,7 +63,8 @@ class UsbDevice : public base::RefCountedThreadSafe<UsbDevice> {
|
| UsbDevice(scoped_refptr<UsbContext> context,
|
| PlatformUsbDevice platform_device,
|
| uint16 vendor_id,
|
| - uint16 product_id);
|
| + uint16 product_id,
|
| + uint32 unique_id);
|
|
|
| // Constructor called in test only.
|
| UsbDevice();
|
| @@ -61,10 +73,20 @@ class UsbDevice : public base::RefCountedThreadSafe<UsbDevice> {
|
| // Called only be UsbService.
|
| virtual void OnDisconnect();
|
|
|
| +#if defined(OS_CHROMEOS)
|
| + // This method is called when permission broker replied our request.
|
| + // We will simply relay it to FILE thread.
|
| + // |callback| comes first because it will be base::Bind'ed.
|
| + void OnRequestUsbAccessReplied(
|
| + const base::Callback<void(bool success)>& callback,
|
| + bool success);
|
| +#endif // OS_CHROMEOS
|
| +
|
| private:
|
| PlatformUsbDevice platform_device_;
|
| uint16 vendor_id_;
|
| uint16 product_id_;
|
| + uint32 unique_id_;
|
|
|
| // Retain the context so that it will not be released before UsbDevice.
|
| scoped_refptr<UsbContext> context_;
|
|
|