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

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

Issue 6672063: web-ui settings: Font setting fixes and improvements.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: code review fix Created 9 years, 9 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/options/font_settings_handler.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/options/font_settings_handler.cc
===================================================================
--- chrome/browser/ui/webui/options/font_settings_handler.cc (revision 78298)
+++ chrome/browser/ui/webui/options/font_settings_handler.cc (working copy)
@@ -39,6 +39,10 @@
static OptionsStringResource resources[] = {
{ "fontSettingsStandard",
IDS_FONT_LANGUAGE_SETTING_FONT_SELECTOR_STANDARD_LABEL },
+ { "fontSettingsSerif",
+ IDS_FONT_LANGUAGE_SETTING_FONT_SELECTOR_SERIF_LABEL },
+ { "fontSettingsSansSerif",
+ IDS_FONT_LANGUAGE_SETTING_FONT_SELECTOR_SANS_SERIF_LABEL },
{ "fontSettingsFixedWidth",
IDS_FONT_LANGUAGE_SETTING_FONT_SELECTOR_FIXED_WIDTH_LABEL },
{ "fontSettingsMinimumSize",
@@ -68,8 +72,10 @@
void FontSettingsHandler::Initialize() {
DCHECK(web_ui_);
SetupStandardFontSample();
+ SetupSerifFontSample();
+ SetupSansSerifFontSample();
+ SetupFixedFontSample();
SetupMinimumFontSample();
- SetupFixedFontSample();
}
WebUIMessageHandler* FontSettingsHandler::Attach(WebUI* web_ui) {
@@ -83,6 +89,8 @@
// Register for preferences that we need to observe manually.
standard_font_.Init(prefs::kWebKitStandardFontFamily, pref_service, this);
+ serif_font_.Init(prefs::kWebKitSerifFontFamily, pref_service, this);
+ sans_serif_font_.Init(prefs::kWebKitSansSerifFontFamily, pref_service, this);
fixed_font_.Init(prefs::kWebKitFixedFontFamily, pref_service, this);
font_encoding_.Init(prefs::kDefaultCharset, pref_service, this);
default_font_size_.Init(prefs::kWebKitDefaultFontSize, pref_service, this);
@@ -137,6 +145,8 @@
ListValue selected_values;
selected_values.Append(Value::CreateStringValue(standard_font_.GetValue()));
+ selected_values.Append(Value::CreateStringValue(serif_font_.GetValue()));
+ selected_values.Append(Value::CreateStringValue(sans_serif_font_.GetValue()));
selected_values.Append(Value::CreateStringValue(fixed_font_.GetValue()));
selected_values.Append(Value::CreateStringValue(font_encoding_.GetValue()));
@@ -149,12 +159,19 @@
const NotificationDetails& details) {
if (type == NotificationType::PREF_CHANGED) {
std::string* pref_name = Details<std::string>(details).ptr();
- if (*pref_name == prefs::kWebKitStandardFontFamily ||
- *pref_name == prefs::kWebKitDefaultFontSize) {
+ if (*pref_name == prefs::kWebKitStandardFontFamily) {
SetupStandardFontSample();
+ } else if (*pref_name == prefs::kWebKitSerifFontFamily) {
+ SetupSerifFontSample();
+ } else if (*pref_name == prefs::kWebKitSansSerifFontFamily) {
+ SetupSansSerifFontSample();
} else if (*pref_name == prefs::kWebKitFixedFontFamily ||
*pref_name == prefs::kWebKitDefaultFixedFontSize) {
SetupFixedFontSample();
+ } else if (*pref_name == prefs::kWebKitDefaultFontSize) {
+ SetupStandardFontSample();
+ SetupSerifFontSample();
+ SetupSansSerifFontSample();
} else if (*pref_name == prefs::kWebKitMinimumFontSize) {
SetupMinimumFontSample();
}
@@ -168,6 +185,20 @@
"FontSettings.setupStandardFontSample", font_value, size_value);
}
+void FontSettingsHandler::SetupSerifFontSample() {
+ StringValue font_value(serif_font_.GetValue());
+ FundamentalValue size_value(default_font_size_.GetValue());
+ web_ui_->CallJavascriptFunction(
+ "FontSettings.setupSerifFontSample", font_value, size_value);
+}
+
+void FontSettingsHandler::SetupSansSerifFontSample() {
+ StringValue font_value(sans_serif_font_.GetValue());
+ FundamentalValue size_value(default_font_size_.GetValue());
+ web_ui_->CallJavascriptFunction(
+ "FontSettings.setupSansSerifFontSample", font_value, size_value);
+}
+
void FontSettingsHandler::SetupFixedFontSample() {
StringValue font_value(fixed_font_.GetValue());
FundamentalValue size_value(default_fixed_font_size_.GetValue());
« no previous file with comments | « chrome/browser/ui/webui/options/font_settings_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698