Use single callback for replies to async operations

Single callback simplifies copying of callbacks and makes
control flow more obvious.

BUG:24267885

Change-Id: I489e7158e2bb1adf8c9c3966a0859fa024a57db2
Reviewed-on: https://weave-review.googlesource.com/1302
Reviewed-by: Vitaly Buka <vitalybuka@google.com>
diff --git a/libweave/src/commands/cloud_command_proxy.cc b/libweave/src/commands/cloud_command_proxy.cc
index 3826378..41dc8ee 100644
--- a/libweave/src/commands/cloud_command_proxy.cc
+++ b/libweave/src/commands/cloud_command_proxy.cc
@@ -139,10 +139,8 @@
   command_update_in_progress_ = true;
   cloud_command_updater_->UpdateCommand(
       command_instance_->GetID(), *update_queue_.front().second,
-      base::Bind(&CloudCommandProxy::OnUpdateCommandFinished,
-                 weak_ptr_factory_.GetWeakPtr(), true),
-      base::Bind(&CloudCommandProxy::OnUpdateCommandFinished,
-                 weak_ptr_factory_.GetWeakPtr(), false));
+      base::Bind(&CloudCommandProxy::OnUpdateCommandDone,
+                 weak_ptr_factory_.GetWeakPtr()));
 }
 
 void CloudCommandProxy::ResendCommandUpdate() {
@@ -150,10 +148,10 @@
   SendCommandUpdate();
 }
 
-void CloudCommandProxy::OnUpdateCommandFinished(bool success) {
+void CloudCommandProxy::OnUpdateCommandDone(ErrorPtr error) {
   command_update_in_progress_ = false;
-  cloud_backoff_entry_->InformOfRequest(success);
-  if (success) {
+  cloud_backoff_entry_->InformOfRequest(!error);
+  if (!error) {
     // Remove the succeeded update from the queue.
     update_queue_.pop_front();
   }