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