shill: Don't create DHCP and Modem D-Bus proxies in signal callbacks.

dbus-c++ doesn't allow proxy creation in signal callbacks so create them in
deferred tasks instead.

BUG=chromium-os:18228
TEST=unit tests, tested on device

Change-Id: I4f85ab937aef99ef4556c5a3c16af913d8fa08fd
Reviewed-on: http://gerrit.chromium.org/gerrit/4827
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
diff --git a/shill_daemon.cc b/shill_daemon.cc
index ae2577f..f789186 100644
--- a/shill_daemon.cc
+++ b/shill_daemon.cc
@@ -2,36 +2,28 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include <stdio.h>
-#include <glib.h>
+#include "shill/shill_daemon.h"
 
-#include <algorithm>
+#include <stdio.h>
+
 #include <string>
-#include <vector>
 
 #include <base/logging.h>
 
-#include "shill/shill_daemon.h"
-#include "shill/control_interface.h"
-#include "shill/dbus_control.h"
+#include "shill/dhcp_provider.h"
 #include "shill/rtnl_handler.h"
 
-using std::max;
-using std::min;
 using std::string;
-using std::vector;
 
 namespace shill {
 
-static const char kTaggedFilePath[] = "/var/lib/shill";
-
 // Daemon: Main for connection manager.  Starts main process and holds event
 // loop.
 
-Daemon::Daemon(Config *config, ControlInterface *control, GLib *glib)
-  : config_(config),
-    control_(control),
-    manager_(control_, &dispatcher_, glib) { }
+Daemon::Daemon(Config *config, ControlInterface *control)
+    : config_(config),
+      control_(control),
+      manager_(control_, &dispatcher_, &glib_) { }
 Daemon::~Daemon() {}
 
 void Daemon::AddDeviceToBlackList(const string &device_name) {
@@ -39,7 +31,11 @@
 }
 
 void Daemon::Start() {
+  glib_.TypeInit();
+  proxy_factory_.Init();
+  ProxyFactory::set_factory(&proxy_factory_);
   RTNLHandler::GetInstance()->Start(&dispatcher_, &sockets_);
+  DHCPProvider::GetInstance()->Init(control_, &dispatcher_, &glib_);
   manager_.Start();
 }