buffet: Move command state into CommandInstance

The command state is now stored in CommandInstance and not in
DBusCommandProxy. CommandInstance can now notify the proxy of
command state changes via CommandProxyInterface.

Moved command status strings from dbus_constants.h into the
CommandInstance class, as members.

Added a property on DBusCommandProxy to expose the command
parameters to command handlers, so they can get the parameter
values over D-Bus.

BUG=chromium:374864
TEST=FEATURES=test emerge-link buffet

Change-Id: Ief3397ef09644772ffc3b1b01ed972a8b6779df4
Reviewed-on: https://chromium-review.googlesource.com/216296
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
diff --git a/buffet/commands/command_queue.cc b/buffet/commands/command_queue.cc
index 557a303..8583921 100644
--- a/buffet/commands/command_queue.cc
+++ b/buffet/commands/command_queue.cc
@@ -10,6 +10,7 @@
 std::string CommandQueue::Add(std::unique_ptr<CommandInstance> instance) {
   std::string id = std::to_string(++next_id_);
   instance->SetID(id);
+  instance->SetCommandQueue(this);
   auto pair = map_.insert(std::make_pair(id, std::move(instance)));
   LOG_IF(FATAL, !pair.second) << "Command with ID '" << id
                               << "' is already in the queue";
@@ -25,6 +26,7 @@
   auto p = map_.find(id);
   if (p != map_.end()) {
     instance = std::move(p->second);
+    instance->SetCommandQueue(nullptr);
     map_.erase(p);
     if (dispatch_interface_)
       dispatch_interface_->OnCommandRemoved(instance.get());