| 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);
|
| }
|
|
|
|
|