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

Side by Side Diff: chrome/browser/resources/options2/font_settings.js

Issue 10391044: retry 136193 - convert localStrings to loadTimeData for options page (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 cr.define('options', function() { 5 cr.define('options', function() {
6 6
7 var OptionsPage = options.OptionsPage; 7 var OptionsPage = options.OptionsPage;
8 8
9 /** 9 /**
10 * FontSettings class 10 * FontSettings class
11 * Encapsulated handling of the 'Fonts and Encoding' page. 11 * Encapsulated handling of the 'Fonts and Encoding' page.
12 * @class 12 * @class
13 */ 13 */
14 function FontSettings() { 14 function FontSettings() {
15 OptionsPage.call(this, 15 OptionsPage.call(this,
16 'fonts', 16 'fonts',
17 templateData.fontSettingsPageTabTitle, 17 loadTimeData.getString('fontSettingsPageTabTitle'),
18 'font-settings'); 18 'font-settings');
19 } 19 }
20 20
21 cr.addSingletonGetter(FontSettings); 21 cr.addSingletonGetter(FontSettings);
22 22
23 FontSettings.prototype = { 23 FontSettings.prototype = {
24 __proto__: OptionsPage.prototype, 24 __proto__: OptionsPage.prototype,
25 25
26 /** 26 /**
27 * Initialize the page. 27 * Initialize the page.
(...skipping 10 matching lines...) Expand all
38 this.standardFontSizeChanged_.bind(this); 38 this.standardFontSizeChanged_.bind(this);
39 39
40 var minimumFontRange = $('minimum-font-size'); 40 var minimumFontRange = $('minimum-font-size');
41 minimumFontRange.valueMap = [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 41 minimumFontRange.valueMap = [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
42 18, 20, 22, 24]; 42 18, 20, 22, 24];
43 minimumFontRange.continuous = false; 43 minimumFontRange.continuous = false;
44 minimumFontRange.notifyChange = this.minimumRangeChanged_.bind(this); 44 minimumFontRange.notifyChange = this.minimumRangeChanged_.bind(this);
45 minimumFontRange.notifyPrefChange = 45 minimumFontRange.notifyPrefChange =
46 this.minimumFontSizeChanged_.bind(this); 46 this.minimumFontSizeChanged_.bind(this);
47 47
48 var placeholder = localStrings.getString('fontSettingsPlaceholder'); 48 var placeholder = loadTimeData.getString('fontSettingsPlaceholder');
49 var elements = [$('standard-font-family'), $('serif-font-family'), 49 var elements = [$('standard-font-family'), $('serif-font-family'),
50 $('sans-serif-font-family'), $('fixed-font-family'), 50 $('sans-serif-font-family'), $('fixed-font-family'),
51 $('font-encoding')]; 51 $('font-encoding')];
52 elements.forEach(function(el) { 52 elements.forEach(function(el) {
53 el.appendChild(new Option(placeholder)); 53 el.appendChild(new Option(placeholder));
54 el.setDisabled('noFontsAvailable', true); 54 el.setDisabled('noFontsAvailable', true);
55 }); 55 });
56 56
57 $('font-settings-confirm').onclick = function() { 57 $('font-settings-confirm').onclick = function() {
58 OptionsPage.closeOverlay(); 58 OptionsPage.closeOverlay();
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 * Sets the text, font size and font family of the sample text. 141 * Sets the text, font size and font family of the sample text.
142 * @param {Element} el The div containing the sample text. 142 * @param {Element} el The div containing the sample text.
143 * @param {number} size The font size of the sample text. 143 * @param {number} size The font size of the sample text.
144 * @param {string} font The font family of the sample text. 144 * @param {string} font The font family of the sample text.
145 * @param {bool} showSize True if the font size should appear in the sample. 145 * @param {bool} showSize True if the font size should appear in the sample.
146 * @private 146 * @private
147 */ 147 */
148 setUpFontSample_: function(el, size, font, showSize) { 148 setUpFontSample_: function(el, size, font, showSize) {
149 var prefix = showSize ? (size + ': ') : ''; 149 var prefix = showSize ? (size + ': ') : '';
150 el.textContent = prefix + 150 el.textContent = prefix +
151 localStrings.getString('fontSettingsLoremIpsum'); 151 loadTimeData.getString('fontSettingsLoremIpsum');
152 el.style.fontSize = size + 'px'; 152 el.style.fontSize = size + 'px';
153 if (font) 153 if (font)
154 el.style.fontFamily = font; 154 el.style.fontFamily = font;
155 }, 155 },
156 156
157 /** 157 /**
158 * Populates a select list and selects the specified item. 158 * Populates a select list and selects the specified item.
159 * @param {Element} element The select element to populate. 159 * @param {Element} element The select element to populate.
160 * @param {Array} items The array of items from which to populate. 160 * @param {Array} items The array of items from which to populate.
161 * @param {string} selectedValue The selected item. 161 * @param {string} selectedValue The selected item.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 FontSettings.getInstance().setUpFontSample_($('minimum-font-sample'), size, 227 FontSettings.getInstance().setUpFontSample_($('minimum-font-sample'), size,
228 null, true); 228 null, true);
229 }; 229 };
230 230
231 // Export 231 // Export
232 return { 232 return {
233 FontSettings: FontSettings 233 FontSettings: FontSettings
234 }; 234 };
235 }); 235 });
236 236
OLDNEW
« no previous file with comments | « chrome/browser/resources/options2/cookies_view.js ('k') | chrome/browser/resources/options2/handler_options.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698