| Index: remoting/host/setup/host_starter.cc
|
| diff --git a/remoting/host/setup/host_starter.cc b/remoting/host/setup/host_starter.cc
|
| index 31847fe8eb069b7a70f15cce33e4f5bab139e197..1a1740138f597841dd7bbed027e0d1e2218da0e3 100644
|
| --- a/remoting/host/setup/host_starter.cc
|
| +++ b/remoting/host/setup/host_starter.cc
|
| @@ -93,11 +93,11 @@ scoped_ptr<HostStarter> HostStarter::Create(
|
| service_client.Pass(), daemon_controller.Pass()));
|
| }
|
|
|
| -void HostStarter::StartHost(const std::string& host_name,
|
| - const std::string& host_pin,
|
| - bool consent_to_data_collection,
|
| - const std::string& auth_code,
|
| - CompletionCallback on_done) {
|
| +void HostStarter::StartHost(
|
| + const std::string& host_name, const std::string& host_pin,
|
| + bool consent_to_data_collection, const std::string& auth_code,
|
| + CompletionCallback on_done,
|
| + scoped_refptr<base::SingleThreadTaskRunner> on_done_runner) {
|
| if (in_progress_) {
|
| on_done.Run(START_IN_PROGRESS);
|
| return;
|
| @@ -107,6 +107,7 @@ void HostStarter::StartHost(const std::string& host_name,
|
| host_pin_ = host_pin;
|
| consent_to_data_collection_ = consent_to_data_collection;
|
| on_done_ = on_done;
|
| + on_done_runner_ = on_done_runner;
|
| // Map the authorization code to refresh and access tokens.
|
| oauth_client_->GetTokensFromAuthCode(oauth_client_info_, auth_code,
|
| kMaxGetTokensRetries, this);
|
| @@ -148,8 +149,10 @@ void HostStarter::OnHostRegistered() {
|
| }
|
|
|
| void HostStarter::OnHostStarted(DaemonController::AsyncResult result) {
|
| - on_done_.Run(
|
| - (result == DaemonController::RESULT_OK) ? START_COMPLETE : START_ERROR);
|
| + Result done_result = START_ERROR;
|
| + if (result == DaemonController::RESULT_OK)
|
| + done_result = START_COMPLETE;
|
| + on_done_runner_->PostTask(FROM_HERE, base::Bind(on_done_, done_result));
|
| // TODO(simonmorris): Unregister the host if we didn't start it.
|
| in_progress_ = false;
|
| }
|
|
|