OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 (function() { | 5 (function() { |
6 'use strict'; | 6 'use strict'; |
7 | 7 |
8 /** | 8 /** |
9 * This is the absolute difference maintained between standard and | 9 * This is the absolute difference maintained between standard and |
10 * fixed-width font sizes. http://crbug.com/91922. | 10 * fixed-width font sizes. http://crbug.com/91922. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 /** @private */ | 44 /** @private */ |
45 advancedExtensionSublabel_: String, | 45 advancedExtensionSublabel_: String, |
46 | 46 |
47 /** @private */ | 47 /** @private */ |
48 advancedExtensionUrl_: String, | 48 advancedExtensionUrl_: String, |
49 | 49 |
50 /** @private {!settings.FontsBrowserProxy} */ | 50 /** @private {!settings.FontsBrowserProxy} */ |
51 browserProxy_: Object, | 51 browserProxy_: Object, |
52 | 52 |
53 /** @private {!DropdownMenuOptionList} */ | 53 /** @private {!DropdownMenuOptionList} */ |
54 encodingOptions_: Object, | |
55 | |
56 /** @private {!DropdownMenuOptionList} */ | |
57 fontOptions_: Object, | 54 fontOptions_: Object, |
58 | 55 |
59 /** | 56 /** |
60 * Common font sizes. | 57 * Common font sizes. |
61 * @private {!Array<number>} | 58 * @private {!Array<number>} |
62 */ | 59 */ |
63 fontSizeRange_: { | 60 fontSizeRange_: { |
64 readOnly: true, | 61 readOnly: true, |
65 type: Array, | 62 type: Array, |
66 value: FONT_SIZE_RANGE_, | 63 value: FONT_SIZE_RANGE_, |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 * extension is installed. | 114 * extension is installed. |
118 * @private | 115 * @private |
119 */ | 116 */ |
120 setAdvancedExtensionInstalled_: function(isInstalled) { | 117 setAdvancedExtensionInstalled_: function(isInstalled) { |
121 this.advancedExtensionInstalled_ = isInstalled; | 118 this.advancedExtensionInstalled_ = isInstalled; |
122 this.advancedExtensionSublabel_ = this.i18n(isInstalled ? | 119 this.advancedExtensionSublabel_ = this.i18n(isInstalled ? |
123 'openAdvancedFontSettings' : 'requiresWebStoreExtension'); | 120 'openAdvancedFontSettings' : 'requiresWebStoreExtension'); |
124 }, | 121 }, |
125 | 122 |
126 /** | 123 /** |
127 * @param {!FontsData} response A list of fonts, encodings and the advanced | 124 * @param {!FontsData} response A list of fonts and the advanced |
128 * font settings extension URL. | 125 * font settings extension URL. |
129 * @private | 126 * @private |
130 */ | 127 */ |
131 setFontsData_: function(response) { | 128 setFontsData_: function(response) { |
132 var fontMenuOptions = []; | 129 var fontMenuOptions = []; |
133 for (var i = 0; i < response.fontList.length; ++i) { | 130 for (var i = 0; i < response.fontList.length; ++i) { |
134 fontMenuOptions.push({ | 131 fontMenuOptions.push({ |
135 value: response.fontList[i][0], | 132 value: response.fontList[i][0], |
136 name: response.fontList[i][1] | 133 name: response.fontList[i][1] |
137 }); | 134 }); |
138 } | 135 } |
139 this.fontOptions_ = fontMenuOptions; | 136 this.fontOptions_ = fontMenuOptions; |
140 | |
141 var encodingMenuOptions = []; | |
142 for (i = 0; i < response.encodingList.length; ++i) { | |
143 encodingMenuOptions.push({ | |
144 value: response.encodingList[i][0], | |
145 name: response.encodingList[i][1] | |
146 }); | |
147 } | |
148 this.encodingOptions_ = encodingMenuOptions; | |
149 this.advancedExtensionUrl_ = response.extensionUrl; | 137 this.advancedExtensionUrl_ = response.extensionUrl; |
150 }, | 138 }, |
151 | 139 |
152 /** | 140 /** |
153 * @param {number} value The changed font size slider value. | 141 * @param {number} value The changed font size slider value. |
154 * @private | 142 * @private |
155 */ | 143 */ |
156 fontSizeChanged_: function(value) { | 144 fontSizeChanged_: function(value) { |
157 // TODO(michaelpg): Whitelist this pref in prefs_utils.cc so it is | 145 // TODO(michaelpg): Whitelist this pref in prefs_utils.cc so it is |
158 // included in the <settings-prefs> getAllPrefs call, otherwise this path | 146 // included in the <settings-prefs> getAllPrefs call, otherwise this path |
159 // is invalid and nothing happens. See crbug.com/612535. | 147 // is invalid and nothing happens. See crbug.com/612535. |
160 this.set('prefs.webkit.webprefs.default_fixed_font_size.value', | 148 this.set('prefs.webkit.webprefs.default_fixed_font_size.value', |
161 value - SIZE_DIFFERENCE_FIXED_STANDARD_); | 149 value - SIZE_DIFFERENCE_FIXED_STANDARD_); |
162 }, | 150 }, |
163 | 151 |
164 /** | 152 /** |
165 * Creates an html style value. | 153 * Creates an html style value. |
166 * @param {number} fontSize The font size to use. | 154 * @param {number} fontSize The font size to use. |
167 * @param {string} fontFamily The name of the font family use. | 155 * @param {string} fontFamily The name of the font family use. |
168 * @return {string} | 156 * @return {string} |
169 * @private | 157 * @private |
170 */ | 158 */ |
171 computeStyle_: function(fontSize, fontFamily) { | 159 computeStyle_: function(fontSize, fontFamily) { |
172 return 'font-size: ' + fontSize + "px; font-family: '" + fontFamily + | 160 return 'font-size: ' + fontSize + "px; font-family: '" + fontFamily + |
173 "';"; | 161 "';"; |
174 }, | 162 }, |
175 }); | 163 }); |
176 })(); | 164 })(); |
OLD | NEW |