| Index: chrome/browser/profiles/profiles_state.cc
|
| diff --git a/chrome/browser/profiles/profiles_state.cc b/chrome/browser/profiles/profiles_state.cc
|
| index 930bc83adc7adf5f80cf012edda749ae5c964e99..5c14cca8cdcf00134b76e2f2a675a2c2bda0ce5c 100644
|
| --- a/chrome/browser/profiles/profiles_state.cc
|
| +++ b/chrome/browser/profiles/profiles_state.cc
|
| @@ -14,7 +14,8 @@
|
| #include "chrome/browser/profiles/gaia_info_update_service.h"
|
| #include "chrome/browser/profiles/gaia_info_update_service_factory.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| -#include "chrome/browser/profiles/profile_info_cache.h"
|
| +#include "chrome/browser/profiles/profile_attributes_entry.h"
|
| +#include "chrome/browser/profiles/profile_attributes_storage.h"
|
| #include "chrome/browser/profiles/profile_manager.h"
|
| #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
|
| #include "chrome/browser/signin/signin_error_controller_factory.h"
|
| @@ -64,11 +65,11 @@ base::string16 GetAvatarNameForProfile(const base::FilePath& profile_path) {
|
| if (profile_path == ProfileManager::GetGuestProfilePath()) {
|
| display_name = l10n_util::GetStringUTF16(IDS_GUEST_PROFILE_NAME);
|
| } else {
|
| - const ProfileInfoCache& cache =
|
| - g_browser_process->profile_manager()->GetProfileInfoCache();
|
| - size_t index = cache.GetIndexOfProfileWithPath(profile_path);
|
| + ProfileAttributesStorage& storage =
|
| + g_browser_process->profile_manager()->GetProfileAttributesStorage();
|
| + ProfileAttributesEntry* entry;
|
|
|
| - if (index == std::string::npos)
|
| + if (!storage.GetProfileAttributesWithPath(profile_path, &entry))
|
| return l10n_util::GetStringUTF16(IDS_SINGLE_PROFILE_DISPLAY_NAME);
|
|
|
| // Using the --new-avatar-menu flag, there's a couple of rules about what
|
| @@ -77,12 +78,12 @@ base::string16 GetAvatarNameForProfile(const base::FilePath& profile_path) {
|
| // IDS_SINGLE_PROFILE_DISPLAY_NAME. If the profile is signed in but is using
|
| // a default name, use the profiles's email address. Otherwise, it
|
| // will return the actual name of the profile.
|
| - const base::string16 profile_name = cache.GetNameOfProfileAtIndex(index);
|
| - const base::string16 email = cache.GetUserNameOfProfileAtIndex(index);
|
| - bool is_default_name = cache.ProfileIsUsingDefaultNameAtIndex(index) &&
|
| - cache.IsDefaultProfileName(profile_name);
|
| + const base::string16 profile_name = entry->GetName();
|
| + const base::string16 email = entry->GetUserName();
|
| + bool is_default_name = entry->IsUsingDefaultName() &&
|
| + storage.IsDefaultProfileName(profile_name);
|
|
|
| - if (cache.GetNumberOfProfiles() == 1 && is_default_name)
|
| + if (storage.GetNumberOfProfiles() == 1 && is_default_name)
|
| display_name = l10n_util::GetStringUTF16(IDS_SINGLE_PROFILE_DISPLAY_NAME);
|
| else
|
| display_name = (is_default_name && !email.empty()) ? email : profile_name;
|
| @@ -115,13 +116,13 @@ base::string16 GetProfileSwitcherTextForItem(const AvatarMenu::Item& item) {
|
|
|
| void UpdateProfileName(Profile* profile,
|
| const base::string16& new_profile_name) {
|
| - const ProfileInfoCache& cache =
|
| - g_browser_process->profile_manager()->GetProfileInfoCache();
|
| - size_t profile_index = cache.GetIndexOfProfileWithPath(profile->GetPath());
|
| - if (profile_index == std::string::npos)
|
| + ProfileAttributesStorage& storage =
|
| + g_browser_process->profile_manager()->GetProfileAttributesStorage();
|
| + ProfileAttributesEntry* entry;
|
| + if (!storage.GetProfileAttributesWithPath(profile->GetPath(), &entry))
|
| return;
|
|
|
| - if (new_profile_name == cache.GetNameOfProfileAtIndex(profile_index))
|
| + if (new_profile_name == entry->GetName())
|
| return;
|
|
|
| // This is only called when updating the profile name through the UI,
|
| @@ -158,14 +159,14 @@ bool IsRegularOrGuestSession(Browser* browser) {
|
| }
|
|
|
| bool IsProfileLocked(const base::FilePath& path) {
|
| - const ProfileInfoCache& cache =
|
| - g_browser_process->profile_manager()->GetProfileInfoCache();
|
| - size_t profile_index = cache.GetIndexOfProfileWithPath(path);
|
| + ProfileAttributesStorage& storage =
|
| + g_browser_process->profile_manager()->GetProfileAttributesStorage();
|
| + ProfileAttributesEntry* entry;
|
|
|
| - if (profile_index == std::string::npos)
|
| + if (!storage.GetProfileAttributesWithPath(path, &entry))
|
| return false;
|
|
|
| - return cache.ProfileIsSigninRequiredAtIndex(profile_index);
|
| + return entry->IsSigninRequired();
|
| }
|
|
|
| void UpdateIsProfileLockEnabledIfNeeded(Profile* profile) {
|
| @@ -207,10 +208,13 @@ bool SetActiveProfileToGuestIfLocked() {
|
| if (active_profile_path == guest_path)
|
| return true;
|
|
|
| - const ProfileInfoCache& cache = profile_manager->GetProfileInfoCache();
|
| - size_t index = cache.GetIndexOfProfileWithPath(active_profile_path);
|
| - if (!cache.ProfileIsSigninRequiredAtIndex(index))
|
| + ProfileAttributesStorage& storage =
|
| + profile_manager->GetProfileAttributesStorage();
|
| + ProfileAttributesEntry* entry;
|
| + if (storage.GetProfileAttributesWithPath(active_profile_path, &entry) &&
|
| + !entry->IsSigninRequired()) {
|
| return false;
|
| + }
|
|
|
| SetLastUsedProfile(guest_path.BaseName().MaybeAsASCII());
|
|
|
|
|