| Index: chrome/browser/profiles/profile_shortcut_manager_win.cc
|
| diff --git a/chrome/browser/profiles/profile_shortcut_manager_win.cc b/chrome/browser/profiles/profile_shortcut_manager_win.cc
|
| index 17b5b3f59e66980218a938b73eac422dbfe3213f..c6fc6722246eafa0af73f418c082fc922089571a 100644
|
| --- a/chrome/browser/profiles/profile_shortcut_manager_win.cc
|
| +++ b/chrome/browser/profiles/profile_shortcut_manager_win.cc
|
| @@ -729,7 +729,8 @@ void ProfileShortcutManagerWin::OnProfileWasRemoved(
|
| const bool deleting_down_to_last_profile = (cache.GetNumberOfProfiles() == 1);
|
| if (deleting_down_to_last_profile) {
|
| // This is needed to unbadge the icon.
|
| - CreateOrUpdateShortcutsForProfileAtPath(cache.GetPathOfProfileAtIndex(0),
|
| + const std::vector<ProfileInfoEntry> entries(cache.GetProfilesSortedByName());
|
| + CreateOrUpdateShortcutsForProfileAtPath(entries[0].path(),
|
| UPDATE_EXISTING_ONLY,
|
| IGNORE_NON_PROFILE_SHORTCUTS,
|
| base::Closure());
|
| @@ -758,11 +759,20 @@ base::FilePath ProfileShortcutManagerWin::GetOtherProfilePath(
|
| const base::FilePath& profile_path) {
|
| const ProfileInfoCache& cache = profile_manager_->GetProfileInfoCache();
|
| DCHECK_EQ(2U, cache.GetNumberOfProfiles());
|
| +
|
| // Get the index of the current profile, in order to find the index of the
|
| // other profile.
|
| - size_t current_profile_index = cache.GetIndexOfProfileWithPath(profile_path);
|
| - size_t other_profile_index = (current_profile_index == 0) ? 1 : 0;
|
| - return cache.GetPathOfProfileAtIndex(other_profile_index);
|
| + base::FilePath other_path;
|
| + const std::vector<ProfileInfoEntry> entries(cache.GetProfilesSortedByName());
|
| + for (std::vector<ProfileInfoEntry>::const_iterator it = entries.begin();
|
| + it != entries.end(); ++it) {
|
| + if (it->path() != profile_path)
|
| + return it->path();
|
| + }
|
| +
|
| + // We should never actually reach this point, but need to return something
|
| + // to make the compiler happy.
|
| + return profile_path;
|
| }
|
|
|
| void ProfileShortcutManagerWin::CreateOrUpdateShortcutsForProfileAtPath(
|
| @@ -775,13 +785,13 @@ void ProfileShortcutManagerWin::CreateOrUpdateShortcutsForProfileAtPath(
|
| CreateOrUpdateShortcutsParams params(profile_path, create_mode, action);
|
|
|
| ProfileInfoCache* cache = &profile_manager_->GetProfileInfoCache();
|
| - size_t profile_index = cache->GetIndexOfProfileWithPath(profile_path);
|
| - if (profile_index == std::string::npos)
|
| + ProfileInfoEntry entry;
|
| + if (!cache->GetInfoForProfile(profile_path, &entry))
|
| return;
|
| +
|
| bool remove_badging = cache->GetNumberOfProfiles() == 1;
|
|
|
| - params.old_profile_name =
|
| - cache->GetShortcutNameOfProfileAtIndex(profile_index);
|
| + params.old_profile_name = entry.shortcut_name();
|
|
|
| // Exit early if the mode is to update existing profile shortcuts only and
|
| // none were ever created for this profile, per the shortcut name not being
|
| @@ -793,10 +803,9 @@ void ProfileShortcutManagerWin::CreateOrUpdateShortcutsForProfileAtPath(
|
| }
|
|
|
| if (!remove_badging) {
|
| - params.profile_name = cache->GetNameOfProfileAtIndex(profile_index);
|
| + params.profile_name = entry.GetDisplayName();
|
|
|
| - const size_t icon_index =
|
| - cache->GetAvatarIconIndexOfProfileAtIndex(profile_index);
|
| + const size_t icon_index = entry.icon_index();
|
| const int resource_id_1x =
|
| cache->GetDefaultAvatarIconResourceIDAtIndex(icon_index);
|
| const int resource_id_2x = kProfileAvatarIconResources2x[icon_index];
|
| @@ -810,8 +819,8 @@ void ProfileShortcutManagerWin::CreateOrUpdateShortcutsForProfileAtPath(
|
| base::Bind(&CreateOrUpdateDesktopShortcutsAndIconForProfile, params,
|
| callback));
|
|
|
| - cache->SetShortcutNameOfProfileAtIndex(profile_index,
|
| - params.profile_name);
|
| + entry.set_shortcut_name(params.profile_name);
|
| + cache->SetInfoForProfile(entry);
|
| }
|
|
|
| void ProfileShortcutManagerWin::Observe(
|
|
|