shill: Implement GetEntry on Profile

Implement "GetEntry" on profile_dbus_adaptor.  This change adds
the ability to look up a Service in the Manager by its
StorageIdentifier and then to return its properties to the caller.
If the Service does not exist in the manager, we have to read
directly out of the Profile's store and build a DBus property dict
out of its contents.  This is a pretty gross method, and I've already
created a bug to remove this as soon as we can diverge from the
flimflam Profile API.  crosbug.com/25813

BUG=chromium-os:25542
TEST=New unit tests + Manual: chrome://settings/internet now lists
both visible and unavailable networks under "Remembered Networks"
and clikcing on "Forget Network" purges the network from the profile.

Change-Id: Ib2f0ab772e40a1f615206a7b985be446fc7facde
Reviewed-on: https://gerrit.chromium.org/gerrit/15200
Commit-Ready: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/profile_dbus_adaptor.cc b/profile_dbus_adaptor.cc
index 42f7d1c..6ebf8bd 100644
--- a/profile_dbus_adaptor.cc
+++ b/profile_dbus_adaptor.cc
@@ -13,6 +13,8 @@
 
 #include "shill/error.h"
 #include "shill/profile.h"
+#include "shill/profile_dbus_property_exporter.h"
+#include "shill/service.h"
 
 using std::map;
 using std::string;
@@ -71,9 +73,21 @@
 }
 
 map<string, ::DBus::Variant> ProfileDBusAdaptor::GetEntry(
-    const std::string& /*name*/,
-    ::DBus::Error &/*error*/) {
-  return map<string, ::DBus::Variant>();
+    const std::string &name,
+    ::DBus::Error &error) {
+  Error e;
+  ServiceRefPtr service = profile_->GetServiceFromEntry(name, &e);
+  map<string, ::DBus::Variant> properties;
+  if (e.IsSuccess()) {
+    DBusAdaptor::GetProperties(service->store(), &properties, &error);
+    return properties;
+  }
+
+  ProfileDBusPropertyExporter loader(profile_->GetConstStorage(), name);
+  if (!loader.LoadServiceProperties(&properties, &e)) {
+    e.ToDBusError(&error);
+  }
+  return properties;
 }
 
 void ProfileDBusAdaptor::DeleteEntry(const std::string &name,