Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(177)

Side by Side Diff: device/devices_app/usb/device_manager_impl.cc

Issue 1226163009: Convert usages of mojo::ErrorHandler in //device to callbacks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comment. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « device/devices_app/usb/device_manager_impl.h ('k') | device/devices_app/usb/device_manager_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698