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

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

Issue 8801034: Revert 112856 - Making profile avatars and names sync. (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 | « chrome/browser/profiles/profile_manager_unittest.cc ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/options/manage_profile_handler.cc
===================================================================
--- chrome/browser/ui/webui/options/manage_profile_handler.cc (revision 113064)
+++ chrome/browser/ui/webui/options/manage_profile_handler.cc (working copy)
@@ -11,16 +11,13 @@
#include "base/value_conversions.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/gaia_info_update_service.h"
-#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_info_cache.h"
#include "chrome/browser/profiles/profile_info_util.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/profiles/profile_metrics.h"
#include "chrome/browser/ui/webui/web_ui_util.h"
#include "chrome/common/chrome_notification_types.h"
-#include "chrome/common/pref_names.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/public/browser/notification_service.h"
#include "grit/generated_resources.h"
@@ -142,15 +139,13 @@
ProfileInfoCache& cache =
g_browser_process->profile_manager()->GetProfileInfoCache();
size_t profile_index = cache.GetIndexOfProfileWithPath(profile_file_path);
+ if (profile_index == std::string::npos)
+ return;
string16 new_profile_name;
if (!args->GetString(1, &new_profile_name))
return;
- Profile* profile =
- g_browser_process->profile_manager()->GetProfile(profile_file_path);
- if (!profile)
- return;
if (new_profile_name == cache.GetGAIANameOfProfileAtIndex(profile_index)) {
// Set the profile to use the GAIA name as the profile name. Note, this
// is a little weird if the user typed their GAIA name manually but
@@ -161,11 +156,7 @@
if (profile_index == std::string::npos)
return;
} else {
- PrefService* pref_service = profile->GetPrefs();
- // Updating the profile preference will cause the cache to be updated for
- // this preference.
- pref_service->SetString(prefs::kProfileName, UTF16ToUTF8(new_profile_name));
-
+ cache.SetNameOfProfileAtIndex(profile_index, new_profile_name);
// Changing the profile name can invalidate the profile index.
profile_index = cache.GetIndexOfProfileWithPath(profile_file_path);
if (profile_index == std::string::npos)
@@ -187,11 +178,8 @@
if (icon_url == gaia_picture_url_) {
cache.SetIsUsingGAIAPictureOfProfileAtIndex(profile_index, true);
} else if (cache.IsDefaultAvatarIconUrl(icon_url, &new_icon_index)) {
- PrefService* pref_service = profile->GetPrefs();
ProfileMetrics::LogProfileAvatarSelection(new_icon_index);
- // Updating the profile preference will cause the cache to be updated for
- // this preference.
- pref_service->SetInteger(prefs::kProfileAvatarIndex, new_icon_index);
+ cache.SetAvatarIconOfProfileAtIndex(profile_index, new_icon_index);
cache.SetIsUsingGAIAPictureOfProfileAtIndex(profile_index, false);
}
« no previous file with comments | « chrome/browser/profiles/profile_manager_unittest.cc ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698