Ben Chan | fad4a0b | 2012-04-18 15:49:59 -0700 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
Chris Masone | 7aa5f90 | 2011-07-11 11:13:35 -0700 | [diff] [blame] | 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 | |
Chris Masone | 7aa5f90 | 2011-07-11 11:13:35 -0700 | [diff] [blame] | 7 | #include <chromeos/dbus/service_constants.h> |
| 8 | |
| 9 | #include "shill/adaptor_interfaces.h" |
| 10 | #include "shill/control_interface.h" |
Christopher Wiley | b691efd | 2012-08-09 13:51:51 -0700 | [diff] [blame] | 11 | #include "shill/logging.h" |
Chris Masone | 7aa5f90 | 2011-07-11 11:13:35 -0700 | [diff] [blame] | 12 | #include "shill/manager.h" |
| 13 | |
Chris Masone | 7aa5f90 | 2011-07-11 11:13:35 -0700 | [diff] [blame] | 14 | namespace shill { |
| 15 | |
mukesh agrawal | 86a2259 | 2014-07-25 14:58:40 -0700 | [diff] [blame] | 16 | using std::string; |
| 17 | |
Rebecca Silberstein | c9c31d8 | 2014-10-21 15:01:00 -0700 | [diff] [blame] | 18 | namespace Logging { |
| 19 | static auto kModuleLogScope = ScopeLogger::kProfile; |
Paul Stewart | a794cd6 | 2015-06-16 13:13:10 -0700 | [diff] [blame] | 20 | static string ObjectID(EphemeralProfile* e) { return e->GetRpcIdentifier(); } |
Rebecca Silberstein | c9c31d8 | 2014-10-21 15:01:00 -0700 | [diff] [blame] | 21 | } |
| 22 | |
mukesh agrawal | 86a2259 | 2014-07-25 14:58:40 -0700 | [diff] [blame] | 23 | // static |
| 24 | const char EphemeralProfile::kFriendlyName[] = "(ephemeral)"; |
| 25 | |
Paul Stewart | a794cd6 | 2015-06-16 13:13:10 -0700 | [diff] [blame] | 26 | EphemeralProfile::EphemeralProfile(ControlInterface* control_interface, |
| 27 | Metrics* metrics, |
| 28 | Manager* manager) |
Thieu Le | 5133b71 | 2013-02-19 14:47:21 -0800 | [diff] [blame] | 29 | : Profile(control_interface, metrics, manager, Identifier(), "", false) { |
Chris Masone | 7aa5f90 | 2011-07-11 11:13:35 -0700 | [diff] [blame] | 30 | } |
| 31 | |
| 32 | EphemeralProfile::~EphemeralProfile() {} |
| 33 | |
mukesh agrawal | 86a2259 | 2014-07-25 14:58:40 -0700 | [diff] [blame] | 34 | string EphemeralProfile::GetFriendlyName() { |
| 35 | return kFriendlyName; |
| 36 | } |
| 37 | |
Paul Stewart | a794cd6 | 2015-06-16 13:13:10 -0700 | [diff] [blame] | 38 | bool EphemeralProfile::AdoptService(const ServiceRefPtr& service) { |
Rebecca Silberstein | c9c31d8 | 2014-10-21 15:01:00 -0700 | [diff] [blame] | 39 | SLOG(this, 2) << "Adding service " << service->unique_name() |
| 40 | << " to ephemeral profile."; |
Philipp Neubeck | 7917360 | 2012-11-13 21:10:09 +0100 | [diff] [blame] | 41 | service->SetProfile(this); |
Chris Masone | 6515aab | 2011-10-12 16:19:09 -0700 | [diff] [blame] | 42 | return true; |
| 43 | } |
| 44 | |
Paul Stewart | a794cd6 | 2015-06-16 13:13:10 -0700 | [diff] [blame] | 45 | bool EphemeralProfile::AbandonService(const ServiceRefPtr& service) { |
Chris Masone | 6515aab | 2011-10-12 16:19:09 -0700 | [diff] [blame] | 46 | if (service->profile() == this) |
Ben Chan | cc225ef | 2014-09-30 13:26:51 -0700 | [diff] [blame] | 47 | service->SetProfile(nullptr); |
Rebecca Silberstein | c9c31d8 | 2014-10-21 15:01:00 -0700 | [diff] [blame] | 48 | SLOG(this, 2) << "Removing service " << service->unique_name() |
| 49 | << " from ephemeral profile."; |
Chris Masone | 6515aab | 2011-10-12 16:19:09 -0700 | [diff] [blame] | 50 | return true; |
Chris Masone | 7aa5f90 | 2011-07-11 11:13:35 -0700 | [diff] [blame] | 51 | } |
| 52 | |
Chris Masone | b9c0059 | 2011-10-06 13:10:39 -0700 | [diff] [blame] | 53 | bool EphemeralProfile::Save() { |
Chris Masone | 9d77993 | 2011-08-25 16:33:41 -0700 | [diff] [blame] | 54 | NOTREACHED(); |
| 55 | return false; |
| 56 | } |
| 57 | |
Chris Masone | 7aa5f90 | 2011-07-11 11:13:35 -0700 | [diff] [blame] | 58 | } // namespace shill |