blob: ecffdff61545548b678f32d550f2ad6037b469b1 [file] [log] [blame]
Ben Chanfad4a0b2012-04-18 15:49:59 -07001// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
Chris Masone7aa5f902011-07-11 11:13:35 -07002// 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
Chris Masone7aa5f902011-07-11 11:13:35 -07007#include <chromeos/dbus/service_constants.h>
8
9#include "shill/adaptor_interfaces.h"
10#include "shill/control_interface.h"
Christopher Wileyb691efd2012-08-09 13:51:51 -070011#include "shill/logging.h"
Chris Masone7aa5f902011-07-11 11:13:35 -070012#include "shill/manager.h"
13
Chris Masone7aa5f902011-07-11 11:13:35 -070014namespace shill {
15
mukesh agrawal86a22592014-07-25 14:58:40 -070016using std::string;
17
Rebecca Silbersteinc9c31d82014-10-21 15:01:00 -070018namespace Logging {
19static auto kModuleLogScope = ScopeLogger::kProfile;
Paul Stewarta794cd62015-06-16 13:13:10 -070020static string ObjectID(EphemeralProfile* e) { return e->GetRpcIdentifier(); }
Rebecca Silbersteinc9c31d82014-10-21 15:01:00 -070021}
22
mukesh agrawal86a22592014-07-25 14:58:40 -070023// static
24const char EphemeralProfile::kFriendlyName[] = "(ephemeral)";
25
Paul Stewarta794cd62015-06-16 13:13:10 -070026EphemeralProfile::EphemeralProfile(ControlInterface* control_interface,
27 Metrics* metrics,
28 Manager* manager)
Thieu Le5133b712013-02-19 14:47:21 -080029 : Profile(control_interface, metrics, manager, Identifier(), "", false) {
Chris Masone7aa5f902011-07-11 11:13:35 -070030}
31
32EphemeralProfile::~EphemeralProfile() {}
33
mukesh agrawal86a22592014-07-25 14:58:40 -070034string EphemeralProfile::GetFriendlyName() {
35 return kFriendlyName;
36}
37
Paul Stewarta794cd62015-06-16 13:13:10 -070038bool EphemeralProfile::AdoptService(const ServiceRefPtr& service) {
Rebecca Silbersteinc9c31d82014-10-21 15:01:00 -070039 SLOG(this, 2) << "Adding service " << service->unique_name()
40 << " to ephemeral profile.";
Philipp Neubeck79173602012-11-13 21:10:09 +010041 service->SetProfile(this);
Chris Masone6515aab2011-10-12 16:19:09 -070042 return true;
43}
44
Paul Stewarta794cd62015-06-16 13:13:10 -070045bool EphemeralProfile::AbandonService(const ServiceRefPtr& service) {
Chris Masone6515aab2011-10-12 16:19:09 -070046 if (service->profile() == this)
Ben Chancc225ef2014-09-30 13:26:51 -070047 service->SetProfile(nullptr);
Rebecca Silbersteinc9c31d82014-10-21 15:01:00 -070048 SLOG(this, 2) << "Removing service " << service->unique_name()
49 << " from ephemeral profile.";
Chris Masone6515aab2011-10-12 16:19:09 -070050 return true;
Chris Masone7aa5f902011-07-11 11:13:35 -070051}
52
Chris Masoneb9c00592011-10-06 13:10:39 -070053bool EphemeralProfile::Save() {
Chris Masone9d779932011-08-25 16:33:41 -070054 NOTREACHED();
55 return false;
56}
57
Chris Masone7aa5f902011-07-11 11:13:35 -070058} // namespace shill