[shill] Add Service merging boilerplate to Manager

Also, add some more comments and TODOs capturing some useful conversations
Paul and I have had over the last few days.

BUG=chromium-os:17253
TEST=unit

Change-Id: I31329060b3ef768bced89c8b08298626d697a873
Reviewed-on: http://gerrit.chromium.org/gerrit/8627
Tested-by: Chris Masone <cmasone@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
diff --git a/manager.cc b/manager.cc
index 1df0dc3..a99ac00 100644
--- a/manager.cc
+++ b/manager.cc
@@ -160,6 +160,10 @@
 }
 
 void Manager::RegisterDevice(const DeviceRefPtr &to_manage) {
+  // TODO(pstew): Should DefaultProfile have a list of devices, analogous to
+  // the list of services that it manages?  If so, we should do a similar merge
+  // thing here.
+
   vector<DeviceRefPtr>::iterator it;
   for (it = devices_.begin(); it != devices_.end(); ++it) {
     if (to_manage.get() == it->get())
@@ -186,8 +190,12 @@
 }
 
 void Manager::RegisterService(const ServiceRefPtr &to_manage) {
-  // This should look for |to_manage| in the real profiles and, if found,
-  // do...something...to merge the meaningful state, I guess.
+  for (vector<ProfileRefPtr>::iterator it = profiles_.begin();
+       it != profiles_.end();
+       ++it) {
+    if ((*it)->MergeService(to_manage))  // this will merge, if possible.
+      break;
+  }
 
   // If not found, add it to the ephemeral profile
   ephemeral_profile_->AdoptService(to_manage);