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