Index: chrome/browser/ui/webui/options/personal_options_handler.cc |
diff --git a/chrome/browser/ui/webui/options/personal_options_handler.cc b/chrome/browser/ui/webui/options/personal_options_handler.cc |
index 10fcf2a5930920a47a69c429e893166827024d21..291a6a8ec9c3ecbe1eeed0638a8ba2e9bd9e031a 100644 |
--- a/chrome/browser/ui/webui/options/personal_options_handler.cc |
+++ b/chrome/browser/ui/webui/options/personal_options_handler.cc |
@@ -19,6 +19,7 @@ |
#include "chrome/browser/browser_process.h" |
#include "chrome/browser/google/google_util.h" |
#include "chrome/browser/profiles/profile.h" |
+#include "chrome/browser/profiles/profile_info_util.h" |
#include "chrome/browser/profiles/profile_info_cache.h" |
#include "chrome/browser/profiles/profile_manager.h" |
#include "chrome/browser/sync/profile_sync_service.h" |
@@ -404,17 +405,17 @@ void PersonalOptionsHandler::SendProfilesInfo() { |
ListValue profile_info_list; |
FilePath current_profile_path = |
web_ui_->tab_contents()->browser_context()->GetPath(); |
- for (size_t i = 0, e = cache.GetNumberOfProfiles(); i < e; ++i) { |
- DictionaryValue* profile_value = new DictionaryValue(); |
- size_t icon_index = cache.GetAvatarIconIndexOfProfileAtIndex(i); |
- FilePath profile_path = cache.GetPathOfProfileAtIndex(i); |
- profile_value->SetString("name", cache.GetNameOfProfileAtIndex(i)); |
- profile_value->SetString("iconURL", |
- cache.GetDefaultAvatarIconUrl(icon_index)); |
- profile_value->Set("filePath", base::CreateFilePathValue(profile_path)); |
- profile_value->SetBoolean("isCurrentProfile", |
- profile_path == current_profile_path); |
- profile_info_list.Append(profile_value); |
+ |
+ const std::vector<ProfileInfoEntry> entries(cache.GetProfilesSortedByName()); |
+ for (std::vector<ProfileInfoEntry>::const_iterator it = entries.begin(); |
+ it != entries.end(); ++it) { |
+ DictionaryValue* value = new DictionaryValue(); |
+ value->SetString("name", it->name()); |
+ value->SetString("iconURL", |
+ profiles::GetDefaultAvatarIconUrl(it->icon_index())); |
+ value->Set("filePath", base::CreateFilePathValue(it->path())); |
+ value->SetBoolean("isCurrentProfile", it->path() == current_profile_path); |
+ profile_info_list.Append(value); |
} |
web_ui_->CallJavascriptFunction("PersonalOptions.setProfilesInfo", |