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

Unified Diff: chrome/browser/ui/webui/options2/browser_options_handler2.cc

Issue 10139019: [webui settings] send user profiles info earlier during load (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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
« no previous file with comments | « chrome/browser/ui/webui/options2/browser_options_handler2.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/options2/browser_options_handler2.cc
diff --git a/chrome/browser/ui/webui/options2/browser_options_handler2.cc b/chrome/browser/ui/webui/options2/browser_options_handler2.cc
index 62bf4c23d071e75b529c847dd39f6056f787497b..b8696059a0466da4ae6782b1688504bc95c965ec 100644
--- a/chrome/browser/ui/webui/options2/browser_options_handler2.cc
+++ b/chrome/browser/ui/webui/options2/browser_options_handler2.cc
@@ -391,6 +391,9 @@ void BrowserOptionsHandler::GetLocalizedValues(DictionaryValue* values) {
values->SetBoolean("multiple_profiles",
g_browser_process->profile_manager()->GetNumberOfProfiles() > 1);
#endif
+
+ if (multiprofile_)
+ values->Set("profilesInfo", GetProfilesInfoList());
}
void BrowserOptionsHandler::RegisterCloudPrintValues(DictionaryValue* values) {
@@ -610,9 +613,6 @@ void BrowserOptionsHandler::InitializePage() {
OnTemplateURLServiceChanged();
ObserveThemeChanged();
- if (multiprofile_)
- SendProfilesInfo();
-
SetupMetricsReportingCheckbox();
SetupMetricsReportingSettingVisibility();
SetupFontSizeSelector();
@@ -901,20 +901,13 @@ void BrowserOptionsHandler::GetInstantFieldTrialStatus(const ListValue* args) {
enabled);
}
-void BrowserOptionsHandler::SendProfilesInfo() {
- // Set profile creation text and button if multi-profiles switch is on.
- scoped_ptr<Value> visible(Value::CreateBooleanValue(multiprofile_));
- web_ui()->CallJavascriptFunction("BrowserOptions.setProfilesSectionVisible",
- *visible);
-
- if (!multiprofile_)
- return;
-
+ListValue* BrowserOptionsHandler::GetProfilesInfoList() {
ProfileInfoCache& cache =
g_browser_process->profile_manager()->GetProfileInfoCache();
- ListValue profile_info_list;
+ ListValue* profile_info_list = new ListValue;
sail 2012/04/23 15:44:53 Maybe make this a scoped_ptr and do a release at t
Evan Stade 2012/04/23 20:19:02 that would delete the object
Evan Stade 2012/04/23 21:55:47 Done.
FilePath current_profile_path =
web_ui()->GetWebContents()->GetBrowserContext()->GetPath();
+
for (size_t i = 0, e = cache.GetNumberOfProfiles(); i < e; ++i) {
DictionaryValue* profile_value = new DictionaryValue();
FilePath profile_path = cache.GetPathOfProfileAtIndex(i);
@@ -937,11 +930,16 @@ void BrowserOptionsHandler::SendProfilesInfo() {
cache.GetDefaultAvatarIconUrl(icon_index));
}
- profile_info_list.Append(profile_value);
+ profile_info_list->Append(profile_value);
}
+ return profile_info_list;
+}
+
+void BrowserOptionsHandler::SendProfilesInfo() {
+ scoped_ptr<ListValue> profile_info_list(GetProfilesInfoList());
web_ui()->CallJavascriptFunction("BrowserOptions.setProfilesInfo",
- profile_info_list);
+ *profile_info_list);
}
void BrowserOptionsHandler::CreateProfile(const ListValue* args) {
« no previous file with comments | « chrome/browser/ui/webui/options2/browser_options_handler2.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698