Index: chrome/browser/profiles/profile_impl.cc |
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc |
index 14248d60b65bfbd9293d9652ae4f0876484acce0..65156629b910d539885b5014690d372822386ef5 100644 |
--- a/chrome/browser/profiles/profile_impl.cc |
+++ b/chrome/browser/profiles/profile_impl.cc |
@@ -358,6 +358,21 @@ void ProfileImpl::RegisterProfilePrefs( |
prefs::kProfileAvatarIndex, |
-1, |
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
+ // Whether a profile is using an avatar without having explicitely chosen it |
+ // (i.e. was assigned by default by legacy profile creation). |
+ registry->RegisterBooleanPref( |
+ prefs::kProfileUsingDefaultAvatar, |
+ true, |
+ user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
+ registry->RegisterBooleanPref( |
+ prefs::kProfileUsingGAIAAvatar, |
+ false, |
+ user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
+ // Whether a profile is using a default avatar name (eg. Pickles or Person 1). |
+ registry->RegisterIntegerPref( |
+ prefs::kProfileUsingDefaultName, |
+ -1, |
+ user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
Roger Tawa OOO till Jul 10th
2014/08/15 14:46:40
Should use enum for -1, 0, 1 values. However, the
noms (inactive)
2014/08/15 16:22:47
Done.
|
registry->RegisterStringPref( |
prefs::kSupervisedUserId, |
std::string(), |
@@ -540,14 +555,31 @@ void ProfileImpl::DoFinalInit() { |
prefs::kDefaultZoomLevel, |
base::Bind(&ProfileImpl::OnDefaultZoomLevelChanged, |
base::Unretained(this))); |
+ |
+ // Changes in the profile avatar. |
pref_change_registrar_.Add( |
prefs::kProfileAvatarIndex, |
base::Bind(&ProfileImpl::UpdateProfileAvatarCache, |
base::Unretained(this))); |
pref_change_registrar_.Add( |
+ prefs::kProfileUsingDefaultAvatar, |
+ base::Bind(&ProfileImpl::UpdateProfileAvatarCache, |
+ base::Unretained(this))); |
+ pref_change_registrar_.Add( |
+ prefs::kProfileUsingGAIAAvatar, |
+ base::Bind(&ProfileImpl::UpdateProfileAvatarCache, |
+ base::Unretained(this))); |
+ |
+ // Changes in the profile name. |
+ pref_change_registrar_.Add( |
+ prefs::kProfileUsingDefaultName, |
+ base::Bind(&ProfileImpl::UpdateProfileNameCache, |
+ base::Unretained(this))); |
+ pref_change_registrar_.Add( |
prefs::kProfileName, |
base::Bind(&ProfileImpl::UpdateProfileNameCache, |
base::Unretained(this))); |
+ |
pref_change_registrar_.Add( |
prefs::kForceEphemeralProfiles, |
base::Bind(&ProfileImpl::UpdateProfileIsEphemeralCache, |
@@ -1357,6 +1389,12 @@ void ProfileImpl::UpdateProfileNameCache() { |
std::string profile_name = |
GetPrefs()->GetString(prefs::kProfileName); |
cache.SetNameOfProfileAtIndex(index, base::UTF8ToUTF16(profile_name)); |
+ int default_name = |
+ GetPrefs()->GetInteger(prefs::kProfileUsingDefaultName); |
+ // A value of -1 means that the user has not specifically chosen to |
+ // use one of the default names (i.e. hasn't renamed the profile to |
+ // Pickles on purpose). |
+ cache.SetProfileIsUsingDefaultNameAtIndex(index, (default_name == -1)); |
} |
} |
@@ -1368,6 +1406,12 @@ void ProfileImpl::UpdateProfileAvatarCache() { |
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); |
} |
} |