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/connection_manager.h b/connection_manager.h
index 551c4f3..870b088 100644
--- a/connection_manager.h
+++ b/connection_manager.h
@@ -5,10 +5,13 @@
 #ifndef UPDATE_ENGINE_CONNECTION_MANAGER_H_
 #define UPDATE_ENGINE_CONNECTION_MANAGER_H_
 
+#include <string>
+
 #include <base/macros.h>
 
 #include "update_engine/connection_manager_interface.h"
-#include "update_engine/dbus_wrapper_interface.h"
+#include "update_engine/dbus_proxies.h"
+#include "update_engine/shill_proxy_interface.h"
 
 namespace chromeos_update_engine {
 
@@ -16,30 +19,38 @@
 
 // This class implements the concrete class that talks with the connection
 // manager (shill) over DBus.
+// TODO(deymo): Remove this class and use ShillProvider from the UpdateManager.
 class ConnectionManager : public ConnectionManagerInterface {
  public:
   // Returns the string representation corresponding to the given
   // connection type.
   static const char* StringForConnectionType(NetworkConnectionType type);
 
-  // Returns the string representation corresponding to the given tethering
-  // state.
-  static const char* StringForTethering(NetworkTethering tethering);
-
   // Constructs a new ConnectionManager object initialized with the
   // given system state.
-  explicit ConnectionManager(SystemState* system_state);
+  ConnectionManager(ShillProxyInterface* shill_proxy,
+                    SystemState* system_state);
   ~ConnectionManager() override = default;
 
-  // ConnectionManagerInterface overrides
-  bool GetConnectionProperties(DBusWrapperInterface* dbus_iface,
-                               NetworkConnectionType* out_type,
-                               NetworkTethering* out_tethering) const override;
+  // ConnectionManagerInterface overrides.
+  bool GetConnectionProperties(NetworkConnectionType* out_type,
+                               NetworkTethering* out_tethering) override;
   bool IsUpdateAllowedOver(NetworkConnectionType type,
                            NetworkTethering tethering) const override;
 
  private:
-  // The global context for update_engine
+  // Returns (via out_path) the default network path, or empty string if
+  // there's no network up. Returns true on success.
+  bool GetDefaultServicePath(std::string* out_path);
+
+  bool GetServicePathProperties(const std::string& path,
+                                NetworkConnectionType* out_type,
+                                NetworkTethering* out_tethering);
+
+  // The mockable interface to access the shill DBus proxies.
+  ShillProxyInterface* shill_proxy_;
+
+  // The global context for update_engine.
   SystemState* system_state_;
 
   DISALLOW_COPY_AND_ASSIGN(ConnectionManager);