| Index: chrome/browser/ui/webui/signin/user_manager_screen_handler.cc
|
| diff --git a/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc b/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc
|
| index 5fa8b1b918e4d080702f169c4ef0d44fc75b7343..180dcdcf46515513e1e6d7208ad9e79f363b5f82 100644
|
| --- a/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc
|
| +++ b/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc
|
| @@ -12,6 +12,7 @@
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "chrome/browser/profiles/profile_info_cache.h"
|
| #include "chrome/browser/profiles/profile_info_cache_observer.h"
|
| +#include "chrome/browser/profiles/profile_info_entry.h"
|
| #include "chrome/browser/profiles/profile_info_util.h"
|
| #include "chrome/browser/profiles/profile_manager.h"
|
| #include "chrome/browser/profiles/profile_window.h"
|
| @@ -76,14 +77,14 @@ void OpenNewWindowForProfile(
|
| false);
|
| }
|
|
|
| -std::string GetAvatarImageAtIndex(
|
| - size_t index, const ProfileInfoCache& info_cache) {
|
| - bool is_gaia_picture =
|
| - info_cache.IsUsingGAIAPictureOfProfileAtIndex(index) &&
|
| - info_cache.GetGAIAPictureOfProfileAtIndex(index);
|
| +std::string GetAvatarImageForProfile(const base::FilePath profile_path,
|
| + bool is_using_GAIA_picture,
|
| + const ProfileInfoCache& info_cache) {
|
| + bool is_gaia_picture = is_using_GAIA_picture &&
|
| + info_cache.GetGAIAPictureOfProfile(profile_path);
|
|
|
| gfx::Image icon = profiles::GetSizedAvatarIconWithBorder(
|
| - info_cache.GetAvatarIconOfProfileAtIndex(index),
|
| + info_cache.GetAvatarIconOfProfile(profile_path),
|
| is_gaia_picture, kAvatarIconSize, kAvatarIconSize);
|
| return webui::GetBitmapDataUrl(icon.AsBitmap());
|
| }
|
| @@ -205,14 +206,15 @@ void UserManagerScreenHandler::HandleLaunchUser(const base::ListValue* args) {
|
| return;
|
| }
|
|
|
| - ProfileInfoCache& info_cache =
|
| + ProfileInfoCache& cache =
|
| g_browser_process->profile_manager()->GetProfileInfoCache();
|
|
|
| - for (size_t i = 0; i < info_cache.GetNumberOfProfiles(); ++i) {
|
| - if (info_cache.GetUserNameOfProfileAtIndex(i) == emailAddress &&
|
| - info_cache.GetNameOfProfileAtIndex(i) == displayName) {
|
| - base::FilePath path = info_cache.GetPathOfProfileAtIndex(i);
|
| - profiles::SwitchToProfile(path, desktop_type_, true);
|
| + const std::vector<ProfileInfoEntry> entries(cache.GetProfilesSortedByName());
|
| + for (std::vector<ProfileInfoEntry>::const_iterator it = entries.begin();
|
| + it != entries.end(); ++it) {
|
| + if (it->user_name() == emailAddress &&
|
| + it->GetDisplayName() == displayName) {
|
| + profiles::SwitchToProfile(it->path(), desktop_type_, true);
|
| break;
|
| }
|
| }
|
| @@ -303,35 +305,34 @@ void UserManagerScreenHandler::SendUserList() {
|
| ListValue users_list;
|
| base::FilePath active_profile_path =
|
| web_ui()->GetWebContents()->GetBrowserContext()->GetPath();
|
| - const ProfileInfoCache& info_cache =
|
| + const ProfileInfoCache& cache =
|
| g_browser_process->profile_manager()->GetProfileInfoCache();
|
|
|
| // If the active user is a managed user, then they may not perform
|
| // certain actions (i.e. delete another user).
|
| bool active_user_is_managed = Profile::FromWebUI(web_ui())->IsManaged();
|
| - for (size_t i = 0; i < info_cache.GetNumberOfProfiles(); ++i) {
|
| - DictionaryValue* profile_value = new DictionaryValue();
|
|
|
| - base::FilePath profile_path = info_cache.GetPathOfProfileAtIndex(i);
|
| - bool is_active_user = (profile_path == active_profile_path);
|
| + const std::vector<ProfileInfoEntry> entries(cache.GetProfilesSortedByName());
|
| + for (std::vector<ProfileInfoEntry>::const_iterator it = entries.begin();
|
| + it != entries.end(); ++it) {
|
| + bool is_active_user = (it->path() == active_profile_path);
|
|
|
| - profile_value->SetString(
|
| - kKeyUsername, info_cache.GetUserNameOfProfileAtIndex(i));
|
| - profile_value->SetString(
|
| - kKeyEmailAddress, info_cache.GetUserNameOfProfileAtIndex(i));
|
| - profile_value->SetString(
|
| - kKeyDisplayName, info_cache.GetNameOfProfileAtIndex(i));
|
| - profile_value->SetString(kKeyProfilePath, profile_path.MaybeAsASCII());
|
| + DictionaryValue* profile_value = new DictionaryValue();
|
| + profile_value->SetString(kKeyUsername, it->user_name());
|
| + profile_value->SetString(kKeyEmailAddress, it->user_name());
|
| + profile_value->SetString(kKeyDisplayName, it->GetDisplayName());
|
| + profile_value->SetString(kKeyProfilePath, it->path().MaybeAsASCII());
|
| profile_value->SetBoolean(kKeyPublicAccount, false);
|
| profile_value->SetBoolean(kKeyLocallyManagedUser, false);
|
| profile_value->SetBoolean(kKeySignedIn, is_active_user);
|
| - profile_value->SetBoolean(
|
| - kKeyNeedsSignin, info_cache.ProfileIsSigninRequiredAtIndex(i));
|
| + profile_value->SetBoolean(kKeyNeedsSignin, it->is_signin_required());
|
| profile_value->SetBoolean(kKeyIsOwner, false);
|
| profile_value->SetBoolean(kKeyCanRemove, !active_user_is_managed);
|
| profile_value->SetBoolean(kKeyIsDesktop, true);
|
| - profile_value->SetString(
|
| - kKeyAvatarUrl, GetAvatarImageAtIndex(i, info_cache));
|
| + profile_value->SetString(kKeyAvatarUrl,
|
| + GetAvatarImageForProfile(it->path(),
|
| + it->is_using_GAIA_picture(),
|
| + cache));
|
|
|
| // The row of user pods should display the active user first.
|
| if (is_active_user)
|
|
|