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 | |
| 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" |
Christopher Wiley | b691efd | 2012-08-09 13:51:51 -0700 | [diff] [blame^] | 14 | #include "shill/logging.h" |
Chris Masone | 7aa5f90 | 2011-07-11 11:13:35 -0700 | [diff] [blame] | 15 | #include "shill/manager.h" |
| 16 | |
| 17 | using std::map; |
| 18 | using std::string; |
| 19 | |
| 20 | namespace shill { |
| 21 | |
| 22 | EphemeralProfile::EphemeralProfile(ControlInterface *control_interface, |
Chris Masone | 7aa5f90 | 2011-07-11 11:13:35 -0700 | [diff] [blame] | 23 | Manager *manager) |
Chris Masone | 9d77993 | 2011-08-25 16:33:41 -0700 | [diff] [blame] | 24 | : Profile(control_interface, manager, Identifier(), "", false) { |
Chris Masone | 7aa5f90 | 2011-07-11 11:13:35 -0700 | [diff] [blame] | 25 | } |
| 26 | |
| 27 | EphemeralProfile::~EphemeralProfile() {} |
| 28 | |
Chris Masone | 6515aab | 2011-10-12 16:19:09 -0700 | [diff] [blame] | 29 | bool EphemeralProfile::AdoptService(const ServiceRefPtr &service) { |
Ben Chan | fad4a0b | 2012-04-18 15:49:59 -0700 | [diff] [blame] | 30 | SLOG(Profile, 2) << "Adding " << service->UniqueName() |
| 31 | << " to ephemeral profile."; |
Chris Masone | 6515aab | 2011-10-12 16:19:09 -0700 | [diff] [blame] | 32 | service->set_profile(this); |
| 33 | return true; |
| 34 | } |
| 35 | |
| 36 | bool EphemeralProfile::AbandonService(const ServiceRefPtr &service) { |
| 37 | if (service->profile() == this) |
| 38 | service->set_profile(NULL); |
Ben Chan | fad4a0b | 2012-04-18 15:49:59 -0700 | [diff] [blame] | 39 | SLOG(Profile, 2) << "Removing " << service->UniqueName() |
| 40 | << " from ephemeral profile."; |
Chris Masone | 6515aab | 2011-10-12 16:19:09 -0700 | [diff] [blame] | 41 | return true; |
Chris Masone | 7aa5f90 | 2011-07-11 11:13:35 -0700 | [diff] [blame] | 42 | } |
| 43 | |
Chris Masone | b9c0059 | 2011-10-06 13:10:39 -0700 | [diff] [blame] | 44 | bool EphemeralProfile::Save() { |
Chris Masone | 9d77993 | 2011-08-25 16:33:41 -0700 | [diff] [blame] | 45 | NOTREACHED(); |
| 46 | return false; |
| 47 | } |
| 48 | |
Chris Masone | 7aa5f90 | 2011-07-11 11:13:35 -0700 | [diff] [blame] | 49 | } // namespace shill |