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

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

Issue 33753002: Sooper experimental refactoring of the profile info cache. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 7 years, 2 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/browser_options_handler.cc
diff --git a/chrome/browser/ui/webui/options/browser_options_handler.cc b/chrome/browser/ui/webui/options/browser_options_handler.cc
index 60b178fdb055465253c424b79c7a89e1eda235d4..8971e86c0144dfce3eb023577de636cf7f956ff8 100644
--- a/chrome/browser/ui/webui/options/browser_options_handler.cc
+++ b/chrome/browser/ui/webui/options/browser_options_handler.cc
@@ -1061,25 +1061,28 @@ scoped_ptr<ListValue> BrowserOptionsHandler::GetProfilesInfoList() {
base::FilePath current_profile_path =
web_ui()->GetWebContents()->GetBrowserContext()->GetPath();
- for (size_t i = 0, e = cache.GetNumberOfProfiles(); i < e; ++i) {
+ const std::vector<ProfileInfoEntry> entries(cache.GetProfilesSortedByName());
+ for (std::vector<ProfileInfoEntry>::const_iterator it = entries.begin();
+ it != entries.end(); ++it) {
DictionaryValue* profile_value = new DictionaryValue();
- profile_value->SetString("name", cache.GetNameOfProfileAtIndex(i));
- base::FilePath profile_path = cache.GetPathOfProfileAtIndex(i);
+
+ profile_value->SetString("name", it->GetDisplayName());
+ base::FilePath profile_path = it->path();
profile_value->Set("filePath", base::CreateFilePathValue(profile_path));
profile_value->SetBoolean("isCurrentProfile",
profile_path == current_profile_path);
- profile_value->SetBoolean("isManaged", cache.ProfileIsManagedAtIndex(i));
+ profile_value->SetBoolean("isManaged", it->IsManaged());
bool is_gaia_picture =
- cache.IsUsingGAIAPictureOfProfileAtIndex(i) &&
- cache.GetGAIAPictureOfProfileAtIndex(i);
+ it->is_using_GAIA_picture() &&
+ cache.GetGAIAPictureOfProfile(it->path());
if (is_gaia_picture) {
gfx::Image icon = profiles::GetAvatarIconForWebUI(
- cache.GetAvatarIconOfProfileAtIndex(i), true);
+ cache.GetAvatarIconOfProfile(it->path()), true);
profile_value->SetString("iconURL",
webui::GetBitmapDataUrl(icon.AsBitmap()));
} else {
- size_t icon_index = cache.GetAvatarIconIndexOfProfileAtIndex(i);
+ size_t icon_index = it->icon_index();
profile_value->SetString("iconURL",
cache.GetDefaultAvatarIconUrl(icon_index));
}
« no previous file with comments | « chrome/browser/ui/webui/ntp/ntp_login_handler.cc ('k') | chrome/browser/ui/webui/options/create_profile_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698