Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4977)

Unified Diff: chrome/browser/profiles/profile_info_cache.cc

Issue 8894005: Ensure that use of GAIA names are considered when handling desktop shortcut changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698