Index: remoting/host/setup/host_starter.cc |
diff --git a/remoting/host/setup/host_starter.cc b/remoting/host/setup/host_starter.cc |
index 5eda05c52a6f1b285d2f06faaf22be1156227d1d..2fefc7cc552742cfcf2de9183067ffd2e6742bee 100644 |
--- a/remoting/host/setup/host_starter.cc |
+++ b/remoting/host/setup/host_starter.cc |
@@ -171,21 +171,30 @@ void HostStarter::StartHostProcess() { |
config->SetString("host_secret_hash", host_secret_hash); |
daemon_controller_->SetConfigAndStart( |
config.Pass(), consent_to_data_collection_, |
- base::Bind(&HostStarter::OnHostStarted, base::Unretained(this))); |
+ base::Bind(&HostStarter::OnStartHostSucceeded, base::Unretained(this)), |
+ base::Bind(&HostStarter::OnStartHostFailed, base::Unretained(this))); |
} |
-void HostStarter::OnHostStarted(DaemonController::AsyncResult result) { |
+void HostStarter::OnStartHostSucceeded() { |
if (!main_task_runner_->BelongsToCurrentThread()) { |
main_task_runner_->PostTask(FROM_HERE, base::Bind( |
- &HostStarter::OnHostStarted, weak_ptr_, result)); |
+ &HostStarter::OnStartHostSucceeded, weak_ptr_)); |
return; |
} |
- if (result != DaemonController::RESULT_OK) { |
- unregistering_host_ = true; |
- service_client_->UnregisterHost(host_id_, access_token_, this); |
+ base::ResetAndReturn(&on_done_).Run(START_COMPLETE); |
+} |
+ |
+void HostStarter::OnStartHostFailed(const std::string& error_message, |
+ const tracked_objects::Location& location) { |
+ if (!main_task_runner_->BelongsToCurrentThread()) { |
+ main_task_runner_->PostTask(FROM_HERE, base::Bind( |
+ &HostStarter::OnStartHostFailed, weak_ptr_, error_message, location)); |
return; |
} |
- base::ResetAndReturn(&on_done_).Run(START_COMPLETE); |
+ |
+ // start_host is a command-line tool, so the error has already been reported. |
+ unregistering_host_ = true; |
+ service_client_->UnregisterHost(host_id_, access_token_, this); |
} |
void HostStarter::OnOAuthError() { |