Chromium Code Reviews| Index: chrome/browser/ui/webui/options/manage_profile_handler.cc |
| =================================================================== |
| --- chrome/browser/ui/webui/options/manage_profile_handler.cc (revision 112723) |
| +++ chrome/browser/ui/webui/options/manage_profile_handler.cc (working copy) |
| @@ -11,13 +11,16 @@ |
| #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" |
| @@ -139,13 +142,15 @@ |
| 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* prof = |
|
sail
2011/12/02 19:07:10
abbreviating names is bad, profile would be better
jwd
2011/12/02 21:10:16
Done.
|
| + g_browser_process->profile_manager()->GetProfile(profile_file_path); |
| + if (!prof) |
| + 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 |
| @@ -174,12 +179,15 @@ |
| if (!args->GetString(2, &icon_url)) |
| return; |
| + PrefService* pref_service = prof->GetPrefs(); |
| + pref_service->SetString(prefs::kProfileName,UTF16ToUTF8(new_profile_name)); |
|
sail
2011/12/02 19:07:10
I don't think this is a good place to set this pre
jwd
2011/12/02 21:10:16
This code was actually in the wrong place. In the
|
| + |
| size_t new_icon_index; |
| if (icon_url == gaia_picture_url_) { |
| cache.SetIsUsingGAIAPictureOfProfileAtIndex(profile_index, true); |
| } else if (cache.IsDefaultAvatarIconUrl(icon_url, &new_icon_index)) { |
| ProfileMetrics::LogProfileAvatarSelection(new_icon_index); |
| - cache.SetAvatarIconOfProfileAtIndex(profile_index, new_icon_index); |
| + pref_service->SetInteger(prefs::kProfileAvatarIndex, new_icon_index); |
| cache.SetIsUsingGAIAPictureOfProfileAtIndex(profile_index, false); |
| } |