| Index: chrome/browser/profiles/profile_impl.cc
|
| diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
|
| index 3f2b821d82c6862daad73ba322c66c861d8e56a8..4d9fc329afd83578ee1f38be6dc89013201d2451 100644
|
| --- a/chrome/browser/profiles/profile_impl.cc
|
| +++ b/chrome/browser/profiles/profile_impl.cc
|
| @@ -213,6 +213,12 @@ void ProfileImpl::RegisterUserPrefs(PrefService* prefs) {
|
| prefs->RegisterBooleanPref(prefs::kClearSiteDataOnExit,
|
| false,
|
| PrefService::SYNCABLE_PREF);
|
| + prefs->RegisterIntegerPref(prefs::kProfileAvatarIndex,
|
| + -1,
|
| + PrefService::SYNCABLE_PREF);
|
| + prefs->RegisterStringPref(prefs::kProfileName,
|
| + "",
|
| + PrefService::SYNCABLE_PREF);
|
| #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) && defined(OS_POSIX)
|
| prefs->RegisterIntegerPref(prefs::kLocalProfileId,
|
| kInvalidLocalProfileId,
|
| @@ -288,6 +294,8 @@ void ProfileImpl::DoFinalInit() {
|
| pref_change_registrar_.Add(prefs::kClearSiteDataOnExit, this);
|
| pref_change_registrar_.Add(prefs::kGoogleServicesUsername, this);
|
| pref_change_registrar_.Add(prefs::kDefaultZoomLevel, this);
|
| + pref_change_registrar_.Add(prefs::kProfileAvatarIndex, this);
|
| + pref_change_registrar_.Add(prefs::kProfileName, this);
|
|
|
| // It would be nice to use PathService for fetching this directory, but
|
| // the cache directory depends on the profile directory, which isn't available
|
| @@ -1321,6 +1329,10 @@ void ProfileImpl::Observe(int type,
|
| }
|
| } else if (*pref_name_in == prefs::kGoogleServicesUsername) {
|
| UpdateProfileUserNameCache();
|
| + } else if (*pref_name_in == prefs::kProfileAvatarIndex) {
|
| + UpdateProfileAvatarCache();
|
| + } else if (*pref_name_in == prefs::kProfileName) {
|
| + UpdateProfileNameCache();
|
| } else if (*pref_name_in == prefs::kDefaultZoomLevel) {
|
| GetHostZoomMap()->set_default_zoom_level(
|
| prefs->GetDouble(prefs::kDefaultZoomLevel));
|
| @@ -1629,6 +1641,28 @@ void ProfileImpl::UpdateProfileUserNameCache() {
|
| }
|
| }
|
|
|
| +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, UTF8ToUTF16(profile_name));
|
| + }
|
| +}
|
| +
|
| +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);
|
| + }
|
| +}
|
| +
|
| // Gets the cache parameters from the command line. If |is_media_context| is
|
| // set to true then settings for the media context type is what we need,
|
| // |cache_path| will be set to the user provided path, or will not be touched if
|
|
|