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