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 DEVICE_USB_USB_DEVICE_H_ | 5 #ifndef DEVICE_USB_USB_DEVICE_H_ |
6 #define DEVICE_USB_USB_DEVICE_H_ | 6 #define DEVICE_USB_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 27 matching lines...) Expand all Loading... |
38 // Creates a UsbDeviceHandle for further manipulation. | 38 // Creates a UsbDeviceHandle for further manipulation. |
39 // Blocking method. Must be called on FILE thread. | 39 // Blocking method. Must be called on FILE thread. |
40 virtual scoped_refptr<UsbDeviceHandle> Open() = 0; | 40 virtual scoped_refptr<UsbDeviceHandle> Open() = 0; |
41 | 41 |
42 // Explicitly closes a device handle. This method will be automatically called | 42 // Explicitly closes a device handle. This method will be automatically called |
43 // by the destructor of a UsbDeviceHandle as well. | 43 // by the destructor of a UsbDeviceHandle as well. |
44 // Closing a closed handle is a safe | 44 // Closing a closed handle is a safe |
45 // Blocking method. Must be called on FILE thread. | 45 // Blocking method. Must be called on FILE thread. |
46 virtual bool Close(scoped_refptr<UsbDeviceHandle> handle) = 0; | 46 virtual bool Close(scoped_refptr<UsbDeviceHandle> handle) = 0; |
47 | 47 |
48 // Gets the UsbConfigDescriptor for the active device configuration. | 48 // Gets the UsbConfigDescriptor for the active device configuration or nullptr |
| 49 // if the device is unconfigured. |
49 // Blocking method. Must be called on FILE thread. | 50 // Blocking method. Must be called on FILE thread. |
50 virtual const UsbConfigDescriptor& GetConfiguration() = 0; | 51 virtual const UsbConfigDescriptor* GetConfiguration() = 0; |
51 | 52 |
52 // Gets the manufacturer string of the device, or false and an empty | 53 // Gets the manufacturer string of the device, or false and an empty |
53 // string. This is a blocking method and must be called on FILE thread. | 54 // string. This is a blocking method and must be called on FILE thread. |
54 // TODO(reillyg): Make this available from the UI thread. crbug.com/427985 | 55 // TODO(reillyg): Make this available from the UI thread. crbug.com/427985 |
55 virtual bool GetManufacturer(base::string16* manufacturer) = 0; | 56 virtual bool GetManufacturer(base::string16* manufacturer) = 0; |
56 | 57 |
57 // Gets the product string of the device, or returns false and an empty | 58 // Gets the product string of the device, or returns false and an empty |
58 // string. This is a blocking method and must be called on FILE thread. | 59 // string. This is a blocking method and must be called on FILE thread. |
59 // TODO(reillyg): Make this available from the UI thread. crbug.com/427985 | 60 // TODO(reillyg): Make this available from the UI thread. crbug.com/427985 |
60 virtual bool GetProduct(base::string16* product) = 0; | 61 virtual bool GetProduct(base::string16* product) = 0; |
(...skipping 14 matching lines...) Expand all Loading... |
75 const uint16 vendor_id_; | 76 const uint16 vendor_id_; |
76 const uint16 product_id_; | 77 const uint16 product_id_; |
77 const uint32 unique_id_; | 78 const uint32 unique_id_; |
78 | 79 |
79 DISALLOW_COPY_AND_ASSIGN(UsbDevice); | 80 DISALLOW_COPY_AND_ASSIGN(UsbDevice); |
80 }; | 81 }; |
81 | 82 |
82 } // namespace device | 83 } // namespace device |
83 | 84 |
84 #endif // DEVICE_USB_USB_DEVICE_H_ | 85 #endif // DEVICE_USB_USB_DEVICE_H_ |
OLD | NEW |