Description[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
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=290101
Patch Set 1 #
Total comments: 12
Patch Set 2 : review comments + fixed tests = \o/ #Patch Set 3 : fix other test (argh, and a rebase) #Patch Set 4 : all rebase all the time #Messages
Total messages: 20 (0 generated)
|