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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | |
11 #include <vector> | 10 #include <vector> |
12 | 11 |
13 #include "base/callback.h" | 12 #include "base/callback.h" |
14 #include "base/macros.h" | 13 #include "base/macros.h" |
15 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
16 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
17 #include "device/usb/usb_descriptors.h" | 16 #include "device/usb/usb_descriptors.h" |
18 #include "url/gurl.h" | 17 #include "url/gurl.h" |
19 | 18 |
20 namespace device { | 19 namespace device { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 } | 52 } |
54 | 53 |
55 // On ChromeOS the permission_broker service is used to change the ownership | 54 // On ChromeOS the permission_broker service is used to change the ownership |
56 // of USB device nodes so that Chrome can open them. On other platforms these | 55 // of USB device nodes so that Chrome can open them. On other platforms these |
57 // functions are no-ops and always return true. | 56 // functions are no-ops and always return true. |
58 virtual void CheckUsbAccess(const ResultCallback& callback); | 57 virtual void CheckUsbAccess(const ResultCallback& callback); |
59 | 58 |
60 // Creates a UsbDeviceHandle for further manipulation. | 59 // Creates a UsbDeviceHandle for further manipulation. |
61 virtual void Open(const OpenCallback& callback) = 0; | 60 virtual void Open(const OpenCallback& callback) = 0; |
62 | 61 |
| 62 // Explicitly closes a device handle. This method will be automatically called |
| 63 // by the destructor of a UsbDeviceHandle as well. |
| 64 virtual bool Close(scoped_refptr<UsbDeviceHandle> handle) = 0; |
| 65 |
63 // Gets the UsbConfigDescriptor for the active device configuration or nullptr | 66 // Gets the UsbConfigDescriptor for the active device configuration or nullptr |
64 // if the device is unconfigured. | 67 // if the device is unconfigured. |
65 virtual const UsbConfigDescriptor* GetActiveConfiguration() = 0; | 68 virtual const UsbConfigDescriptor* GetActiveConfiguration() = 0; |
66 | 69 |
67 protected: | 70 protected: |
68 UsbDevice(uint16_t vendor_id, | 71 UsbDevice(uint16_t vendor_id, |
69 uint16_t product_id, | 72 uint16_t product_id, |
70 const base::string16& manufacturer_string, | 73 const base::string16& manufacturer_string, |
71 const base::string16& product_string, | 74 const base::string16& product_string, |
72 const base::string16& serial_number); | 75 const base::string16& serial_number); |
(...skipping 17 matching lines...) Expand all Loading... |
90 const std::string guid_; | 93 const std::string guid_; |
91 const uint16_t vendor_id_; | 94 const uint16_t vendor_id_; |
92 const uint16_t product_id_; | 95 const uint16_t product_id_; |
93 | 96 |
94 DISALLOW_COPY_AND_ASSIGN(UsbDevice); | 97 DISALLOW_COPY_AND_ASSIGN(UsbDevice); |
95 }; | 98 }; |
96 | 99 |
97 } // namespace device | 100 } // namespace device |
98 | 101 |
99 #endif // DEVICE_USB_USB_DEVICE_H_ | 102 #endif // DEVICE_USB_USB_DEVICE_H_ |
OLD | NEW |