shill: Add option to push profiles on shill startup

When re-started after a user has logged in (say, due to a crash), we need a
way to tell shill to load the logged in user's profile. Normally, you would
do this by having the respawning entity (upstart, usually) to re-send a dbus-
message to load a profile.

Due to the machinations of how process tracking works, it's sometimes better
to do the startup and profile load in a single step. Hence, this new option
similar to flimflam.

BUG=chromium-os:23492
TEST=none

Change-Id: I2f66ebd726fa678468b4ad01a57c21ebf42784aa
Reviewed-on: https://gerrit.chromium.org/gerrit/12179
Tested-by: Gaurav Shah <gauravsh@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Ready: Gaurav Shah <gauravsh@chromium.org>
diff --git a/shill_daemon.cc b/shill_daemon.cc
index 1e0dc23..8f62248 100644
--- a/shill_daemon.cc
+++ b/shill_daemon.cc
@@ -7,22 +7,22 @@
 #include <stdio.h>
 
 #include <string>
+#include <vector>
 
 #include <base/file_path.h>
 #include <base/logging.h>
 
 #include "shill/dhcp_provider.h"
+#include "shill/error.h"
 #include "shill/proxy_factory.h"
 #include "shill/rtnl_handler.h"
 #include "shill/shill_config.h"
 
 using std::string;
+using std::vector;
 
 namespace shill {
 
-// Daemon: Main for connection manager.  Starts main process and holds event
-// loop.
-
 Daemon::Daemon(Config *config, ControlInterface *control)
     : config_(config),
       control_(control),
@@ -39,16 +39,9 @@
   manager_.AddDeviceToBlackList(device_name);
 }
 
-void Daemon::Start() {
-  glib_.TypeInit();
-  ProxyFactory::GetInstance()->Init();
-  RTNLHandler::GetInstance()->Start(&dispatcher_, &sockets_);
-  DHCPProvider::GetInstance()->Init(control_, &dispatcher_, &glib_);
-  manager_.Start();
-}
-
-void Daemon::Stop() {
-  manager_.Stop();
+void Daemon::SetStartupProfiles(const vector<string> &profile_name_list) {
+  Error error;
+  manager_.set_startup_profiles(profile_name_list);
 }
 
 void Daemon::Run() {
@@ -63,5 +56,16 @@
   dispatcher_.PostTask(new MessageLoop::QuitTask);
 }
 
+void Daemon::Start() {
+  glib_.TypeInit();
+  ProxyFactory::GetInstance()->Init();
+  RTNLHandler::GetInstance()->Start(&dispatcher_, &sockets_);
+  DHCPProvider::GetInstance()->Init(control_, &dispatcher_, &glib_);
+  manager_.Start();
+}
+
+void Daemon::Stop() {
+  manager_.Stop();
+}
 
 }  // namespace shill