blob: 364274fe65fd25e280c1d64628cff4ac9d090924 [file] [log] [blame]
Chris Masone7aa5f902011-07-11 11:13:35 -07001// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "shill/ephemeral_profile.h"
6
7#include <string>
8#include <map>
9
10#include <chromeos/dbus/service_constants.h>
11
12#include "shill/adaptor_interfaces.h"
13#include "shill/control_interface.h"
14#include "shill/entry.h"
15#include "shill/manager.h"
16
17using std::map;
18using std::string;
19
20namespace shill {
21
22EphemeralProfile::EphemeralProfile(ControlInterface *control_interface,
23 GLib *glib,
24 Manager *manager)
25 : Profile(control_interface, glib),
26 manager_(manager) {
27}
28
29EphemeralProfile::~EphemeralProfile() {}
30
31bool EphemeralProfile::MoveToActiveProfile(const std::string &entry_name) {
32 map<string, EntryRefPtr>::iterator it = entries_.find(entry_name);
33 if (it == entries_.end())
34 return false;
35 manager_->ActiveProfile()->AdoptEntry(entry_name, it->second);
36 entries_.erase(it);
37 return true;
38}
39
40} // namespace shill