Chromium Code Reviews| Index: chrome/browser/profiles/profile_info_cache.cc |
| =================================================================== |
| --- chrome/browser/profiles/profile_info_cache.cc (revision 113463) |
| +++ chrome/browser/profiles/profile_info_cache.cc (working copy) |
| @@ -236,7 +236,11 @@ |
| DictionaryValue* info = NULL; |
| cache->GetDictionary(key, &info); |
| string16 name; |
| - info->GetString(kNameKey, &name); |
| + size_t index = GetIndexOfProfileWithPath(profile_path); |
| + if (IsUsingGAIANameOfProfileAtIndex(index)) |
|
sail
2011/12/09 17:48:00
In all these places you should be able to just cal
SteveT
2011/12/09 18:20:21
Just what I wanted. Done here and below where appr
|
| + name = GetGAIANameOfProfileAtIndex(index); |
| + else |
| + info->GetString(kNameKey, &name); |
| FOR_EACH_OBSERVER(ProfileInfoCacheObserver, |
| observer_list_, |
| @@ -405,7 +409,10 @@ |
| scoped_ptr<DictionaryValue> info(GetInfoForProfileAtIndex(index)->DeepCopy()); |
| string16 old_name; |
| - info->GetString(kNameKey, &old_name); |
| + if (IsUsingGAIANameOfProfileAtIndex(index)) |
| + old_name = GetGAIANameOfProfileAtIndex(index); |
| + else |
| + info->GetString(kNameKey, &old_name); |
| info->SetString(kNameKey, name); |
| // This takes ownership of |info|. |
| SetInfoForProfileAtIndex(index, info.release()); |
| @@ -431,7 +438,10 @@ |
| size_t icon_index) { |
| scoped_ptr<DictionaryValue> info(GetInfoForProfileAtIndex(index)->DeepCopy()); |
| string16 name; |
| - info->GetString(kNameKey, &name); |
| + if (IsUsingGAIANameOfProfileAtIndex(index)) |
| + name = GetGAIANameOfProfileAtIndex(index); |
| + else |
| + info->GetString(kNameKey, &name); |
| info->SetString(kAvatarIconKey, GetDefaultAvatarIconUrl(icon_index)); |
| // This takes ownership of |info|. |
| SetInfoForProfileAtIndex(index, info.release()); |
| @@ -477,10 +487,19 @@ |
| return; |
| scoped_ptr<DictionaryValue> info(GetInfoForProfileAtIndex(index)->DeepCopy()); |
| + string16 old_name; |
| + info->GetString(kNameKey, &old_name); |
| info->SetBoolean(kUseGAIANameKey, value); |
| // This takes ownership of |info|. |
| SetInfoForProfileAtIndex(index, info.release()); |
| + string16 new_name = GetGAIANameOfProfileAtIndex(index); |
| UpdateSortForProfileIndex(index); |
| + |
| + if (value) { |
| + FOR_EACH_OBSERVER(ProfileInfoCacheObserver, |
| + observer_list_, |
| + OnProfileNameChanged(old_name, new_name)); |
| + } |
| } |
| void ProfileInfoCache::SetGAIAPictureOfProfileAtIndex(size_t index, |
| @@ -535,7 +554,10 @@ |
| bool value) { |
| scoped_ptr<DictionaryValue> info(GetInfoForProfileAtIndex(index)->DeepCopy()); |
| string16 name; |
| - info->GetString(kNameKey, &name); |
| + if (IsUsingGAIANameOfProfileAtIndex(index)) |
| + name = GetGAIANameOfProfileAtIndex(index); |
| + else |
| + info->GetString(kNameKey, &name); |
| info->SetBoolean(kUseGAIAPictureKey, value); |
| // This takes ownership of |info|. |
| SetInfoForProfileAtIndex(index, info.release()); |