1 //
2 // Copyright (C) 2012 The Android Open Source Project
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #include "shill/ephemeral_profile.h"
18
19 #if defined(__ANDROID__)
20 #include <dbus/service_constants.h>
21 #else
22 #include <chromeos/dbus/service_constants.h>
23 #endif // __ANDROID__
24
25 #include "shill/adaptor_interfaces.h"
26 #include "shill/control_interface.h"
27 #include "shill/logging.h"
28 #include "shill/manager.h"
29
30 namespace shill {
31
32 using std::string;
33
34 namespace Logging {
35 static auto kModuleLogScope = ScopeLogger::kProfile;
ObjectID(EphemeralProfile * e)36 static string ObjectID(EphemeralProfile* e) { return e->GetRpcIdentifier(); }
37 }
38
39 // static
40 const char EphemeralProfile::kFriendlyName[] = "(ephemeral)";
41
EphemeralProfile(ControlInterface * control_interface,Metrics * metrics,Manager * manager)42 EphemeralProfile::EphemeralProfile(ControlInterface* control_interface,
43 Metrics* metrics,
44 Manager* manager)
45 : Profile(control_interface, metrics, manager, Identifier(),
46 base::FilePath(), false) {
47 }
48
~EphemeralProfile()49 EphemeralProfile::~EphemeralProfile() {}
50
GetFriendlyName()51 string EphemeralProfile::GetFriendlyName() {
52 return kFriendlyName;
53 }
54
AdoptService(const ServiceRefPtr & service)55 bool EphemeralProfile::AdoptService(const ServiceRefPtr& service) {
56 SLOG(this, 2) << "Adding service " << service->unique_name()
57 << " to ephemeral profile.";
58 service->SetProfile(this);
59 return true;
60 }
61
AbandonService(const ServiceRefPtr & service)62 bool EphemeralProfile::AbandonService(const ServiceRefPtr& service) {
63 if (service->profile() == this)
64 service->SetProfile(nullptr);
65 SLOG(this, 2) << "Removing service " << service->unique_name()
66 << " from ephemeral profile.";
67 return true;
68 }
69
Save()70 bool EphemeralProfile::Save() {
71 NOTREACHED();
72 return false;
73 }
74
75 } // namespace shill
76