| Index: chrome/browser/profiles/profile_impl.cc
|
| diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
|
| index 69df95195a31d8c1937520f49038259bef8cdd5b..858137cf151cdc6a1861358eeb92e5220688f58a 100644
|
| --- a/chrome/browser/profiles/profile_impl.cc
|
| +++ b/chrome/browser/profiles/profile_impl.cc
|
| @@ -62,8 +62,9 @@
|
| #include "chrome/browser/profiles/bookmark_model_loaded_observer.h"
|
| #include "chrome/browser/profiles/chrome_version_service.h"
|
| #include "chrome/browser/profiles/gaia_info_update_service_factory.h"
|
| +#include "chrome/browser/profiles/profile_attributes_entry.h"
|
| +#include "chrome/browser/profiles/profile_attributes_storage.h"
|
| #include "chrome/browser/profiles/profile_destroyer.h"
|
| -#include "chrome/browser/profiles/profile_info_cache.h"
|
| #include "chrome/browser/profiles/profile_manager.h"
|
| #include "chrome/browser/profiles/profile_metrics.h"
|
| #include "chrome/browser/push_messaging/push_messaging_service_factory.h"
|
| @@ -485,36 +486,36 @@ void ProfileImpl::DoFinalInit() {
|
| pref_change_registrar_.Init(prefs);
|
| pref_change_registrar_.Add(
|
| prefs::kSupervisedUserId,
|
| - base::Bind(&ProfileImpl::UpdateProfileSupervisedUserIdCache,
|
| + base::Bind(&ProfileImpl::UpdateSupervisedUserIdInStorage,
|
| base::Unretained(this)));
|
|
|
| // Changes in the profile avatar.
|
| pref_change_registrar_.Add(
|
| prefs::kProfileAvatarIndex,
|
| - base::Bind(&ProfileImpl::UpdateProfileAvatarCache,
|
| + base::Bind(&ProfileImpl::UpdateAvatarInStorage,
|
| base::Unretained(this)));
|
| pref_change_registrar_.Add(
|
| prefs::kProfileUsingDefaultAvatar,
|
| - base::Bind(&ProfileImpl::UpdateProfileAvatarCache,
|
| + base::Bind(&ProfileImpl::UpdateAvatarInStorage,
|
| base::Unretained(this)));
|
| pref_change_registrar_.Add(
|
| prefs::kProfileUsingGAIAAvatar,
|
| - base::Bind(&ProfileImpl::UpdateProfileAvatarCache,
|
| + base::Bind(&ProfileImpl::UpdateAvatarInStorage,
|
| base::Unretained(this)));
|
|
|
| // Changes in the profile name.
|
| pref_change_registrar_.Add(
|
| prefs::kProfileUsingDefaultName,
|
| - base::Bind(&ProfileImpl::UpdateProfileNameCache,
|
| + base::Bind(&ProfileImpl::UpdateNameInStorage,
|
| base::Unretained(this)));
|
| pref_change_registrar_.Add(
|
| prefs::kProfileName,
|
| - base::Bind(&ProfileImpl::UpdateProfileNameCache,
|
| + base::Bind(&ProfileImpl::UpdateNameInStorage,
|
| base::Unretained(this)));
|
|
|
| pref_change_registrar_.Add(
|
| prefs::kForceEphemeralProfiles,
|
| - base::Bind(&ProfileImpl::UpdateProfileIsEphemeralCache,
|
| + base::Bind(&ProfileImpl::UpdateIsEphemeralInStorage,
|
| base::Unretained(this)));
|
|
|
| // It would be nice to use PathService for fetching this directory, but
|
| @@ -528,8 +529,8 @@ void ProfileImpl::DoFinalInit() {
|
| CreateProfileDirectory(sequenced_task_runner.get(), base_cache_path_, false);
|
|
|
| // Initialize components that depend on the current value.
|
| - UpdateProfileSupervisedUserIdCache();
|
| - UpdateProfileIsEphemeralCache();
|
| + UpdateSupervisedUserIdInStorage();
|
| + UpdateIsEphemeralInStorage();
|
| GAIAInfoUpdateServiceFactory::GetForProfile(this);
|
|
|
| PrefService* local_state = g_browser_process->local_state();
|
| @@ -1170,56 +1171,53 @@ GURL ProfileImpl::GetHomePage() {
|
| return home_page;
|
| }
|
|
|
| -void ProfileImpl::UpdateProfileSupervisedUserIdCache() {
|
| +void ProfileImpl::UpdateSupervisedUserIdInStorage() {
|
| ProfileManager* profile_manager = g_browser_process->profile_manager();
|
| - ProfileInfoCache& cache = profile_manager->GetProfileInfoCache();
|
| - size_t index = cache.GetIndexOfProfileWithPath(GetPath());
|
| - if (index != std::string::npos) {
|
| - std::string supervised_user_id =
|
| - GetPrefs()->GetString(prefs::kSupervisedUserId);
|
| - cache.SetSupervisedUserIdOfProfileAtIndex(index, supervised_user_id);
|
| + ProfileAttributesEntry* entry;
|
| + bool has_entry = profile_manager->GetProfileAttributesStorage().
|
| + GetProfileAttributesWithPath(GetPath(), &entry);
|
| + if (has_entry) {
|
| + entry->SetSupervisedUserId(GetPrefs()->GetString(prefs::kSupervisedUserId));
|
| ProfileMetrics::UpdateReportedProfilesStatistics(profile_manager);
|
| }
|
| }
|
|
|
| -void ProfileImpl::UpdateProfileNameCache() {
|
| - ProfileManager* profile_manager = g_browser_process->profile_manager();
|
| - ProfileInfoCache& cache = profile_manager->GetProfileInfoCache();
|
| - size_t index = cache.GetIndexOfProfileWithPath(GetPath());
|
| - if (index != std::string::npos) {
|
| - std::string profile_name =
|
| - GetPrefs()->GetString(prefs::kProfileName);
|
| - cache.SetNameOfProfileAtIndex(index, base::UTF8ToUTF16(profile_name));
|
| - bool default_name =
|
| - GetPrefs()->GetBoolean(prefs::kProfileUsingDefaultName);
|
| - cache.SetProfileIsUsingDefaultNameAtIndex(index, default_name);
|
| +void ProfileImpl::UpdateNameInStorage() {
|
| + ProfileAttributesEntry* entry;
|
| + bool has_entry =
|
| + g_browser_process->profile_manager()->GetProfileAttributesStorage().
|
| + GetProfileAttributesWithPath(GetPath(), &entry);
|
| + if (has_entry) {
|
| + entry->SetName(
|
| + base::UTF8ToUTF16(GetPrefs()->GetString(prefs::kProfileName)));
|
| + entry->SetIsUsingDefaultName(
|
| + GetPrefs()->GetBoolean(prefs::kProfileUsingDefaultName));
|
| }
|
| }
|
|
|
| -void ProfileImpl::UpdateProfileAvatarCache() {
|
| - ProfileManager* profile_manager = g_browser_process->profile_manager();
|
| - ProfileInfoCache& cache = profile_manager->GetProfileInfoCache();
|
| - size_t index = cache.GetIndexOfProfileWithPath(GetPath());
|
| - if (index != std::string::npos) {
|
| - size_t avatar_index =
|
| - GetPrefs()->GetInteger(prefs::kProfileAvatarIndex);
|
| - cache.SetAvatarIconOfProfileAtIndex(index, avatar_index);
|
| - bool default_avatar =
|
| - GetPrefs()->GetBoolean(prefs::kProfileUsingDefaultAvatar);
|
| - cache.SetProfileIsUsingDefaultAvatarAtIndex(index, default_avatar);
|
| - bool gaia_avatar =
|
| - GetPrefs()->GetBoolean(prefs::kProfileUsingGAIAAvatar);
|
| - cache.SetIsUsingGAIAPictureOfProfileAtIndex(index, gaia_avatar);
|
| +void ProfileImpl::UpdateAvatarInStorage() {
|
| + ProfileAttributesEntry* entry;
|
| + bool has_entry =
|
| + g_browser_process->profile_manager()->GetProfileAttributesStorage().
|
| + GetProfileAttributesWithPath(GetPath(), &entry);
|
| + if (has_entry) {
|
| + entry->SetAvatarIconIndex(
|
| + GetPrefs()->GetInteger(prefs::kProfileAvatarIndex));
|
| + entry->SetIsUsingDefaultAvatar(
|
| + GetPrefs()->GetBoolean(prefs::kProfileUsingDefaultAvatar));
|
| + entry->SetIsUsingGAIAPicture(
|
| + GetPrefs()->GetBoolean(prefs::kProfileUsingGAIAAvatar));
|
| }
|
| }
|
|
|
| -void ProfileImpl::UpdateProfileIsEphemeralCache() {
|
| - ProfileManager* profile_manager = g_browser_process->profile_manager();
|
| - ProfileInfoCache& cache = profile_manager->GetProfileInfoCache();
|
| - size_t index = cache.GetIndexOfProfileWithPath(GetPath());
|
| - if (index != std::string::npos) {
|
| - bool is_ephemeral = GetPrefs()->GetBoolean(prefs::kForceEphemeralProfiles);
|
| - cache.SetProfileIsEphemeralAtIndex(index, is_ephemeral);
|
| +void ProfileImpl::UpdateIsEphemeralInStorage() {
|
| + ProfileAttributesEntry* entry;
|
| + bool has_entry =
|
| + g_browser_process->profile_manager()->GetProfileAttributesStorage().
|
| + GetProfileAttributesWithPath(GetPath(), &entry);
|
| + if (has_entry) {
|
| + entry->SetIsEphemeral(
|
| + GetPrefs()->GetBoolean(prefs::kForceEphemeralProfiles));
|
| }
|
| }
|
|
|
|
|