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

Unified Diff: chrome/browser/dom_ui/options/advanced_options_handler.cc

Issue 6057003: DOMUI Settings: UTH: Fix up the 'Web Content' section. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 10 years 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/dom_ui/options/advanced_options_handler.cc
diff --git a/chrome/browser/dom_ui/options/advanced_options_handler.cc b/chrome/browser/dom_ui/options/advanced_options_handler.cc
index 9bb8ed00087a1f4348057c9297e4462d9f299151..9531d84a727e07e13956695e0d63f41e00946c88 100644
--- a/chrome/browser/dom_ui/options/advanced_options_handler.cc
+++ b/chrome/browser/dom_ui/options/advanced_options_handler.cc
@@ -122,6 +122,20 @@ void AdvancedOptionsHandler::GetLocalizedValues(
l10n_util::GetStringUTF16(IDS_OPTIONS_FONTSETTINGS_INFO));
localized_strings->SetString("defaultZoomLevelLabel",
l10n_util::GetStringUTF16(IDS_OPTIONS_DEFAULT_ZOOM_LEVEL_LABEL));
+ localized_strings->SetString("defaultFontSizeLabel",
+ l10n_util::GetStringUTF16(IDS_OPTIONS_DEFAULT_FONT_SIZE_LABEL));
+ localized_strings->SetString("fontSizeLabelVerySmall",
+ l10n_util::GetStringUTF16(IDS_OPTIONS_FONT_SIZE_LABEL_VERY_SMALL));
+ localized_strings->SetString("fontSizeLabelSmall",
+ l10n_util::GetStringUTF16(IDS_OPTIONS_FONT_SIZE_LABEL_SMALL));
+ localized_strings->SetString("fontSizeLabelMedium",
+ l10n_util::GetStringUTF16(IDS_OPTIONS_FONT_SIZE_LABEL_MEDIUM));
+ localized_strings->SetString("fontSizeLabelLarge",
+ l10n_util::GetStringUTF16(IDS_OPTIONS_FONT_SIZE_LABEL_LARGE));
+ localized_strings->SetString("fontSizeLabelVeryLarge",
+ l10n_util::GetStringUTF16(IDS_OPTIONS_FONT_SIZE_LABEL_VERY_LARGE));
+ localized_strings->SetString("fontSizeLabelCustom",
+ l10n_util::GetStringUTF16(IDS_OPTIONS_FONT_SIZE_LABEL_CUSTOM));
localized_strings->SetString("fontSettingsCustomizeFontsButton",
l10n_util::GetStringUTF16(
IDS_OPTIONS_FONTSETTINGS_CUSTOMIZE_FONTS_BUTTON));
@@ -180,6 +194,7 @@ void AdvancedOptionsHandler::Initialize() {
SetupMetricsReportingCheckbox();
SetupMetricsReportingSettingVisibility();
SetupDefaultZoomLevel();
+ SetupFontSizeLabel();
SetupDownloadLocationPath();
SetupAutoOpenFileTypesDisabledAttribute();
SetupProxySettingsSection();
@@ -215,6 +230,9 @@ DOMMessageHandler* AdvancedOptionsHandler::Attach(DOMUI* dom_ui) {
prefs, this);
auto_open_files_.Init(prefs::kDownloadExtensionsToOpen, prefs, this);
default_zoom_level_.Init(prefs::kDefaultZoomLevel, prefs, this);
+ default_font_size_.Init(prefs::kWebKitDefaultFontSize, prefs, this);
+ default_fixed_font_size_.Init(prefs::kWebKitDefaultFixedFontSize, prefs,
+ this);
proxy_prefs_.reset(
PrefSetObserver::CreateProxyPrefSetObserver(prefs, this));
@@ -233,6 +251,8 @@ void AdvancedOptionsHandler::RegisterMessages() {
&AdvancedOptionsHandler::HandleAutoOpenButton));
dom_ui_->RegisterMessageCallback("defaultZoomLevelAction",
NewCallback(this, &AdvancedOptionsHandler::HandleDefaultZoomLevel));
+ dom_ui_->RegisterMessageCallback("defaultFontSizeAction",
+ NewCallback(this, &AdvancedOptionsHandler::HandleDefaultFontSize));
#if !defined(OS_CHROMEOS)
dom_ui_->RegisterMessageCallback("metricsReportingCheckboxAction",
NewCallback(this,
@@ -293,6 +313,9 @@ void AdvancedOptionsHandler::Observe(NotificationType type,
if (cloud_print_proxy_ui_enabled_)
SetupCloudPrintProxySection();
#endif
+ } else if (*pref_name == prefs::kWebKitDefaultFontSize ||
+ *pref_name == prefs::kWebKitDefaultFixedFontSize) {
+ SetupFontSizeLabel();
}
}
}
@@ -353,6 +376,17 @@ void AdvancedOptionsHandler::HandleDefaultZoomLevel(const ListValue* args) {
}
}
+void AdvancedOptionsHandler::HandleDefaultFontSize(const ListValue* args) {
+ int font_size;
+ if (ExtractIntegerValue(args, &font_size)) {
+ if (font_size > 0) {
+ default_font_size_.SetValue(font_size);
+ default_fixed_font_size_.SetValue(font_size);
+ SetupFontSizeLabel();
+ }
+ }
+}
+
#if defined(OS_WIN)
void AdvancedOptionsHandler::HandleCheckRevocationCheckbox(
const ListValue* args) {
@@ -492,6 +526,15 @@ void AdvancedOptionsHandler::SetupDefaultZoomLevel() {
L"options.AdvancedOptions.SetDefaultZoomLevel", value);
}
+void AdvancedOptionsHandler::SetupFontSizeLabel() {
+ // We're only interested in integer values, so convert to int.
+ FundamentalValue fixed_font_size(default_fixed_font_size_.GetValue());
+ FundamentalValue font_size(default_font_size_.GetValue());
+ dom_ui_->CallJavascriptFunction(
+ L"options.AdvancedOptions.SetFontSize", fixed_font_size,
+ font_size);
+}
+
void AdvancedOptionsHandler::SetupDownloadLocationPath() {
StringValue value(default_download_location_.GetValue().value());
dom_ui_->CallJavascriptFunction(
« no previous file with comments | « chrome/browser/dom_ui/options/advanced_options_handler.h ('k') | chrome/browser/resources/options/advanced_options.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698