| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_DEVICE_MANAGER_IMPL_H_ | 5 #ifndef DEVICE_USB_DEVICE_MANAGER_IMPL_H_ |
| 6 #define DEVICE_USB_DEVICE_MANAGER_IMPL_H_ | 6 #define DEVICE_USB_DEVICE_MANAGER_IMPL_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 connection_error_handler_ = error_handler; | 50 connection_error_handler_ = error_handler; |
| 51 } | 51 } |
| 52 | 52 |
| 53 private: | 53 private: |
| 54 class ServiceThreadHelper; | 54 class ServiceThreadHelper; |
| 55 | 55 |
| 56 // DeviceManager implementation: | 56 // DeviceManager implementation: |
| 57 void GetDevices(EnumerationOptionsPtr options, | 57 void GetDevices(EnumerationOptionsPtr options, |
| 58 const GetDevicesCallback& callback) override; | 58 const GetDevicesCallback& callback) override; |
| 59 void GetDeviceChanges(const GetDeviceChangesCallback& callback) override; | 59 void GetDeviceChanges(const GetDeviceChangesCallback& callback) override; |
| 60 void OpenDevice(const mojo::String& guid, | 60 void GetDevice(const mojo::String& guid, |
| 61 mojo::InterfaceRequest<Device> device_request, | 61 mojo::InterfaceRequest<Device> device_request) override; |
| 62 const OpenDeviceCallback& callback) override; | |
| 63 | |
| 64 void OnGotDeviceInfoForOpen(mojo::InterfaceRequest<Device> device_request, | |
| 65 const OpenDeviceCallback& callback, | |
| 66 DeviceInfoPtr device_info); | |
| 67 void OnOpenDevicePermissionCheckComplete( | |
| 68 mojo::InterfaceRequest<Device> device_request, | |
| 69 const OpenDeviceCallback& callback, | |
| 70 mojo::Array<mojo::String> allowed_guids); | |
| 71 | 62 |
| 72 // Callbacks to handle the async responses from the underlying UsbService. | 63 // Callbacks to handle the async responses from the underlying UsbService. |
| 64 void OnGetDevice(mojo::InterfaceRequest<Device> device_request, |
| 65 scoped_refptr<UsbDevice> device); |
| 66 void OnGetDevicePermissionCheckComplete( |
| 67 scoped_refptr<device::UsbDevice> device, |
| 68 mojo::InterfaceRequest<Device> device_request, |
| 69 mojo::Array<mojo::String> allowed_guids); |
| 73 void OnGetDevices(EnumerationOptionsPtr options, | 70 void OnGetDevices(EnumerationOptionsPtr options, |
| 74 const GetDevicesCallback& callback, | 71 const GetDevicesCallback& callback, |
| 75 const DeviceList& devices); | 72 const DeviceList& devices); |
| 76 | 73 |
| 77 // Methods called by |helper_| when devices are added or removed. | 74 // Methods called by |helper_| when devices are added or removed. |
| 78 void OnDeviceAdded(scoped_refptr<device::UsbDevice> device); | 75 void OnDeviceAdded(scoped_refptr<device::UsbDevice> device); |
| 79 void OnDeviceRemoved(scoped_refptr<device::UsbDevice> device); | 76 void OnDeviceRemoved(scoped_refptr<device::UsbDevice> device); |
| 80 void MaybeRunDeviceChangesCallback(); | 77 void MaybeRunDeviceChangesCallback(); |
| 81 void OnEnumerationPermissionCheckComplete( | 78 void OnEnumerationPermissionCheckComplete( |
| 82 const DeviceMap& devices_added, | 79 const DeviceMap& devices_added, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 106 mojo::Binding<DeviceManager> binding_; | 103 mojo::Binding<DeviceManager> binding_; |
| 107 base::WeakPtrFactory<DeviceManagerImpl> weak_factory_; | 104 base::WeakPtrFactory<DeviceManagerImpl> weak_factory_; |
| 108 | 105 |
| 109 DISALLOW_COPY_AND_ASSIGN(DeviceManagerImpl); | 106 DISALLOW_COPY_AND_ASSIGN(DeviceManagerImpl); |
| 110 }; | 107 }; |
| 111 | 108 |
| 112 } // namespace usb | 109 } // namespace usb |
| 113 } // namespace device | 110 } // namespace device |
| 114 | 111 |
| 115 #endif // DEVICE_USB_DEVICE_MANAGER_IMPL_H_ | 112 #endif // DEVICE_USB_DEVICE_MANAGER_IMPL_H_ |
| OLD | NEW |