OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // AdvancedOptions class | 10 // AdvancedOptions class |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 } | 56 } |
57 | 57 |
58 $('fontSettingsCustomizeFontsButton').onclick = function(event) { | 58 $('fontSettingsCustomizeFontsButton').onclick = function(event) { |
59 OptionsPage.navigateToPage('fonts'); | 59 OptionsPage.navigateToPage('fonts'); |
60 chrome.send('coreOptionsUserMetricsAction', ['Options_FontSettings']); | 60 chrome.send('coreOptionsUserMetricsAction', ['Options_FontSettings']); |
61 }; | 61 }; |
62 $('defaultFontSize').onchange = function(event) { | 62 $('defaultFontSize').onchange = function(event) { |
63 chrome.send('defaultFontSizeAction', | 63 chrome.send('defaultFontSizeAction', |
64 [String(event.target.options[event.target.selectedIndex].value)]); | 64 [String(event.target.options[event.target.selectedIndex].value)]); |
65 }; | 65 }; |
| 66 $('defaultZoomFactor').onchange = function(event) { |
| 67 chrome.send('defaultZoomFactorAction', |
| 68 [String(event.target.options[event.target.selectedIndex].value)]); |
| 69 }; |
| 70 |
66 $('language-button').onclick = function(event) { | 71 $('language-button').onclick = function(event) { |
67 OptionsPage.navigateToPage('languages'); | 72 OptionsPage.navigateToPage('languages'); |
68 chrome.send('coreOptionsUserMetricsAction', | 73 chrome.send('coreOptionsUserMetricsAction', |
69 ['Options_LanuageAndSpellCheckSettings']); | 74 ['Options_LanuageAndSpellCheckSettings']); |
70 }; | 75 }; |
71 | 76 |
72 if (cr.isWindows || cr.isMac) { | 77 if (cr.isWindows || cr.isMac) { |
73 $('certificatesManageButton').onclick = function(event) { | 78 $('certificatesManageButton').onclick = function(event) { |
74 chrome.send('showManageSSLCertificates'); | 79 chrome.send('showManageSSLCertificates'); |
75 }; | 80 }; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 // Add/Select Custom Option in the font size label list. | 169 // Add/Select Custom Option in the font size label list. |
165 if (!$('Custom')) { | 170 if (!$('Custom')) { |
166 var option = new Option(localStrings.getString('fontSizeLabelCustom'), | 171 var option = new Option(localStrings.getString('fontSizeLabelCustom'), |
167 -1, false, true); | 172 -1, false, true); |
168 option.setAttribute("id", "Custom"); | 173 option.setAttribute("id", "Custom"); |
169 selectCtl.add(option); | 174 selectCtl.add(option); |
170 } | 175 } |
171 $('Custom').selected = true; | 176 $('Custom').selected = true; |
172 }; | 177 }; |
173 | 178 |
| 179 /** |
| 180 * Populate the page zoom selector with values received from the caller. |
| 181 * @param {Array} items An array of items to populate the selector. |
| 182 * each object is an array with three elements as follows: |
| 183 * 0: The title of the item (string). |
| 184 * 1: The value of the item (number). |
| 185 * 2: Whether the item should be selected (boolean). |
| 186 */ |
| 187 AdvancedOptions.SetupPageZoomSelector = function(items) { |
| 188 var element = $('defaultZoomFactor'); |
| 189 |
| 190 // Remove any existing content. |
| 191 element.textContent = ''; |
| 192 |
| 193 // Insert new child nodes into select element. |
| 194 var value, title, selected; |
| 195 for (var i = 0; i < items.length; i++) { |
| 196 title = items[i][0]; |
| 197 value = items[i][1]; |
| 198 selected = items[i][2]; |
| 199 element.appendChild(new Option(title, value, false, selected)); |
| 200 } |
| 201 }; |
| 202 |
174 // Set the enabled state for the autoOpenFileTypesResetToDefault button. | 203 // Set the enabled state for the autoOpenFileTypesResetToDefault button. |
175 AdvancedOptions.SetAutoOpenFileTypesDisabledAttribute = function(disabled) { | 204 AdvancedOptions.SetAutoOpenFileTypesDisabledAttribute = function(disabled) { |
176 if (!cr.isChromeOS) { | 205 if (!cr.isChromeOS) { |
177 $('autoOpenFileTypesResetToDefault').disabled = disabled; | 206 $('autoOpenFileTypesResetToDefault').disabled = disabled; |
178 | 207 |
179 if (disabled) | 208 if (disabled) |
180 $('auto-open-file-types-label').classList.add('disabled'); | 209 $('auto-open-file-types-label').classList.add('disabled'); |
181 else | 210 else |
182 $('auto-open-file-types-label').classList.remove('disabled'); | 211 $('auto-open-file-types-label').classList.remove('disabled'); |
183 } | 212 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 proxySectionElm.parentNode.removeChild(proxySectionElm); | 257 proxySectionElm.parentNode.removeChild(proxySectionElm); |
229 } | 258 } |
230 }; | 259 }; |
231 | 260 |
232 // Export | 261 // Export |
233 return { | 262 return { |
234 AdvancedOptions: AdvancedOptions | 263 AdvancedOptions: AdvancedOptions |
235 }; | 264 }; |
236 | 265 |
237 }); | 266 }); |
OLD | NEW |