OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
52 $('autoOpenFileTypesResetToDefault').onclick = function(event) { | 52 $('autoOpenFileTypesResetToDefault').onclick = function(event) { |
53 chrome.send('autoOpenFileTypesAction'); | 53 chrome.send('autoOpenFileTypesAction'); |
54 }; | 54 }; |
55 $('fontSettingsCustomizeFontsButton').onclick = function(event) { | 55 $('fontSettingsCustomizeFontsButton').onclick = function(event) { |
56 OptionsPage.showPageByName('fontSettings'); | 56 OptionsPage.showPageByName('fontSettings'); |
57 chrome.send('coreOptionsUserMetricsAction', ['Options_FontSettings']); | 57 chrome.send('coreOptionsUserMetricsAction', ['Options_FontSettings']); |
58 }; | 58 }; |
59 $('defaultZoomLevel').onchange = function(event) { | 59 $('defaultZoomLevel').onchange = function(event) { |
60 chrome.send('defaultZoomLevelAction', | 60 chrome.send('defaultZoomLevelAction', |
61 [String(event.target.options[event.target.selectedIndex].value)]); | 61 [String(event.target.options[event.target.selectedIndex].value)]); |
62 } | 62 }; |
63 $('defaultFontSize').onchange = function(event) { | |
64 chrome.send('defaultFontSizeAction', | |
65 [String(event.target.options[event.target.selectedIndex].value)]); | |
66 }; | |
63 | 67 |
64 if (cr.isWindows || cr.isMac) { | 68 if (cr.isWindows || cr.isMac) { |
65 $('certificatesManageButton').onclick = function(event) { | 69 $('certificatesManageButton').onclick = function(event) { |
66 chrome.send('showManageSSLCertificates'); | 70 chrome.send('showManageSSLCertificates'); |
67 }; | 71 }; |
68 } else { | 72 } else { |
69 $('certificatesManageButton').onclick = function(event) { | 73 $('certificatesManageButton').onclick = function(event) { |
70 OptionsPage.showPageByName('certificateManager'); | 74 OptionsPage.showPageByName('certificateManager'); |
71 OptionsPage.showTab($('personal-certs-nav-tab')); | 75 OptionsPage.showTab($('personal-certs-nav-tab')); |
72 chrome.send('coreOptionsUserMetricsAction', | 76 chrome.send('coreOptionsUserMetricsAction', |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
162 var selectCtl = $('defaultZoomLevel'); | 166 var selectCtl = $('defaultZoomLevel'); |
163 for (var i = 0; i < selectCtl.options.length; i++) { | 167 for (var i = 0; i < selectCtl.options.length; i++) { |
164 if (selectCtl.options[i].value == value) { | 168 if (selectCtl.options[i].value == value) { |
165 selectCtl.selectedIndex = i; | 169 selectCtl.selectedIndex = i; |
166 return; | 170 return; |
167 } | 171 } |
168 } | 172 } |
169 selectCtl.selectedIndex = 4; // 100% | 173 selectCtl.selectedIndex = 4; // 100% |
170 }; | 174 }; |
171 | 175 |
176 // Set the font size selected item. | |
177 AdvancedOptions.SetFontSize = function(fixed_font_size_value, | |
178 font_size_value) { | |
179 var selectCtl = $('defaultFontSize'); | |
180 | |
csilv
2010/12/22 20:56:53
This looks good. I would recommend changing it a
kmadhusu
2010/12/22 21:19:08
Done.
| |
181 if (fixed_font_size_value != font_size_value) { | |
182 AddOrSelectCustomOption(); | |
183 return; | |
184 } | |
185 | |
186 for (var i = 0; i < selectCtl.options.length; i++) { | |
187 if (selectCtl.options[i].value == font_size_value) { | |
188 selectCtl.selectedIndex = i; | |
189 if ($('Custom')) | |
190 selectCtl.remove($('Custom').index); | |
191 return; | |
192 } | |
193 } | |
194 AddOrSelectCustomOption(); | |
195 }; | |
196 | |
197 // Add/Select Custom Option in the font size label list. | |
198 function AddOrSelectCustomOption() { | |
199 var selectCtl = $('defaultFontSize'); | |
200 if (!$('Custom')) { | |
201 var option = new Option(localStrings.getString('fontSizeLabelCustom'), | |
202 -1, false, true); | |
203 option.setAttribute("id","Custom"); | |
204 selectCtl.add(option); | |
205 } | |
206 $('Custom').selected = true; | |
207 }; | |
208 | |
172 // Set the download path. | 209 // Set the download path. |
173 AdvancedOptions.SetDownloadLocationPath = function(path) { | 210 AdvancedOptions.SetDownloadLocationPath = function(path) { |
174 if (!cr.isChromeOS) | 211 if (!cr.isChromeOS) |
175 $('downloadLocationPath').value = path; | 212 $('downloadLocationPath').value = path; |
176 }; | 213 }; |
177 | 214 |
178 // Set the enabled state for the autoOpenFileTypesResetToDefault button. | 215 // Set the enabled state for the autoOpenFileTypesResetToDefault button. |
179 AdvancedOptions.SetAutoOpenFileTypesDisabledAttribute = function(disabled) { | 216 AdvancedOptions.SetAutoOpenFileTypesDisabledAttribute = function(disabled) { |
180 $('autoOpenFileTypesResetToDefault').disabled = disabled; | 217 $('autoOpenFileTypesResetToDefault').disabled = disabled; |
181 }; | 218 }; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
227 $('cloud-print-proxy-section').style.display = 'none'; | 264 $('cloud-print-proxy-section').style.display = 'none'; |
228 } | 265 } |
229 }; | 266 }; |
230 | 267 |
231 // Export | 268 // Export |
232 return { | 269 return { |
233 AdvancedOptions: AdvancedOptions | 270 AdvancedOptions: AdvancedOptions |
234 }; | 271 }; |
235 | 272 |
236 }); | 273 }); |
OLD | NEW |