| Index: chrome/browser/profiles/profile_impl.cc
|
| ===================================================================
|
| --- chrome/browser/profiles/profile_impl.cc (revision 112723)
|
| +++ chrome/browser/profiles/profile_impl.cc (working copy)
|
| @@ -202,6 +202,12 @@
|
| 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,
|
| @@ -274,6 +280,8 @@
|
| 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
|
| @@ -1287,6 +1295,10 @@
|
| }
|
| } 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));
|
| @@ -1580,6 +1592,28 @@
|
| }
|
| }
|
|
|
| +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
|
|
|