| OLD | NEW |
| 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 var Page = cr.ui.pageManager.Page; |
| 9 var PageManager = cr.ui.pageManager.PageManager; |
| 8 | 10 |
| 9 /** | 11 /** |
| 10 * FontSettings class | 12 * FontSettings class |
| 11 * Encapsulated handling of the 'Fonts and Encoding' page. | 13 * Encapsulated handling of the 'Fonts and Encoding' page. |
| 12 * @class | 14 * @class |
| 13 */ | 15 */ |
| 14 function FontSettings() { | 16 function FontSettings() { |
| 15 OptionsPage.call(this, | 17 Page.call(this, 'fonts', |
| 16 'fonts', | 18 loadTimeData.getString('fontSettingsPageTabTitle'), |
| 17 loadTimeData.getString('fontSettingsPageTabTitle'), | 19 'font-settings'); |
| 18 'font-settings'); | |
| 19 } | 20 } |
| 20 | 21 |
| 21 cr.addSingletonGetter(FontSettings); | 22 cr.addSingletonGetter(FontSettings); |
| 22 | 23 |
| 23 FontSettings.prototype = { | 24 FontSettings.prototype = { |
| 24 __proto__: OptionsPage.prototype, | 25 __proto__: Page.prototype, |
| 25 | 26 |
| 26 /** @override */ | 27 /** @override */ |
| 27 initializePage: function() { | 28 initializePage: function() { |
| 28 OptionsPage.prototype.initializePage.call(this); | 29 Page.prototype.initializePage.call(this); |
| 29 | 30 |
| 30 var standardFontRange = $('standard-font-size'); | 31 var standardFontRange = $('standard-font-size'); |
| 31 standardFontRange.valueMap = [9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, | 32 standardFontRange.valueMap = [9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, |
| 32 22, 24, 26, 28, 30, 32, 34, 36, 40, 44, 48, 56, 64, 72]; | 33 22, 24, 26, 28, 30, 32, 34, 36, 40, 44, 48, 56, 64, 72]; |
| 33 standardFontRange.addEventListener( | 34 standardFontRange.addEventListener( |
| 34 'change', this.standardRangeChanged_.bind(this, standardFontRange)); | 35 'change', this.standardRangeChanged_.bind(this, standardFontRange)); |
| 35 standardFontRange.addEventListener( | 36 standardFontRange.addEventListener( |
| 36 'input', this.standardRangeChanged_.bind(this, standardFontRange)); | 37 'input', this.standardRangeChanged_.bind(this, standardFontRange)); |
| 37 standardFontRange.customChangeHandler = | 38 standardFontRange.customChangeHandler = |
| 38 this.standardFontSizeChanged_.bind(standardFontRange); | 39 this.standardFontSizeChanged_.bind(standardFontRange); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 50 var placeholder = loadTimeData.getString('fontSettingsPlaceholder'); | 51 var placeholder = loadTimeData.getString('fontSettingsPlaceholder'); |
| 51 var elements = [$('standard-font-family'), $('serif-font-family'), | 52 var elements = [$('standard-font-family'), $('serif-font-family'), |
| 52 $('sans-serif-font-family'), $('fixed-font-family'), | 53 $('sans-serif-font-family'), $('fixed-font-family'), |
| 53 $('font-encoding')]; | 54 $('font-encoding')]; |
| 54 elements.forEach(function(el) { | 55 elements.forEach(function(el) { |
| 55 el.appendChild(new Option(placeholder)); | 56 el.appendChild(new Option(placeholder)); |
| 56 el.setDisabled('noFontsAvailable', true); | 57 el.setDisabled('noFontsAvailable', true); |
| 57 }); | 58 }); |
| 58 | 59 |
| 59 $('font-settings-confirm').onclick = function() { | 60 $('font-settings-confirm').onclick = function() { |
| 60 OptionsPage.closeOverlay(); | 61 PageManager.closeOverlay(); |
| 61 }; | 62 }; |
| 62 | 63 |
| 63 $('advanced-font-settings-options').onclick = function() { | 64 $('advanced-font-settings-options').onclick = function() { |
| 64 chrome.send('openAdvancedFontSettingsOptions'); | 65 chrome.send('openAdvancedFontSettingsOptions'); |
| 65 }; | 66 }; |
| 66 }, | 67 }, |
| 67 | 68 |
| 68 /** | 69 /** |
| 69 * Called by the options page when this page has been shown. | 70 * Called by the options page when this page has been shown. |
| 70 */ | 71 */ |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 $('advanced-font-settings-install').hidden = available; | 249 $('advanced-font-settings-install').hidden = available; |
| 249 $('advanced-font-settings-options').hidden = !available; | 250 $('advanced-font-settings-options').hidden = !available; |
| 250 }; | 251 }; |
| 251 | 252 |
| 252 // Export | 253 // Export |
| 253 return { | 254 return { |
| 254 FontSettings: FontSettings | 255 FontSettings: FontSettings |
| 255 }; | 256 }; |
| 256 }); | 257 }); |
| 257 | 258 |
| OLD | NEW |