OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_USB_SERVICE_USB_DEVICE_H_ | 5 #ifndef COMPONENTS_USB_SERVICE_USB_DEVICE_H_ |
6 #define COMPONENTS_USB_SERVICE_USB_DEVICE_H_ | 6 #define COMPONENTS_USB_SERVICE_USB_DEVICE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 // Accessors to basic information. | 24 // Accessors to basic information. |
25 uint16 vendor_id() const { return vendor_id_; } | 25 uint16 vendor_id() const { return vendor_id_; } |
26 uint16 product_id() const { return product_id_; } | 26 uint16 product_id() const { return product_id_; } |
27 uint32 unique_id() const { return unique_id_; } | 27 uint32 unique_id() const { return unique_id_; } |
28 | 28 |
29 #if defined(OS_CHROMEOS) | 29 #if defined(OS_CHROMEOS) |
30 // On ChromeOS, if an interface of a claimed device is not claimed, the | 30 // On ChromeOS, if an interface of a claimed device is not claimed, the |
31 // permission broker can change the owner of the device so that the unclaimed | 31 // permission broker can change the owner of the device so that the unclaimed |
32 // interfaces can be used. If this argument is missing, permission broker will | 32 // interfaces can be used. If this argument is missing, permission broker will |
33 // not be used and this method fails if the device is claimed. | 33 // not be used and this method fails if the device is claimed. |
34 virtual void RequestUsbAcess( | 34 virtual void RequestUsbAccess( |
35 int interface_id, | 35 int interface_id, |
36 const base::Callback<void(bool success)>& callback) = 0; | 36 const base::Callback<void(bool success)>& callback) = 0; |
37 #endif // OS_CHROMEOS | 37 #endif // OS_CHROMEOS |
38 | 38 |
39 // Creates a UsbDeviceHandle for further manipulation. | 39 // Creates a UsbDeviceHandle for further manipulation. |
40 // Blocking method. Must be called on FILE thread. | 40 // Blocking method. Must be called on FILE thread. |
41 virtual scoped_refptr<UsbDeviceHandle> Open() = 0; | 41 virtual scoped_refptr<UsbDeviceHandle> Open() = 0; |
42 | 42 |
43 // Explicitly closes a device handle. This method will be automatically called | 43 // Explicitly closes a device handle. This method will be automatically called |
44 // by the destructor of a UsbDeviceHandle as well. | 44 // by the destructor of a UsbDeviceHandle as well. |
(...skipping 18 matching lines...) Expand all Loading... |
63 const uint16 vendor_id_; | 63 const uint16 vendor_id_; |
64 const uint16 product_id_; | 64 const uint16 product_id_; |
65 const uint32 unique_id_; | 65 const uint32 unique_id_; |
66 | 66 |
67 DISALLOW_COPY_AND_ASSIGN(UsbDevice); | 67 DISALLOW_COPY_AND_ASSIGN(UsbDevice); |
68 }; | 68 }; |
69 | 69 |
70 } // namespace usb_service | 70 } // namespace usb_service |
71 | 71 |
72 #endif // COMPONENTS_USB_SERVICE_USB_DEVICE_H_ | 72 #endif // COMPONENTS_USB_SERVICE_USB_DEVICE_H_ |
OLD | NEW |