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

Unified Diff: chrome/browser/ui/webui/options/manage_profile_handler.cc

Issue 476993002: [Profiles] Fix the usage of custom/default names and avatars (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months 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
Index: chrome/browser/ui/webui/options/manage_profile_handler.cc
diff --git a/chrome/browser/ui/webui/options/manage_profile_handler.cc b/chrome/browser/ui/webui/options/manage_profile_handler.cc
index b6ecb37ee0cc25230ef610a771063ab3e7baca64..cb5a2ee0a39ab334f65fa2d43cf7b35a3fff6cd0 100644
--- a/chrome/browser/ui/webui/options/manage_profile_handler.cc
+++ b/chrome/browser/ui/webui/options/manage_profile_handler.cc
@@ -328,12 +328,6 @@ void ManageProfileHandler::SetProfileIconAndName(const base::ListValue* args) {
if (!GetProfilePathFromArgs(args, &profile_file_path))
return;
- ProfileInfoCache& cache =
- g_browser_process->profile_manager()->GetProfileInfoCache();
- size_t profile_index = cache.GetIndexOfProfileWithPath(profile_file_path);
- if (profile_index == std::string::npos)
- return;
-
Profile* profile =
g_browser_process->profile_manager()->GetProfile(profile_file_path);
if (!profile)
@@ -343,13 +337,17 @@ void ManageProfileHandler::SetProfileIconAndName(const base::ListValue* args) {
if (!args->GetString(1, &icon_url))
return;
+ PrefService* pref_service = profile->GetPrefs();
+ // Updating the profile preferences will cause the cache to be updated.
+
// Metrics logging variable.
bool previously_using_gaia_icon =
- cache.IsUsingGAIAPictureOfProfileAtIndex(profile_index);
+ pref_service->GetBoolean(prefs::kProfileUsingGAIAAvatar);
size_t new_icon_index;
if (icon_url == gaia_picture_url_) {
- cache.SetIsUsingGAIAPictureOfProfileAtIndex(profile_index, true);
+ pref_service->SetBoolean(prefs::kProfileUsingDefaultAvatar, false);
+ pref_service->SetBoolean(prefs::kProfileUsingGAIAAvatar, true);
if (!previously_using_gaia_icon) {
// Only log if they changed to the GAIA photo.
// Selection of GAIA photo as avatar is logged as part of the function
@@ -358,11 +356,9 @@ void ManageProfileHandler::SetProfileIconAndName(const base::ListValue* args) {
}
} else if (profiles::IsDefaultAvatarIconUrl(icon_url, &new_icon_index)) {
ProfileMetrics::LogProfileAvatarSelection(new_icon_index);
- PrefService* pref_service = profile->GetPrefs();
- // Updating the profile preference will cause the cache to be updated for
- // this preference.
pref_service->SetInteger(prefs::kProfileAvatarIndex, new_icon_index);
- cache.SetIsUsingGAIAPictureOfProfileAtIndex(profile_index, false);
+ pref_service->SetBoolean(prefs::kProfileUsingDefaultAvatar, false);
+ pref_service->SetBoolean(prefs::kProfileUsingGAIAAvatar, false);
}
ProfileMetrics::LogProfileUpdate(profile_file_path);

Powered by Google App Engine
This is Rietveld 408576698