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 #include "device/devices_app/usb/device_manager_impl.h" | 5 #include "device/devices_app/usb/device_manager_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/sequenced_task_runner.h" | 10 #include "base/sequenced_task_runner.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 scoped_refptr<base::SequencedTaskRunner> service_task_runner) | 104 scoped_refptr<base::SequencedTaskRunner> service_task_runner) |
105 : binding_(this, request.Pass()), | 105 : binding_(this, request.Pass()), |
106 delegate_(delegate.Pass()), | 106 delegate_(delegate.Pass()), |
107 service_task_runner_(service_task_runner), | 107 service_task_runner_(service_task_runner), |
108 weak_factory_(this) { | 108 weak_factory_(this) { |
109 } | 109 } |
110 | 110 |
111 DeviceManagerImpl::~DeviceManagerImpl() { | 111 DeviceManagerImpl::~DeviceManagerImpl() { |
112 } | 112 } |
113 | 113 |
114 void DeviceManagerImpl::set_error_handler(mojo::ErrorHandler* error_handler) { | 114 void DeviceManagerImpl::set_connection_error_handler( |
115 binding_.set_error_handler(error_handler); | 115 const mojo::Closure& error_handler) { |
| 116 binding_.set_connection_error_handler(error_handler); |
116 } | 117 } |
117 | 118 |
118 void DeviceManagerImpl::GetDevices(EnumerationOptionsPtr options, | 119 void DeviceManagerImpl::GetDevices(EnumerationOptionsPtr options, |
119 const GetDevicesCallback& callback) { | 120 const GetDevicesCallback& callback) { |
120 auto get_devices_callback = | 121 auto get_devices_callback = |
121 base::Bind(&DeviceManagerImpl::OnGetDevices, weak_factory_.GetWeakPtr(), | 122 base::Bind(&DeviceManagerImpl::OnGetDevices, weak_factory_.GetWeakPtr(), |
122 base::Passed(&options), callback); | 123 base::Passed(&options), callback); |
123 service_task_runner_->PostTask( | 124 service_task_runner_->PostTask( |
124 FROM_HERE, base::Bind(&GetDevicesOnServiceThread, get_devices_callback, | 125 FROM_HERE, base::Bind(&GetDevicesOnServiceThread, get_devices_callback, |
125 base::ThreadTaskRunnerHandle::Get())); | 126 base::ThreadTaskRunnerHandle::Get())); |
(...skipping 24 matching lines...) Expand all Loading... |
150 if (config) | 151 if (config) |
151 device_info->configurations.push_back(ConfigurationInfo::From(*config)); | 152 device_info->configurations.push_back(ConfigurationInfo::From(*config)); |
152 device_infos.push_back(device_info.Pass()); | 153 device_infos.push_back(device_info.Pass()); |
153 } | 154 } |
154 } | 155 } |
155 callback.Run(device_infos.Pass()); | 156 callback.Run(device_infos.Pass()); |
156 } | 157 } |
157 | 158 |
158 } // namespace usb | 159 } // namespace usb |
159 } // namespace device | 160 } // namespace device |
OLD | NEW |