[Profiles] Fix the usage of custom/default names and avatars
(Hopefully for the last time). This is based on treib's patch 476703002 The problem that this CL is fixing is that it was a mess to tell whether a user had a default name/avatar (Lemonade) because we randomly assigned it at a profile creation time (in old, legacy cases), and then they synced it because that's what sync does, or because they did that on purpose. The idea being, of course, that if we randomly called them Lemonade and they have a Gaia name, we should use the latter, but if they synced "bob", we should use the sync name. Ok. Here's how this works now: - there's a preference for the profile name, and a preference "if it's default" - if this preference is not set, we assume this is a legacy created profile, so if it is named First User or Lemonade, the user probably didn't change that. This sets a "kIsUsingDefaultNameKey" preference in the ProfileInfoCache - if the ProfileInfoCache has a profile with a kIsUsingDefaultNameKey, then it uses a Gaia name if it's available. - the moment the user changes the name of a profile, it stops being default. So even if I change the profile name from Lemonade to Pickles, even though Pickles is one of the default profile names, we allow this insanity. - a similar dance is done for the default avatar/gaia avatar, only here we maintain two preferences, because the ProfileInfoCache holds both the gaia and the profile avatar. Profiles, right? <3 BUG=394586 Review URL: https://codereview.chromium.org/476993002 Cr-Commit-Position: refs/heads/master@{#290101} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@290101 0039d316-1c4b-4281-b951-d872f2087c98
Showing
Please register or sign in to comment