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

Side by Side 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, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/options/browser_options_handler.h" 5 #include "chrome/browser/ui/webui/options/browser_options_handler.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "apps/shell_window.h" 10 #include "apps/shell_window.h"
(...skipping 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after
1054 #endif // OS_WIN 1054 #endif // OS_WIN
1055 } 1055 }
1056 1056
1057 scoped_ptr<ListValue> BrowserOptionsHandler::GetProfilesInfoList() { 1057 scoped_ptr<ListValue> BrowserOptionsHandler::GetProfilesInfoList() {
1058 ProfileInfoCache& cache = 1058 ProfileInfoCache& cache =
1059 g_browser_process->profile_manager()->GetProfileInfoCache(); 1059 g_browser_process->profile_manager()->GetProfileInfoCache();
1060 scoped_ptr<ListValue> profile_info_list(new ListValue); 1060 scoped_ptr<ListValue> profile_info_list(new ListValue);
1061 base::FilePath current_profile_path = 1061 base::FilePath current_profile_path =
1062 web_ui()->GetWebContents()->GetBrowserContext()->GetPath(); 1062 web_ui()->GetWebContents()->GetBrowserContext()->GetPath();
1063 1063
1064 for (size_t i = 0, e = cache.GetNumberOfProfiles(); i < e; ++i) { 1064 const std::vector<ProfileInfoEntry> entries(cache.GetProfilesSortedByName());
1065 for (std::vector<ProfileInfoEntry>::const_iterator it = entries.begin();
1066 it != entries.end(); ++it) {
1065 DictionaryValue* profile_value = new DictionaryValue(); 1067 DictionaryValue* profile_value = new DictionaryValue();
1066 profile_value->SetString("name", cache.GetNameOfProfileAtIndex(i)); 1068
1067 base::FilePath profile_path = cache.GetPathOfProfileAtIndex(i); 1069 profile_value->SetString("name", it->GetDisplayName());
1070 base::FilePath profile_path = it->path();
1068 profile_value->Set("filePath", base::CreateFilePathValue(profile_path)); 1071 profile_value->Set("filePath", base::CreateFilePathValue(profile_path));
1069 profile_value->SetBoolean("isCurrentProfile", 1072 profile_value->SetBoolean("isCurrentProfile",
1070 profile_path == current_profile_path); 1073 profile_path == current_profile_path);
1071 profile_value->SetBoolean("isManaged", cache.ProfileIsManagedAtIndex(i)); 1074 profile_value->SetBoolean("isManaged", it->IsManaged());
1072 1075
1073 bool is_gaia_picture = 1076 bool is_gaia_picture =
1074 cache.IsUsingGAIAPictureOfProfileAtIndex(i) && 1077 it->is_using_GAIA_picture() &&
1075 cache.GetGAIAPictureOfProfileAtIndex(i); 1078 cache.GetGAIAPictureOfProfile(it->path());
1076 if (is_gaia_picture) { 1079 if (is_gaia_picture) {
1077 gfx::Image icon = profiles::GetAvatarIconForWebUI( 1080 gfx::Image icon = profiles::GetAvatarIconForWebUI(
1078 cache.GetAvatarIconOfProfileAtIndex(i), true); 1081 cache.GetAvatarIconOfProfile(it->path()), true);
1079 profile_value->SetString("iconURL", 1082 profile_value->SetString("iconURL",
1080 webui::GetBitmapDataUrl(icon.AsBitmap())); 1083 webui::GetBitmapDataUrl(icon.AsBitmap()));
1081 } else { 1084 } else {
1082 size_t icon_index = cache.GetAvatarIconIndexOfProfileAtIndex(i); 1085 size_t icon_index = it->icon_index();
1083 profile_value->SetString("iconURL", 1086 profile_value->SetString("iconURL",
1084 cache.GetDefaultAvatarIconUrl(icon_index)); 1087 cache.GetDefaultAvatarIconUrl(icon_index));
1085 } 1088 }
1086 1089
1087 profile_info_list->Append(profile_value); 1090 profile_info_list->Append(profile_value);
1088 } 1091 }
1089 1092
1090 return profile_info_list.Pass(); 1093 return profile_info_list.Pass();
1091 } 1094 }
1092 1095
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
1564 base::FundamentalValue disabled(is_win_ash || (proxy_config && 1567 base::FundamentalValue disabled(is_win_ash || (proxy_config &&
1565 !proxy_config->IsUserModifiable())); 1568 !proxy_config->IsUserModifiable()));
1566 base::FundamentalValue extension_controlled(is_extension_controlled); 1569 base::FundamentalValue extension_controlled(is_extension_controlled);
1567 web_ui()->CallJavascriptFunction("BrowserOptions.setupProxySettingsSection", 1570 web_ui()->CallJavascriptFunction("BrowserOptions.setupProxySettingsSection",
1568 disabled, extension_controlled); 1571 disabled, extension_controlled);
1569 1572
1570 #endif // !defined(OS_CHROMEOS) 1573 #endif // !defined(OS_CHROMEOS)
1571 } 1574 }
1572 1575
1573 } // namespace options 1576 } // namespace options
OLDNEW
« 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