update_engine: Switch to chrome-dbus for client requests in update_engine

update_engine daemon acts as DBus client to send DBus calls to shill,
power_manager and chrome, and to listen for signals from shill, chrome
and login_manager. This patch migrates these calls and signals to use
chrome-dbus framework instead of dbus-glib.

All references to dbus-glib code are removed.

BUG=chromium:419827
TEST=Updated unittest. Deployed on a link device and tested interactions with shill and chromium.

Change-Id: I31b389e0d1690cccb115ff3b6539c876ba81bd0e
Reviewed-on: https://chromium-review.googlesource.com/290990
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Trybot-Ready: Alex Deymo <deymo@chromium.org>
diff --git a/real_system_state.h b/real_system_state.h
index 4e97b95..be7778e 100644
--- a/real_system_state.h
+++ b/real_system_state.h
@@ -14,11 +14,12 @@
 
 #include "update_engine/clock.h"
 #include "update_engine/connection_manager.h"
+#include "update_engine/dbus_proxies.h"
 #include "update_engine/hardware.h"
 #include "update_engine/p2p_manager.h"
 #include "update_engine/payload_state.h"
 #include "update_engine/prefs.h"
-#include "update_engine/real_dbus_wrapper.h"
+#include "update_engine/shill_proxy.h"
 #include "update_engine/update_attempter.h"
 #include "update_engine/update_manager/update_manager.h"
 
@@ -30,7 +31,7 @@
  public:
   // Constructs all system objects that do not require separate initialization;
   // see Initialize() below for the remaining ones.
-  RealSystemState();
+  explicit RealSystemState(const scoped_refptr<dbus::Bus>& bus);
 
   // Initializes and sets systems objects that require an initialization
   // separately from construction. Returns |true| on success.
@@ -81,18 +82,30 @@
     return update_manager_.get();
   }
 
+  inline org::chromium::PowerManagerProxyInterface* power_manager_proxy()
+      override {
+    return &power_manager_proxy_;
+  }
+
   inline bool system_rebooted() override { return system_rebooted_; }
 
  private:
+  // Real DBus proxies using the DBus connection.
+  org::chromium::debugdProxy debugd_proxy_;
+  org::chromium::PowerManagerProxy power_manager_proxy_;
+  org::chromium::SessionManagerInterfaceProxy session_manager_proxy_;
+  ShillProxy shill_proxy_;
+  LibCrosProxy libcros_proxy_;
+
   // Interface for the clock.
   Clock clock_;
 
   // The latest device policy object from the policy provider.
-  const policy::DevicePolicy* device_policy_;
+  const policy::DevicePolicy* device_policy_{nullptr};
 
-  // The connection manager object that makes download
-  // decisions depending on the current type of connection.
-  ConnectionManager connection_manager_;
+  // The connection manager object that makes download decisions depending on
+  // the current type of connection.
+  ConnectionManager connection_manager_{&shill_proxy_, this};
 
   // Interface for the hardware functions.
   Hardware hardware_;
@@ -106,18 +119,15 @@
   // Interface for persisted store that persists across powerwashes.
   Prefs powerwash_safe_prefs_;
 
-  // All state pertaining to payload state such as
-  // response, URL, backoff states.
+  // All state pertaining to payload state such as response, URL, backoff
+  // states.
   PayloadState payload_state_;
 
-  // The dbus object used to initialize the update attempter.
-  RealDBusWrapper dbus_;
-
   // Pointer to the update attempter object.
-  UpdateAttempter update_attempter_;
+  UpdateAttempter update_attempter_{this, &libcros_proxy_, &debugd_proxy_};
 
   // Common parameters for all Omaha requests.
-  OmahaRequestParams request_params_;
+  OmahaRequestParams request_params_{this};
 
   std::unique_ptr<P2PManager> p2p_manager_;
 
@@ -128,7 +138,7 @@
   // If true, this is the first instance of the update engine since the system
   // rebooted. Important for tracking whether you are running instance of the
   // update engine on first boot or due to a crash/restart.
-  bool system_rebooted_;
+  bool system_rebooted_{false};
 };
 
 }  // namespace chromeos_update_engine