summaryrefslogtreecommitdiff
path: root/ephemeral_profile.cc
blob: 1009877bf12f309aa17f503dade382103c01fd4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// 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/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 &name) {
  map<string, ServiceRefPtr>::iterator it = services_.find(name);
  if (it == services_.end())
    return false;
  manager_->ActiveProfile()->AdoptService(name, it->second);
  services_.erase(it);
  return true;
}

}  // namespace shill