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) |
| @@ -235,8 +235,9 @@ |
| std::string key = CacheKeyFromProfilePath(profile_path); |
| DictionaryValue* info = NULL; |
|
sail
2011/12/09 18:24:22
do you still need this?
SteveT
2011/12/09 18:37:56
No, nor do I need |index| below. That was a bit ca
|
| cache->GetDictionary(key, &info); |
| - string16 name; |
| - info->GetString(kNameKey, &name); |
| + string16 name = GetNameOfProfileAtIndex( |
| + GetIndexOfProfileWithPath(profile_path)); |
| + size_t index = GetIndexOfProfileWithPath(profile_path); |
| FOR_EACH_OBSERVER(ProfileInfoCacheObserver, |
| observer_list_, |
| @@ -404,8 +405,7 @@ |
| return; |
| scoped_ptr<DictionaryValue> info(GetInfoForProfileAtIndex(index)->DeepCopy()); |
| - string16 old_name; |
| - info->GetString(kNameKey, &old_name); |
| + string16 old_name = GetNameOfProfileAtIndex(index); |
| info->SetString(kNameKey, name); |
| // This takes ownership of |info|. |
| SetInfoForProfileAtIndex(index, info.release()); |
| @@ -430,12 +430,11 @@ |
| void ProfileInfoCache::SetAvatarIconOfProfileAtIndex(size_t index, |
| size_t icon_index) { |
| scoped_ptr<DictionaryValue> info(GetInfoForProfileAtIndex(index)->DeepCopy()); |
| - string16 name; |
| - info->GetString(kNameKey, &name); |
| info->SetString(kAvatarIconKey, GetDefaultAvatarIconUrl(icon_index)); |
| // This takes ownership of |info|. |
| SetInfoForProfileAtIndex(index, info.release()); |
| + string16 name = GetNameOfProfileAtIndex(index); |
| FilePath profile_path = GetPathOfProfileAtIndex(index); |
| std::string key = CacheKeyFromProfilePath(profile_path); |
| gfx::Image& avatar_img = |
| @@ -477,10 +476,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, |
| @@ -534,8 +542,7 @@ |
| void ProfileInfoCache::SetIsUsingGAIAPictureOfProfileAtIndex(size_t index, |
| bool value) { |
| scoped_ptr<DictionaryValue> info(GetInfoForProfileAtIndex(index)->DeepCopy()); |
| - string16 name; |
| - info->GetString(kNameKey, &name); |
| + string16 name = GetNameOfProfileAtIndex(index); |
| info->SetBoolean(kUseGAIAPictureKey, value); |
| // This takes ownership of |info|. |
| SetInfoForProfileAtIndex(index, info.release()); |