[shill] Back property storage in Service objects with Entry objects

Much of Shill Service state is persisted to disk, by creating an Entry
in a Profile.  We should store this info just once, so that we don't
have to worry about keeping multiple data stores in sync.  This is a
first step in that direction.

BUG=chromium-os:17436
TEST=unit tests

Change-Id: If94db2a38a7d79c56e2c746b2f069cfd7ab4bf65
Reviewed-on: http://gerrit.chromium.org/gerrit/3876
Tested-by: Chris Masone <cmasone@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
diff --git a/ephemeral_profile.cc b/ephemeral_profile.cc
new file mode 100644
index 0000000..364274f
--- /dev/null
+++ b/ephemeral_profile.cc
@@ -0,0 +1,40 @@
+// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "shill/ephemeral_profile.h"
+
+#include <string>
+#include <map>
+
+#include <chromeos/dbus/service_constants.h>
+
+#include "shill/adaptor_interfaces.h"
+#include "shill/control_interface.h"
+#include "shill/entry.h"
+#include "shill/manager.h"
+
+using std::map;
+using std::string;
+
+namespace shill {
+
+EphemeralProfile::EphemeralProfile(ControlInterface *control_interface,
+                                   GLib *glib,
+                                   Manager *manager)
+    : Profile(control_interface, glib),
+      manager_(manager) {
+}
+
+EphemeralProfile::~EphemeralProfile() {}
+
+bool EphemeralProfile::MoveToActiveProfile(const std::string &entry_name) {
+  map<string, EntryRefPtr>::iterator it = entries_.find(entry_name);
+  if (it == entries_.end())
+    return false;
+  manager_->ActiveProfile()->AdoptEntry(entry_name, it->second);
+  entries_.erase(it);
+  return true;
+}
+
+}  // namespace shill