OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "remoting/host/setup/host_starter.h" | 5 #include "remoting/host/setup/host_starter.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 weak_ptr_ = weak_ptr_factory_.GetWeakPtr(); | 36 weak_ptr_ = weak_ptr_factory_.GetWeakPtr(); |
37 main_task_runner_ = base::ThreadTaskRunnerHandle::Get(); | 37 main_task_runner_ = base::ThreadTaskRunnerHandle::Get(); |
38 } | 38 } |
39 | 39 |
40 HostStarter::~HostStarter() {} | 40 HostStarter::~HostStarter() {} |
41 | 41 |
42 std::unique_ptr<HostStarter> HostStarter::Create( | 42 std::unique_ptr<HostStarter> HostStarter::Create( |
43 const std::string& chromoting_hosts_url, | 43 const std::string& chromoting_hosts_url, |
44 net::URLRequestContextGetter* url_request_context_getter) { | 44 net::URLRequestContextGetter* url_request_context_getter) { |
45 return base::WrapUnique(new HostStarter( | 45 return base::WrapUnique(new HostStarter( |
46 base::WrapUnique(new gaia::GaiaOAuthClient(url_request_context_getter)), | 46 base::MakeUnique<gaia::GaiaOAuthClient>(url_request_context_getter), |
47 base::WrapUnique(new remoting::ServiceClient(chromoting_hosts_url, | 47 base::MakeUnique<remoting::ServiceClient>(chromoting_hosts_url, |
48 url_request_context_getter)), | 48 url_request_context_getter), |
49 remoting::DaemonController::Create())); | 49 remoting::DaemonController::Create())); |
50 } | 50 } |
51 | 51 |
52 void HostStarter::StartHost( | 52 void HostStarter::StartHost( |
53 const std::string& host_name, | 53 const std::string& host_name, |
54 const std::string& host_pin, | 54 const std::string& host_pin, |
55 bool consent_to_data_collection, | 55 bool consent_to_data_collection, |
56 const std::string& auth_code, | 56 const std::string& auth_code, |
57 const std::string& redirect_url, | 57 const std::string& redirect_url, |
58 CompletionCallback on_done) { | 58 CompletionCallback on_done) { |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 void HostStarter::OnHostUnregistered() { | 217 void HostStarter::OnHostUnregistered() { |
218 if (!main_task_runner_->BelongsToCurrentThread()) { | 218 if (!main_task_runner_->BelongsToCurrentThread()) { |
219 main_task_runner_->PostTask(FROM_HERE, base::Bind( | 219 main_task_runner_->PostTask(FROM_HERE, base::Bind( |
220 &HostStarter::OnHostUnregistered, weak_ptr_)); | 220 &HostStarter::OnHostUnregistered, weak_ptr_)); |
221 return; | 221 return; |
222 } | 222 } |
223 base::ResetAndReturn(&on_done_).Run(START_ERROR); | 223 base::ResetAndReturn(&on_done_).Run(START_ERROR); |
224 } | 224 } |
225 | 225 |
226 } // namespace remoting | 226 } // namespace remoting |
OLD | NEW |