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

Unified Diff: chrome/browser/resources/options2/font_settings.js

Issue 10827141: Move handling of dialog preferences to Preferences class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix my rushed copy & paste :( Created 8 years, 5 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
Index: chrome/browser/resources/options2/font_settings.js
diff --git a/chrome/browser/resources/options2/font_settings.js b/chrome/browser/resources/options2/font_settings.js
index df027985d1d35b84da536e706ea6aeea723ff449..27b03a429f3de647e5741f00ae395237f60f95c4 100644
--- a/chrome/browser/resources/options2/font_settings.js
+++ b/chrome/browser/resources/options2/font_settings.js
@@ -34,16 +34,28 @@ cr.define('options', function() {
22, 24, 26, 28, 30, 32, 34, 36, 40, 44, 48, 56, 64, 72];
standardFontRange.continuous = false;
standardFontRange.notifyChange = this.standardRangeChanged_.bind(this);
- standardFontRange.notifyPrefChange =
- this.standardFontSizeChanged_.bind(this);
+ Preferences.getInstance().addEventListener(
+ standardFontRange.pref,
+ function(event) {
+ Preferences.setIntegerPref(
+ 'webkit.webprefs.default_fixed_font_size',
+ event.value.value - OptionsPage.SIZE_DIFFERENCE_FIXED_STANDARD,
+ true);
+ });
var minimumFontRange = $('minimum-font-size');
minimumFontRange.valueMap = [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
18, 20, 22, 24];
minimumFontRange.continuous = false;
minimumFontRange.notifyChange = this.minimumRangeChanged_.bind(this);
- minimumFontRange.notifyPrefChange =
- this.minimumFontSizeChanged_.bind(this);
+ Preferences.getInstance().addEventListener(
+ minimumFontRange.pref,
+ function(event) {
+ Preferences.setIntegerPref(
+ 'webkit.webprefs.minimum_logical_font_size',
+ event.value.value,
+ true);
+ });
var placeholder = loadTimeData.getString('fontSettingsPlaceholder');
var elements = [$('standard-font-family'), $('serif-font-family'),
@@ -100,19 +112,6 @@ cr.define('options', function() {
},
/**
- * Sets the 'default_fixed_font_size' preference when the standard font
- * size has been changed by the user.
- * @param {Element} el The slider input element.
- * @param {number} value The mapped value that has been saved.
- * @private
- */
- standardFontSizeChanged_: function(el, value) {
- Preferences.setIntegerPref(
- 'webkit.webprefs.default_fixed_font_size',
- value - OptionsPage.SIZE_DIFFERENCE_FIXED_STANDARD, '');
- },
-
- /**
* Called as the user changes the miniumum font size. This allows for
* reflecting the change in the UI before the preference has been changed.
* @param {Element} el The slider input element.
@@ -126,18 +125,6 @@ cr.define('options', function() {
},
/**
- * Sets the 'minimum_logical_font_size' preference when the minimum font
- * size has been changed by the user.
- * @param {Element} el The slider input element.
- * @param {number} value The mapped value that has been saved.
- * @private
- */
- minimumFontSizeChanged_: function(el, value) {
- Preferences.setIntegerPref(
- 'webkit.webprefs.minimum_logical_font_size', value, '');
- },
-
- /**
* Sets the text, font size and font family of the sample text.
* @param {Element} el The div containing the sample text.
* @param {number} size The font size of the sample text.

Powered by Google App Engine
This is Rietveld 408576698