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

Unified Diff: remoting/host/setup/host_starter.cc

Issue 1272833002: Pass error messages from native messaging to web-app. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed unit tests. Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
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()) {
Sergey Ulanov 2015/08/08 00:57:09 I don't think we need this thread-check. DaemonCon
+ 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() {

Powered by Google App Engine
This is Rietveld 408576698