Darin Petkov | e7c6ad3 | 2012-06-29 10:22:09 +0200 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
Chris Masone | 52cd19b | 2011-06-29 17:23:04 -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/profile.h" |
| 6 | |
Chris Masone | 6515aab | 2011-10-12 16:19:09 -0700 | [diff] [blame] | 7 | #include <set> |
Chris Masone | 52cd19b | 2011-06-29 17:23:04 -0700 | [diff] [blame] | 8 | #include <string> |
Chris Masone | 6791a43 | 2011-07-12 13:23:19 -0700 | [diff] [blame] | 9 | #include <vector> |
Chris Masone | 52cd19b | 2011-06-29 17:23:04 -0700 | [diff] [blame] | 10 | |
Chris Masone | b9c0059 | 2011-10-06 13:10:39 -0700 | [diff] [blame] | 11 | #include <base/file_path.h> |
Paul Stewart | e73d05c | 2012-03-29 16:26:05 -0700 | [diff] [blame] | 12 | #include <base/file_util.h> |
Eric Shienbrood | 3e20a23 | 2012-02-16 11:35:56 -0500 | [diff] [blame] | 13 | #include <base/stl_util.h> |
Darin Petkov | a476682 | 2011-07-07 10:42:22 -0700 | [diff] [blame] | 14 | #include <base/string_util.h> |
Chris Masone | 6791a43 | 2011-07-12 13:23:19 -0700 | [diff] [blame] | 15 | #include <base/stringprintf.h> |
Chris Masone | 88cbd5f | 2011-07-03 14:30:04 -0700 | [diff] [blame] | 16 | #include <chromeos/dbus/service_constants.h> |
Chris Masone | 52cd19b | 2011-06-29 17:23:04 -0700 | [diff] [blame] | 17 | |
| 18 | #include "shill/adaptor_interfaces.h" |
| 19 | #include "shill/control_interface.h" |
Chris Masone | b9c0059 | 2011-10-06 13:10:39 -0700 | [diff] [blame] | 20 | #include "shill/key_file_store.h" |
Christopher Wiley | b691efd | 2012-08-09 13:51:51 -0700 | [diff] [blame] | 21 | #include "shill/logging.h" |
Chris Masone | 6791a43 | 2011-07-12 13:23:19 -0700 | [diff] [blame] | 22 | #include "shill/manager.h" |
Chris Masone | 52cd19b | 2011-06-29 17:23:04 -0700 | [diff] [blame] | 23 | #include "shill/property_accessor.h" |
Chris Masone | 7aa5f90 | 2011-07-11 11:13:35 -0700 | [diff] [blame] | 24 | #include "shill/service.h" |
Chris Masone | 9d77993 | 2011-08-25 16:33:41 -0700 | [diff] [blame] | 25 | #include "shill/store_interface.h" |
Chris Masone | 52cd19b | 2011-06-29 17:23:04 -0700 | [diff] [blame] | 26 | |
Chris Masone | 6515aab | 2011-10-12 16:19:09 -0700 | [diff] [blame] | 27 | using std::set; |
Chris Masone | 52cd19b | 2011-06-29 17:23:04 -0700 | [diff] [blame] | 28 | using std::string; |
Chris Masone | 6791a43 | 2011-07-12 13:23:19 -0700 | [diff] [blame] | 29 | using std::vector; |
Chris Masone | 52cd19b | 2011-06-29 17:23:04 -0700 | [diff] [blame] | 30 | |
| 31 | namespace shill { |
Darin Petkov | a476682 | 2011-07-07 10:42:22 -0700 | [diff] [blame] | 32 | |
Darin Petkov | a476682 | 2011-07-07 10:42:22 -0700 | [diff] [blame] | 33 | Profile::Profile(ControlInterface *control_interface, |
Thieu Le | 5133b71 | 2013-02-19 14:47:21 -0800 | [diff] [blame^] | 34 | Metrics *metrics, |
Chris Masone | 7df0c67 | 2011-07-15 10:24:54 -0700 | [diff] [blame] | 35 | Manager *manager, |
| 36 | const Identifier &name, |
Chris Masone | 2ae797d | 2011-08-23 20:41:00 -0700 | [diff] [blame] | 37 | const string &user_storage_format, |
Chris Masone | 7df0c67 | 2011-07-15 10:24:54 -0700 | [diff] [blame] | 38 | bool connect_to_rpc) |
Thieu Le | 5133b71 | 2013-02-19 14:47:21 -0800 | [diff] [blame^] | 39 | : metrics_(metrics), |
| 40 | manager_(manager), |
Chris Masone | 7df0c67 | 2011-07-15 10:24:54 -0700 | [diff] [blame] | 41 | name_(name), |
Chris Masone | 2ae797d | 2011-08-23 20:41:00 -0700 | [diff] [blame] | 42 | storage_format_(user_storage_format) { |
Chris Masone | 7df0c67 | 2011-07-15 10:24:54 -0700 | [diff] [blame] | 43 | if (connect_to_rpc) |
| 44 | adaptor_.reset(control_interface->CreateProfileAdaptor(this)); |
| 45 | |
Chris Masone | 88cbd5f | 2011-07-03 14:30:04 -0700 | [diff] [blame] | 46 | // flimflam::kCheckPortalListProperty: Registered in DefaultProfile |
| 47 | // flimflam::kCountryProperty: Registered in DefaultProfile |
Chris Masone | 7df0c67 | 2011-07-15 10:24:54 -0700 | [diff] [blame] | 48 | store_.RegisterConstString(flimflam::kNameProperty, &name_.identifier); |
Chris Masone | 88cbd5f | 2011-07-03 14:30:04 -0700 | [diff] [blame] | 49 | |
| 50 | // flimflam::kOfflineModeProperty: Registered in DefaultProfile |
| 51 | // flimflam::kPortalURLProperty: Registered in DefaultProfile |
| 52 | |
Chris Masone | 6791a43 | 2011-07-12 13:23:19 -0700 | [diff] [blame] | 53 | HelpRegisterDerivedStrings(flimflam::kServicesProperty, |
| 54 | &Profile::EnumerateAvailableServices, |
| 55 | NULL); |
Chris Masone | 7df0c67 | 2011-07-15 10:24:54 -0700 | [diff] [blame] | 56 | HelpRegisterDerivedStrings(flimflam::kEntriesProperty, |
| 57 | &Profile::EnumerateEntries, |
| 58 | NULL); |
Chris Masone | 52cd19b | 2011-06-29 17:23:04 -0700 | [diff] [blame] | 59 | } |
| 60 | |
Chris Masone | 6515aab | 2011-10-12 16:19:09 -0700 | [diff] [blame] | 61 | Profile::~Profile() {} |
Chris Masone | 52cd19b | 2011-06-29 17:23:04 -0700 | [diff] [blame] | 62 | |
Paul Stewart | 5dc40aa | 2011-10-28 19:43:43 -0700 | [diff] [blame] | 63 | bool Profile::InitStorage(GLib *glib, InitStorageOption storage_option, |
| 64 | Error *error) { |
Chris Masone | b9c0059 | 2011-10-06 13:10:39 -0700 | [diff] [blame] | 65 | FilePath final_path; |
| 66 | if (!GetStoragePath(&final_path)) { |
Paul Stewart | be00517 | 2011-11-02 18:10:29 -0700 | [diff] [blame] | 67 | Error::PopulateAndLog(error, Error::kInvalidArguments, |
Chris Masone | b9c0059 | 2011-10-06 13:10:39 -0700 | [diff] [blame] | 68 | base::StringPrintf("Could not set up profile storage for %s:%s", |
Paul Stewart | be00517 | 2011-11-02 18:10:29 -0700 | [diff] [blame] | 69 | name_.user.c_str(), name_.identifier.c_str())); |
Chris Masone | b9c0059 | 2011-10-06 13:10:39 -0700 | [diff] [blame] | 70 | return false; |
| 71 | } |
| 72 | scoped_ptr<KeyFileStore> storage(new KeyFileStore(glib)); |
| 73 | storage->set_path(final_path); |
Paul Stewart | 5dc40aa | 2011-10-28 19:43:43 -0700 | [diff] [blame] | 74 | bool already_exists = storage->IsNonEmpty(); |
| 75 | if (!already_exists && storage_option != kCreateNew && |
| 76 | storage_option != kCreateOrOpenExisting) { |
Paul Stewart | be00517 | 2011-11-02 18:10:29 -0700 | [diff] [blame] | 77 | Error::PopulateAndLog(error, Error::kNotFound, |
Paul Stewart | 5dc40aa | 2011-10-28 19:43:43 -0700 | [diff] [blame] | 78 | base::StringPrintf("Profile storage for %s:%s does not already exist", |
Paul Stewart | be00517 | 2011-11-02 18:10:29 -0700 | [diff] [blame] | 79 | name_.user.c_str(), name_.identifier.c_str())); |
Paul Stewart | 5dc40aa | 2011-10-28 19:43:43 -0700 | [diff] [blame] | 80 | return false; |
| 81 | } else if (already_exists && storage_option != kOpenExisting && |
| 82 | storage_option != kCreateOrOpenExisting) { |
Paul Stewart | be00517 | 2011-11-02 18:10:29 -0700 | [diff] [blame] | 83 | Error::PopulateAndLog(error, Error::kAlreadyExists, |
Paul Stewart | 5dc40aa | 2011-10-28 19:43:43 -0700 | [diff] [blame] | 84 | base::StringPrintf("Profile storage for %s:%s already exists", |
Paul Stewart | be00517 | 2011-11-02 18:10:29 -0700 | [diff] [blame] | 85 | name_.user.c_str(), name_.identifier.c_str())); |
Paul Stewart | 5dc40aa | 2011-10-28 19:43:43 -0700 | [diff] [blame] | 86 | return false; |
| 87 | } |
Chris Masone | b9c0059 | 2011-10-06 13:10:39 -0700 | [diff] [blame] | 88 | if (!storage->Open()) { |
Paul Stewart | be00517 | 2011-11-02 18:10:29 -0700 | [diff] [blame] | 89 | Error::PopulateAndLog(error, Error::kInternalError, |
Chris Masone | b9c0059 | 2011-10-06 13:10:39 -0700 | [diff] [blame] | 90 | base::StringPrintf("Could not open profile storage for %s:%s", |
Paul Stewart | be00517 | 2011-11-02 18:10:29 -0700 | [diff] [blame] | 91 | name_.user.c_str(), name_.identifier.c_str())); |
Paul Stewart | 2ebc16d | 2012-08-23 10:38:39 -0700 | [diff] [blame] | 92 | if (already_exists) { |
| 93 | // The profile contents is corrupt, or we do not have access to |
| 94 | // this file. Move this file out of the way so a future open attempt |
| 95 | // will succeed, assuming the failure reason was the former. |
| 96 | storage->MarkAsCorrupted(); |
Thieu Le | 5133b71 | 2013-02-19 14:47:21 -0800 | [diff] [blame^] | 97 | metrics_->NotifyCorruptedProfile(); |
Paul Stewart | 2ebc16d | 2012-08-23 10:38:39 -0700 | [diff] [blame] | 98 | } |
Chris Masone | b9c0059 | 2011-10-06 13:10:39 -0700 | [diff] [blame] | 99 | return false; |
| 100 | } |
Paul Stewart | 5dc40aa | 2011-10-28 19:43:43 -0700 | [diff] [blame] | 101 | if (!already_exists) { |
| 102 | // Add a descriptive header to the profile so even if nothing is stored |
| 103 | // to it, it still has some content. Completely empty keyfiles are not |
| 104 | // valid for reading. |
| 105 | storage->SetHeader( |
| 106 | base::StringPrintf("Profile %s:%s", name_.user.c_str(), |
| 107 | name_.identifier.c_str())); |
| 108 | } |
Chris Masone | b9c0059 | 2011-10-06 13:10:39 -0700 | [diff] [blame] | 109 | set_storage(storage.release()); |
Paul Stewart | 3c50401 | 2013-01-17 17:49:58 -0800 | [diff] [blame] | 110 | manager_->OnProfileStorageInitialized(storage_.get()); |
Chris Masone | b9c0059 | 2011-10-06 13:10:39 -0700 | [diff] [blame] | 111 | return true; |
| 112 | } |
| 113 | |
Paul Stewart | e73d05c | 2012-03-29 16:26:05 -0700 | [diff] [blame] | 114 | bool Profile::RemoveStorage(GLib *glib, Error *error) { |
| 115 | FilePath path; |
| 116 | |
| 117 | CHECK(!storage_.get()); |
| 118 | |
| 119 | if (!GetStoragePath(&path)) { |
| 120 | Error::PopulateAndLog( |
| 121 | error, Error::kInvalidArguments, |
| 122 | base::StringPrintf("Could get the storage path for %s:%s", |
| 123 | name_.user.c_str(), name_.identifier.c_str())); |
| 124 | return false; |
| 125 | } |
| 126 | |
| 127 | if (!file_util::Delete(path, false)) { |
| 128 | Error::PopulateAndLog( |
| 129 | error, Error::kOperationFailed, |
| 130 | base::StringPrintf("Could not remove path %s", path.value().c_str())); |
| 131 | return false; |
| 132 | } |
| 133 | |
| 134 | return true; |
| 135 | } |
| 136 | |
Chris Masone | 7df0c67 | 2011-07-15 10:24:54 -0700 | [diff] [blame] | 137 | string Profile::GetFriendlyName() { |
| 138 | return (name_.user.empty() ? "" : name_.user + "/") + name_.identifier; |
| 139 | } |
| 140 | |
| 141 | string Profile::GetRpcIdentifier() { |
Paul Stewart | 19c871d | 2011-12-15 16:10:13 -0800 | [diff] [blame] | 142 | if (!adaptor_.get()) { |
| 143 | // NB: This condition happens in unit tests. |
| 144 | return string(); |
| 145 | } |
Chris Masone | 7df0c67 | 2011-07-15 10:24:54 -0700 | [diff] [blame] | 146 | return adaptor_->GetRpcIdentifier(); |
| 147 | } |
| 148 | |
Chris Masone | b9c0059 | 2011-10-06 13:10:39 -0700 | [diff] [blame] | 149 | void Profile::set_storage(StoreInterface *storage) { |
| 150 | storage_.reset(storage); |
| 151 | } |
| 152 | |
Chris Masone | 6791a43 | 2011-07-12 13:23:19 -0700 | [diff] [blame] | 153 | bool Profile::AdoptService(const ServiceRefPtr &service) { |
Paul Stewart | 451aa7f | 2012-04-11 19:07:58 -0700 | [diff] [blame] | 154 | if (service->profile() == this) { |
Chris Masone | 6791a43 | 2011-07-12 13:23:19 -0700 | [diff] [blame] | 155 | return false; |
Paul Stewart | 451aa7f | 2012-04-11 19:07:58 -0700 | [diff] [blame] | 156 | } |
Philipp Neubeck | 7917360 | 2012-11-13 21:10:09 +0100 | [diff] [blame] | 157 | service->SetProfile(this); |
Chris Masone | 6515aab | 2011-10-12 16:19:09 -0700 | [diff] [blame] | 158 | return service->Save(storage_.get()) && storage_->Flush(); |
Chris Masone | 6791a43 | 2011-07-12 13:23:19 -0700 | [diff] [blame] | 159 | } |
| 160 | |
Chris Masone | 6515aab | 2011-10-12 16:19:09 -0700 | [diff] [blame] | 161 | bool Profile::AbandonService(const ServiceRefPtr &service) { |
| 162 | if (service->profile() == this) |
Philipp Neubeck | 7917360 | 2012-11-13 21:10:09 +0100 | [diff] [blame] | 163 | service->SetProfile(NULL); |
Chris Masone | 6515aab | 2011-10-12 16:19:09 -0700 | [diff] [blame] | 164 | return storage_->DeleteGroup(service->GetStorageIdentifier()) && |
| 165 | storage_->Flush(); |
Chris Masone | 6791a43 | 2011-07-12 13:23:19 -0700 | [diff] [blame] | 166 | } |
| 167 | |
Chris Masone | 6515aab | 2011-10-12 16:19:09 -0700 | [diff] [blame] | 168 | bool Profile::UpdateService(const ServiceRefPtr &service) { |
| 169 | return service->Save(storage_.get()) && storage_->Flush(); |
Chris Masone | 6791a43 | 2011-07-12 13:23:19 -0700 | [diff] [blame] | 170 | } |
| 171 | |
Paul Stewart | 2c575d2 | 2012-12-07 12:28:57 -0800 | [diff] [blame] | 172 | bool Profile::LoadService(const ServiceRefPtr &service) { |
Paul Stewart | bba6a5b | 2011-11-02 18:45:59 -0700 | [diff] [blame] | 173 | if (!ContainsService(service)) |
Chris Masone | 6515aab | 2011-10-12 16:19:09 -0700 | [diff] [blame] | 174 | return false; |
Chris Masone | 6515aab | 2011-10-12 16:19:09 -0700 | [diff] [blame] | 175 | return service->Load(storage_.get()); |
Chris Masone | 6791a43 | 2011-07-12 13:23:19 -0700 | [diff] [blame] | 176 | } |
| 177 | |
Paul Stewart | 2c575d2 | 2012-12-07 12:28:57 -0800 | [diff] [blame] | 178 | bool Profile::ConfigureService(const ServiceRefPtr &service) { |
| 179 | if (!LoadService(service)) |
| 180 | return false; |
| 181 | service->SetProfile(this); |
| 182 | return true; |
| 183 | } |
| 184 | |
Paul Stewart | a41e38d | 2011-11-11 07:47:29 -0800 | [diff] [blame] | 185 | bool Profile::ConfigureDevice(const DeviceRefPtr &device) { |
| 186 | return device->Load(storage_.get()); |
| 187 | } |
| 188 | |
Chris Masone | 6515aab | 2011-10-12 16:19:09 -0700 | [diff] [blame] | 189 | bool Profile::ContainsService(const ServiceConstRefPtr &service) { |
Paul Stewart | bba6a5b | 2011-11-02 18:45:59 -0700 | [diff] [blame] | 190 | return service->IsLoadableFrom(storage_.get()); |
Chris Masone | 7aa5f90 | 2011-07-11 11:13:35 -0700 | [diff] [blame] | 191 | } |
| 192 | |
Paul Stewart | 7522551 | 2012-01-26 22:51:33 -0800 | [diff] [blame] | 193 | void Profile::DeleteEntry(const std::string &entry_name, Error *error) { |
| 194 | if (!storage_->ContainsGroup(entry_name)) { |
| 195 | Error::PopulateAndLog(error, Error::kNotFound, |
| 196 | base::StringPrintf("Entry %s does not exist in profile", |
| 197 | entry_name.c_str())); |
| 198 | return; |
| 199 | } |
| 200 | if (!manager_->HandleProfileEntryDeletion(this, entry_name)) { |
| 201 | // If HandleProfileEntryDeletion() returns succeeds, DeleteGroup() |
| 202 | // has already been called when AbandonService was called. |
| 203 | // Otherwise, we need to delete the group ourselves. |
| 204 | storage_->DeleteGroup(entry_name); |
| 205 | } |
Paul Stewart | 0756db9 | 2012-01-27 08:34:47 -0800 | [diff] [blame] | 206 | Save(); |
| 207 | } |
| 208 | |
| 209 | ServiceRefPtr Profile::GetServiceFromEntry(const std::string &entry_name, |
| 210 | Error *error) { |
| 211 | return manager_->GetServiceWithStorageIdentifier(this, entry_name, error); |
Paul Stewart | 7522551 | 2012-01-26 22:51:33 -0800 | [diff] [blame] | 212 | } |
| 213 | |
Paul Stewart | a41e38d | 2011-11-11 07:47:29 -0800 | [diff] [blame] | 214 | bool Profile::IsValidIdentifierToken(const string &token) { |
Darin Petkov | a476682 | 2011-07-07 10:42:22 -0700 | [diff] [blame] | 215 | if (token.empty()) { |
| 216 | return false; |
| 217 | } |
| 218 | for (string::const_iterator it = token.begin(); it != token.end(); ++it) { |
| 219 | if (!IsAsciiAlpha(*it) && !IsAsciiDigit(*it)) { |
| 220 | return false; |
| 221 | } |
| 222 | } |
| 223 | return true; |
| 224 | } |
| 225 | |
| 226 | bool Profile::ParseIdentifier(const string &raw, Identifier *parsed) { |
| 227 | if (raw.empty()) { |
| 228 | return false; |
| 229 | } |
| 230 | if (raw[0] == '~') { |
| 231 | // Format: "~user/identifier". |
| 232 | size_t slash = raw.find('/'); |
| 233 | if (slash == string::npos) { |
| 234 | return false; |
| 235 | } |
| 236 | string user(raw.begin() + 1, raw.begin() + slash); |
| 237 | string identifier(raw.begin() + slash + 1, raw.end()); |
| 238 | if (!IsValidIdentifierToken(user) || !IsValidIdentifierToken(identifier)) { |
| 239 | return false; |
| 240 | } |
| 241 | parsed->user = user; |
| 242 | parsed->identifier = identifier; |
| 243 | return true; |
| 244 | } |
| 245 | |
| 246 | // Format: "identifier". |
| 247 | if (!IsValidIdentifierToken(raw)) { |
| 248 | return false; |
| 249 | } |
| 250 | parsed->user = ""; |
| 251 | parsed->identifier = raw; |
| 252 | return true; |
| 253 | } |
| 254 | |
Paul Stewart | 5dc40aa | 2011-10-28 19:43:43 -0700 | [diff] [blame] | 255 | bool Profile::MatchesIdentifier(const Identifier &name) const { |
| 256 | return name.user == name_.user && name.identifier == name_.identifier; |
| 257 | } |
| 258 | |
Chris Masone | b9c0059 | 2011-10-06 13:10:39 -0700 | [diff] [blame] | 259 | bool Profile::Save() { |
Chris Masone | 6515aab | 2011-10-12 16:19:09 -0700 | [diff] [blame] | 260 | return storage_->Flush(); |
Chris Masone | 9d77993 | 2011-08-25 16:33:41 -0700 | [diff] [blame] | 261 | } |
| 262 | |
Chris Masone | 2ae797d | 2011-08-23 20:41:00 -0700 | [diff] [blame] | 263 | bool Profile::GetStoragePath(FilePath *path) { |
| 264 | if (name_.user.empty()) { |
| 265 | LOG(ERROR) << "Non-default profiles cannot be stored globally."; |
| 266 | return false; |
| 267 | } |
| 268 | FilePath dir(base::StringPrintf(storage_format_.c_str(), name_.user.c_str())); |
Darin Petkov | a476682 | 2011-07-07 10:42:22 -0700 | [diff] [blame] | 269 | // TODO(petkov): Validate the directory permissions, etc. |
| 270 | *path = dir.Append(base::StringPrintf("%s.profile", |
Chris Masone | 2ae797d | 2011-08-23 20:41:00 -0700 | [diff] [blame] | 271 | name_.identifier.c_str())); |
Darin Petkov | a476682 | 2011-07-07 10:42:22 -0700 | [diff] [blame] | 272 | return true; |
| 273 | } |
| 274 | |
Gaurav Shah | 1b7a616 | 2011-11-09 11:41:01 -0800 | [diff] [blame] | 275 | vector<string> Profile::EnumerateAvailableServices(Error *error) { |
Paul Stewart | 1b25314 | 2012-01-26 14:05:52 -0800 | [diff] [blame] | 276 | // We should return the Manager's service list if this is the active profile. |
| 277 | if (manager_->IsActiveProfile(this)) { |
| 278 | return manager_->EnumerateAvailableServices(error); |
| 279 | } else { |
| 280 | return vector<string>(); |
| 281 | } |
Chris Masone | 6791a43 | 2011-07-12 13:23:19 -0700 | [diff] [blame] | 282 | } |
| 283 | |
Gaurav Shah | 1b7a616 | 2011-11-09 11:41:01 -0800 | [diff] [blame] | 284 | vector<string> Profile::EnumerateEntries(Error */*error*/) { |
Chris Masone | 6515aab | 2011-10-12 16:19:09 -0700 | [diff] [blame] | 285 | set<string> groups(storage_->GetGroups()); |
Paul Stewart | 1b25314 | 2012-01-26 14:05:52 -0800 | [diff] [blame] | 286 | vector<string> service_groups; |
| 287 | |
| 288 | // Filter this list down to only entries that correspond |
| 289 | // to a technology. (wifi_*, etc) |
| 290 | for (set<string>::iterator it = groups.begin(); |
| 291 | it != groups.end(); ++it) { |
| 292 | if (Technology::IdentifierFromStorageGroup(*it) != Technology::kUnknown) |
| 293 | service_groups.push_back(*it); |
| 294 | } |
| 295 | |
| 296 | return service_groups; |
Chris Masone | 6791a43 | 2011-07-12 13:23:19 -0700 | [diff] [blame] | 297 | } |
| 298 | |
Darin Petkov | e7c6ad3 | 2012-06-29 10:22:09 +0200 | [diff] [blame] | 299 | bool Profile::UpdateDevice(const DeviceRefPtr &device) { |
| 300 | return false; |
| 301 | } |
| 302 | |
mukesh agrawal | ffa3d04 | 2011-10-06 15:26:10 -0700 | [diff] [blame] | 303 | void Profile::HelpRegisterDerivedStrings( |
| 304 | const string &name, |
Gaurav Shah | 1b7a616 | 2011-11-09 11:41:01 -0800 | [diff] [blame] | 305 | Strings(Profile::*get)(Error *), |
mukesh agrawal | ffa3d04 | 2011-10-06 15:26:10 -0700 | [diff] [blame] | 306 | void(Profile::*set)(const Strings&, Error *)) { |
Chris Masone | 6791a43 | 2011-07-12 13:23:19 -0700 | [diff] [blame] | 307 | store_.RegisterDerivedStrings( |
| 308 | name, |
| 309 | StringsAccessor(new CustomAccessor<Profile, Strings>(this, get, set))); |
| 310 | } |
| 311 | |
Chris Masone | 52cd19b | 2011-06-29 17:23:04 -0700 | [diff] [blame] | 312 | } // namespace shill |