shill: Implement DeleteEntry Profile method

Implement the DeleteEntry DBus method call, which removes
a Profile entry as well as detaching any connected services
from the profile data.  As a bonus change, modify Manager to
consolidate finding a Profile that is suitable for a Service
which does not have one.

BUG=chromium-os:25542
TEST=New unit tests

Change-Id: I6a954a41ab2d1b49f6432858e2263a63b5af21f1
Reviewed-on: https://gerrit.chromium.org/gerrit/14944
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/manager.h b/manager.h
index f61d4ce..a6ff900 100644
--- a/manager.h
+++ b/manager.h
@@ -102,6 +102,13 @@
   void PopProfile(const std::string &name, Error *error);
   // Remove the active profile.
   void PopAnyProfile(Error *error);
+  // Handle the event where a profile is about to remove a profile entry.
+  // Any Services that are dependent on this storage identifier will need
+  // to find new profiles.  Return true if any service has been moved to a new
+  // profile.  Any such services will have had the profile group removed from
+  // the profile.
+  virtual bool HandleProfileEntryDeletion(const ProfileRefPtr &profile,
+                                          const std::string &entry_name);
 
   virtual DeviceInfo *device_info() { return &device_info_; }
   ModemInfo *modem_info() { return &modem_info_; }
@@ -125,7 +132,6 @@
   FRIEND_TEST(ManagerTest, DefaultTechnology);
   FRIEND_TEST(ManagerTest, DeviceRegistrationAndStart);
   FRIEND_TEST(ManagerTest, EnumerateProfiles);
-  FRIEND_TEST(ManagerTest, PushPopProfile);
   FRIEND_TEST(ManagerTest, SortServices);
   FRIEND_TEST(ManagerTest, SortServicesWithConnection);
 
@@ -156,6 +162,7 @@
   void PopProfileInternal();
   bool OrderServices(ServiceRefPtr a, ServiceRefPtr b);
   void SortServices();
+  bool MatchProfileWithService(const ServiceRefPtr &service);
 
   EventDispatcher *dispatcher_;
   ScopedRunnableMethodFactory<Manager> task_factory_;