Chromium Code Reviews| 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..ab677dddc4a816c7cab58f2909db66e7e0eb2256 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", |
|
csilv
2010/12/22 02:35:27
change string prefix to "fontSize" (ie lowercase '
kmadhusu
2010/12/22 19:15:02
Done.
|
| + 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 || |
|
csilv
2010/12/22 02:35:27
add space after 'if'.
kmadhusu
2010/12/22 19:15:02
Done.
|
| + *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(static_cast<double>(font_size)); |
| + default_fixed_font_size_.SetValue(static_cast<double>(font_size)); |
| + SetupFontSizeLabel(); |
| + } |
| + } |
| +} |
| + |
| #if defined(OS_WIN) |
| void AdvancedOptionsHandler::HandleCheckRevocationCheckbox( |
| const ListValue* args) { |
| @@ -492,6 +526,16 @@ 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( |
| + static_cast<int>(default_fixed_font_size_.GetValue())); |
| + FundamentalValue font_size(static_cast<int>(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( |