| 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_IMPL_H_ | 5 #ifndef DEVICE_USB_USB_DEVICE_IMPL_H_ |
| 6 #define DEVICE_USB_USB_DEVICE_IMPL_H_ | 6 #define DEVICE_USB_USB_DEVICE_IMPL_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 // Called by UsbServiceImpl only; | 49 // Called by UsbServiceImpl only; |
| 50 UsbDeviceImpl(scoped_refptr<UsbContext> context, | 50 UsbDeviceImpl(scoped_refptr<UsbContext> context, |
| 51 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | 51 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
| 52 PlatformUsbDevice platform_device, | 52 PlatformUsbDevice platform_device, |
| 53 uint16 vendor_id, | 53 uint16 vendor_id, |
| 54 uint16 product_id, | 54 uint16 product_id, |
| 55 uint32 unique_id); | 55 uint32 unique_id); |
| 56 | 56 |
| 57 virtual ~UsbDeviceImpl(); | 57 virtual ~UsbDeviceImpl(); |
| 58 | 58 |
| 59 // Called only be UsbService. | 59 // Called only by UsbService. |
| 60 void OnDisconnect(); | 60 void OnDisconnect(); |
| 61 | 61 |
| 62 private: | 62 private: |
| 63 base::ThreadChecker thread_checker_; | 63 base::ThreadChecker thread_checker_; |
| 64 PlatformUsbDevice platform_device_; | 64 PlatformUsbDevice platform_device_; |
| 65 | 65 |
| 66 #if defined(USE_UDEV) | |
| 67 // On Linux these properties are read from sysfs when the device is enumerated | 66 // On Linux these properties are read from sysfs when the device is enumerated |
| 68 // to avoid hitting the permission broker on Chrome OS for a real string | 67 // to avoid hitting the permission broker on Chrome OS for a real string |
| 69 // descriptor request. | 68 // descriptor request. |
| 70 std::string manufacturer_; | 69 base::string16 manufacturer_; |
| 71 std::string product_; | 70 base::string16 product_; |
| 72 std::string serial_number_; | 71 base::string16 serial_number_; |
| 72 #if !defined(USE_UDEV) |
| 73 // On other platforms the device must be opened in order to cache them. This |
| 74 // should be delayed until the strings are needed to avoid poor interactions |
| 75 // with other applications. |
| 76 void CacheStrings(); |
| 77 bool strings_cached_; |
| 73 #endif | 78 #endif |
| 74 | 79 |
| 75 // The active configuration descriptor is not read immediately but cached for | 80 // The active configuration descriptor is not read immediately but cached for |
| 76 // later use. | 81 // later use. |
| 77 bool current_configuration_cached_; | 82 bool current_configuration_cached_; |
| 78 UsbConfigDescriptor current_configuration_; | 83 UsbConfigDescriptor current_configuration_; |
| 79 | 84 |
| 80 // Retain the context so that it will not be released before UsbDevice. | 85 // Retain the context so that it will not be released before UsbDevice. |
| 81 scoped_refptr<UsbContext> context_; | 86 scoped_refptr<UsbContext> context_; |
| 82 | 87 |
| 83 // Opened handles. | 88 // Opened handles. |
| 84 typedef std::vector<scoped_refptr<UsbDeviceHandleImpl> > HandlesVector; | 89 typedef std::vector<scoped_refptr<UsbDeviceHandleImpl> > HandlesVector; |
| 85 HandlesVector handles_; | 90 HandlesVector handles_; |
| 86 | 91 |
| 87 // Reference to the UI thread for permission-broker calls. | 92 // Reference to the UI thread for permission-broker calls. |
| 88 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; | 93 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; |
| 89 | 94 |
| 90 DISALLOW_COPY_AND_ASSIGN(UsbDeviceImpl); | 95 DISALLOW_COPY_AND_ASSIGN(UsbDeviceImpl); |
| 91 }; | 96 }; |
| 92 | 97 |
| 93 } // namespace device | 98 } // namespace device |
| 94 | 99 |
| 95 #endif // DEVICE_USB_USB_DEVICE_IMPL_H_ | 100 #endif // DEVICE_USB_USB_DEVICE_IMPL_H_ |
| OLD | NEW |