Home | History | Annotate | Download | only in shill

Lines Matching refs:Profile

57 #include "shill/profile.h"
134 user_profile_list_path_(FilePath(Profile::kUserProfileListPathname)),
299 // Persist profile, service information to disk.
300 for (const auto& profile : profiles_) {
304 profile->Save();
330 DCHECK(profiles_.empty()); // The default profile must go first on stack.
333 // Ensure that we have storage for the default profile, and that
334 // the persistent copy of the default profile is not corrupt.
342 // The default profile may fail to initialize if it's corrupted.
343 // If so, recreate the default profile.
344 if (!default_profile->InitStorage(Profile::kCreateOrOpenExisting, nullptr))
345 CHECK(default_profile->InitStorage(Profile::kCreateNew, nullptr));
346 // In case we created a new profile, initialize its default values,
354 // default profile, because modifying the profile stack updates the
355 // user profile list.
356 vector<Profile::Identifier> identifiers =
357 Profile::LoadUserProfileList(user_profile_list_path_);
359 // Push the default profile onto the stack.
362 Profile::Identifier default_profile_id;
363 CHECK(Profile::ParseIdentifier(
366 CHECK(!profiles_.empty()); // Must have a default profile.
376 Profile::Identifier ident;
377 if (!Profile::ParseIdentifier(name, &ident)) {
379 "Invalid profile name " + name);
385 "Profile name " + name + " is already on stack");
389 ProfileRefPtr profile;
391 profile = new DefaultProfile(control_interface_,
398 profile = new Profile(control_interface_,
406 if (!profile->InitStorage(Profile::kCreateNew, error)) {
411 // Save profile data out, and then let the scoped pointer fall out of scope.
412 if (!profile->Save()) {
414 "Profile name " + name + " could not be saved");
418 *path = profile->GetRpcIdentifier();
421 bool Manager::HasProfile(const Profile::Identifier& ident) {
422 for (const auto& profile : profiles_) {
423 if (profile->MatchesIdentifier(ident)) {
431 const Profile::Identifier& ident, string* path, Error* error) {
434 "Profile name " + Profile::IdentifierToString(ident) +
439 ProfileRefPtr profile;
441 // Allow a machine-wide-profile to be pushed on the stack only if the
442 // profile stack is empty, or if the topmost profile
443 // also a machine-wide (non-user) profile.
446 "Cannot load non-default global profile " +
447 Profile::IdentifierToString(ident) +
448 " on top of a user profile");
459 if (!default_profile->InitStorage(Profile::kOpenExisting, nullptr)) {
460 LOG(ERROR) << "Failed to open default profile.";
467 profile = default_profile;
469 profile = new Profile(control_interface_,
475 if (!profile->InitStorage(Profile::kOpenExisting, error)) {
481 profiles_.push_back(profile);
486 // Offer each registered Service the opportunity to join this new Profile.
487 if (profile->ConfigureService(service)) {
489 << " from new profile.";
493 // Shop the Profile contents around to Devices which may have configuration
496 profile->ConfigureDevice(device);
499 // Offer the Profile contents to the service providers which will
502 provider_mapping.second->CreateServicesFromProfile(profile);
505 *path = profile->GetRpcIdentifier();
509 << " profile(s) now present.";
514 Profile::Identifier ident;
515 if (!Profile::ParseIdentifier(name, &ident)) {
517 "Invalid profile name " + name);
528 Profile::Identifier ident;
529 if (!Profile::ParseIdentifier(name, &ident) ||
532 "Invalid user profile name " + name);
552 if ((*it)->profile().get() != active_profile.get()) {
554 << ": wasn't using this profile.";
561 << ": re-configured from another profile.";
579 << " profile(s) still present.";
587 Profile::SaveUserProfileList(user_profile_list_path_, profiles_);
592 Profile::Identifier ident;
595 FROM_HERE, error, Error::kNotFound, "Profile stack is empty");
599 if (!Profile::ParseIdentifier(name, &ident)) {
601 "Invalid profile name " + name);
606 name + " is not the active profile");
614 Profile::Identifier ident;
617 FROM_HERE, error, Error::kNotFound, "Profile stack is empty");
631 Profile::Identifier ident;
632 if (!Profile::ParseIdentifier(name, &ident)) {
634 "Invalid profile name " + name);
640 "Cannot remove profile name " + name +
645 ProfileRefPtr profile;
647 profile = new DefaultProfile(control_interface_,
654 profile = new Profile(control_interface_,
664 profile->RemoveStorage(error);
817 service->profile()->AbandonService(service);
819 // We found another profile to adopt the service; no need to unload.
832 bool Manager::HandleProfileEntryDeletion(const ProfileRefPtr& profile,
836 if ((*it)->profile().get() == profile.get() &&
838 profile->AbandonService(*it);
857 for (const auto& profile : profiles_) {
859 *profile->GetConstStorage());
861 profile_entries[profile->GetRpcIdentifier()] = entry_name;
868 const ProfileRefPtr& profile, const std::string& entry_name, Error* error) {
870 if (service->profile().get() == profile.get() &&
882 const ProfileRefPtr& profile, const std::string& entry_name, Error* error) {
905 profile, entry_name, error);
914 profile->LoadService(service);
977 for (const auto& profile : profiles_) {
978 if (profile == a) {
981 if (profile == b) {
990 return service->profile() == ephemeral_profile_;
1008 void Manager::OnProfileStorageInitialized(Profile* profile) {
1010 wifi_provider_->LoadAndFixupServiceEntries(profile);
1042 bool Manager::IsActiveProfile(const ProfileRefPtr& profile) const {
1044 ActiveProfile().get() == profile.get());
1049 const ProfileRefPtr from = to_move->profile();
1052 << " to profile "
1061 for (const auto& profile : profiles_) {
1062 if (profile_rpcid == profile->GetRpcIdentifier()) {
1063 return profile;
1072 ProfileRefPtr profile = LookupProfileByRpcIdentifier(profile_rpcid);
1073 if (!profile) {
1075 StringPrintf("Unknown Profile %s requested for "
1080 if (!to_set->profile()) {
1081 // We are being asked to set the profile property of a service that
1086 if (to_set->profile().get() == profile.get()) {
1088 "Service is already connected to this profile");
1089 } else if (!MoveServiceToProfile(to_set, profile)) {
1091 "Unable to move service to profile");
1299 for (const auto& profile : profiles_) {
1301 profile->ConfigureDevice(device);
1447 // Persists the updated auto_connect setting in the profile.
1456 // Saves the device to the topmost profile that accepts it (ordinary
1458 // updating profile would be the DefaultProfile at the bottom of the stack.
1470 // Saves |wifi_provider_| to the topmost profile that accepts it (ordinary
1472 // updating profile would be the DefaultProfile at the bottom of the stack.
1486 LOG(ERROR) << "Cannot assign profile to service: no profiles exist!";
1491 to_update->profile()->UpdateService(to_update);
1495 void Manager::LoadProperties(const scoped_refptr<DefaultProfile>& profile) {
1496 profile->LoadManagerProperties(&props_, dhcp_properties_.get());
1943 << " Profile: " << service->profile()->GetFriendlyName()
2043 << " Profile: " << service->profile()->GetFriendlyName()
2187 for (const auto& profile : profiles_) {
2188 profile_rpc_ids.push_back(profile->GetRpcIdentifier());
2311 ProfileRefPtr profile = ActiveProfile();
2315 profile
2316 if (!profile) {
2318 "Invalid profile name " + profile_rpcid);
2330 if (service->profile() == profile) {
2332 << " is already a member of profile "
2333 << profile->GetFriendlyName()
2335 } else if (profile->LoadService(service)) {
2336 SLOG(this, 2) << __func__ << ": applied stored information from profile "
2337 << profile->GetFriendlyName()
2341 SLOG(this, 2) << __func__ << ": no previous information in profile "
2342 << profile->GetFriendlyName()
2350 // Overwrite the profile data with the resulting configured service.
2351 if (!profile->UpdateService(service)) {
2353 "Unable to save service to profile");
2362 (profile_specified && service->profile() != profile)) {
2363 SLOG(this, 2) << "Moving service to profile "
2364 << profile->GetFriendlyName();
2365 if (!MoveServiceToProfile(service, profile)) {
2367 "Unable to move service to profile");
2372 // Notify the service that a profile has been configured for it.
2398 ProfileRefPtr profile = LookupProfileByRpcIdentifier(profile_rpcid);
2399 if (!profile) {
2401 "Profile specified was not found");
2406 "Profile argument does not match that in "
2429 // profile using ConfigureService().
2437 // The service already exists and is set to the desired profile,
2438 // the service is in the ephemeral profile, or the current profile
2439 // for the service appears before the desired profile, we need to
2440 // reassign the service to the new profile if necessary, leaving
2441 // the old profile intact (i.e, not calling Profile::AbandonService()).
2443 // associated profile.
2444 if (service->profile() == profile ||
2446 IsProfileBefore(service->profile(), profile)) {
2447 SetupServiceInProfile(service, profile, args, error);
2451 // The current profile for the service appears after the desired
2452 // profile. We must create a temporary service specifically for
2463 // The profile may already have configuration for this service.
2464 profile->ConfigureService(service);
2466 SetupServiceInProfile(service, profile, args, error);
2475 ProfileRefPtr profile,
2478 service->SetProfile(profile);
2480 profile->UpdateService(service);