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