OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #include "device/usb/usb_service.h" | 5 #include "device/usb/usb_service.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 #include <unordered_map> | 8 #include <unordered_map> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 const std::string& device_path) override; | 36 const std::string& device_path) override; |
37 void OnDeviceRemoved(const GUID& class_guid, | 37 void OnDeviceRemoved(const GUID& class_guid, |
38 const std::string& device_path) override; | 38 const std::string& device_path) override; |
39 | 39 |
40 // Methods called by BlockingThreadHelper | 40 // Methods called by BlockingThreadHelper |
41 void HelperStarted(); | 41 void HelperStarted(); |
42 void CreateDeviceObject(const std::string& device_path, | 42 void CreateDeviceObject(const std::string& device_path, |
43 const std::string& hub_path, | 43 const std::string& hub_path, |
44 int port_number); | 44 int port_number); |
45 | 45 |
| 46 void OnReadDescriptors(scoped_refptr<UsbDeviceWin> device, bool success); |
46 void DeviceReady(scoped_refptr<UsbDeviceWin> device, bool success); | 47 void DeviceReady(scoped_refptr<UsbDeviceWin> device, bool success); |
47 | 48 |
48 bool enumeration_ready() { | 49 bool enumeration_ready() { |
49 return helper_started_ && first_enumeration_countdown_ == 0; | 50 return helper_started_ && first_enumeration_countdown_ == 0; |
50 } | 51 } |
51 | 52 |
52 // Enumeration callbacks are queued until an enumeration completes. | 53 // Enumeration callbacks are queued until an enumeration completes. |
53 bool helper_started_ = false; | 54 bool helper_started_ = false; |
54 uint32_t first_enumeration_countdown_ = 0; | 55 uint32_t first_enumeration_countdown_ = 0; |
55 std::list<GetDevicesCallback> enumeration_callbacks_; | 56 std::list<GetDevicesCallback> enumeration_callbacks_; |
56 | 57 |
57 BlockingThreadHelper* helper_; | 58 BlockingThreadHelper* helper_; |
58 std::unordered_map<std::string, scoped_refptr<UsbDeviceWin>> devices_by_path_; | 59 std::unordered_map<std::string, scoped_refptr<UsbDeviceWin>> devices_by_path_; |
59 | 60 |
60 ScopedObserver<DeviceMonitorWin, DeviceMonitorWin::Observer> device_observer_; | 61 ScopedObserver<DeviceMonitorWin, DeviceMonitorWin::Observer> device_observer_; |
61 | 62 |
62 base::WeakPtrFactory<UsbServiceWin> weak_factory_; | 63 base::WeakPtrFactory<UsbServiceWin> weak_factory_; |
63 | 64 |
64 DISALLOW_COPY_AND_ASSIGN(UsbServiceWin); | 65 DISALLOW_COPY_AND_ASSIGN(UsbServiceWin); |
65 }; | 66 }; |
66 | 67 |
67 } // namespace device | 68 } // namespace device |
OLD | NEW |