| 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 |
| 11 // Encapsulated handling of advanced options page. | 11 // Encapsulated handling of advanced options page. |
| 12 // | 12 // |
| 13 function AdvancedOptions() { | 13 function AdvancedOptions() { |
| 14 OptionsPage.call(this, 'advanced', templateData.advancedPage, | 14 OptionsPage.call(this, 'advanced', templateData.advancedPage, |
| 15 'advancedPage'); | 15 'advancedPage'); |
| 16 } | 16 } |
| 17 | 17 |
| 18 cr.addSingletonGetter(AdvancedOptions); | 18 cr.addSingletonGetter(AdvancedOptions); |
| 19 | 19 |
| 20 AdvancedOptions.prototype = { | 20 AdvancedOptions.prototype = { |
| 21 // Inherit AdvancedOptions from OptionsPage. | 21 // Inherit AdvancedOptions from OptionsPage. |
| 22 __proto__: options.OptionsPage.prototype, | 22 __proto__: options.OptionsPage.prototype, |
| 23 | 23 |
| 24 // Initialize AdvancedOptions page. | 24 /** |
| 25 * Initializes the page. |
| 26 */ |
| 25 initializePage: function() { | 27 initializePage: function() { |
| 26 // Call base class implementation to starts preference initialization. | 28 // Call base class implementation to starts preference initialization. |
| 27 OptionsPage.prototype.initializePage.call(this); | 29 OptionsPage.prototype.initializePage.call(this); |
| 28 | 30 |
| 29 // Setup click handlers for buttons. | 31 // Setup click handlers for buttons. |
| 30 $('privacyContentSettingsButton').onclick = function(event) { | 32 $('privacyContentSettingsButton').onclick = function(event) { |
| 31 OptionsPage.showPageByName('content'); | 33 OptionsPage.showPageByName('content'); |
| 32 OptionsPage.showTab($('cookies-nav-tab')); | 34 OptionsPage.showTab($('cookies-nav-tab')); |
| 33 chrome.send('coreOptionsUserMetricsAction', | 35 chrome.send('coreOptionsUserMetricsAction', |
| 34 ['Options_ContentSettings']); | 36 ['Options_ContentSettings']); |
| 35 }; | 37 }; |
| 36 $('privacyClearDataButton').onclick = function(event) { | 38 $('privacyClearDataButton').onclick = function(event) { |
| 37 OptionsPage.showOverlay('clearBrowserDataOverlay'); | 39 OptionsPage.showOverlay('clearBrowserDataOverlay'); |
| 38 chrome.send('coreOptionsUserMetricsAction', ['Options_ClearData']); | 40 chrome.send('coreOptionsUserMetricsAction', ['Options_ClearData']); |
| 39 }; | 41 }; |
| 42 // 'metricsReportingEnabled' element is only present on Chrome branded |
| 43 // builds. |
| 44 if ($('metricsReportingEnabled')) { |
| 45 $('metricsReportingEnabled').onclick = function(event) { |
| 46 chrome.send('metricsReportingCheckboxAction', |
| 47 [String(event.target.checked)]); |
| 48 }; |
| 49 } |
| 40 $('autoOpenFileTypesResetToDefault').onclick = function(event) { | 50 $('autoOpenFileTypesResetToDefault').onclick = function(event) { |
| 41 chrome.send('autoOpenFileTypesAction'); | 51 chrome.send('autoOpenFileTypesAction'); |
| 42 }; | 52 }; |
| 43 $('fontSettingsConfigureFontsOnlyButton').onclick = function(event) { | 53 $('fontSettingsConfigureFontsOnlyButton').onclick = function(event) { |
| 44 OptionsPage.showPageByName('fontSettings'); | 54 OptionsPage.showPageByName('fontSettings'); |
| 45 chrome.send('coreOptionsUserMetricsAction', ['Options_FontSettings']); | 55 chrome.send('coreOptionsUserMetricsAction', ['Options_FontSettings']); |
| 46 }; | 56 }; |
| 47 if (!cr.isChromeOS) { | 57 if (!cr.isChromeOS) { |
| 48 $('optionsReset').onclick = function(event) { | 58 $('optionsReset').onclick = function(event) { |
| 49 AlertOverlay.show(undefined, | 59 AlertOverlay.show(undefined, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 [String($('sslCheckRevocation').checked)]); | 92 [String($('sslCheckRevocation').checked)]); |
| 83 }; | 93 }; |
| 84 $('sslUseSSL2').onclick = function(event) { | 94 $('sslUseSSL2').onclick = function(event) { |
| 85 chrome.send('useSSL2CheckboxAction', | 95 chrome.send('useSSL2CheckboxAction', |
| 86 [String($('sslUseSSL2').checked)]); | 96 [String($('sslUseSSL2').checked)]); |
| 87 }; | 97 }; |
| 88 $('gearSettingsConfigureGearsButton').onclick = function(event) { | 98 $('gearSettingsConfigureGearsButton').onclick = function(event) { |
| 89 chrome.send('showGearsSettings'); | 99 chrome.send('showGearsSettings'); |
| 90 }; | 100 }; |
| 91 } | 101 } |
| 102 }, |
| 103 |
| 104 /** |
| 105 * Show a 'restart required' alert. |
| 106 * @private |
| 107 */ |
| 108 showRestartRequiredAlert_: function() { |
| 109 AlertOverlay.show(undefined, |
| 110 localStrings.getString('optionsRestartRequired'), |
| 111 undefined, '', undefined); |
| 92 } | 112 } |
| 93 }; | 113 }; |
| 94 | 114 |
| 95 // | 115 // |
| 96 // Chrome callbacks | 116 // Chrome callbacks |
| 97 // | 117 // |
| 98 | 118 |
| 119 // Set the checked state of the metrics reporting checkbox. |
| 120 AdvancedOptions.SetMetricsReportingCheckboxState = function(checked, |
| 121 disabled, user_changed) { |
| 122 $('metricsReportingEnabled').checked = checked; |
| 123 $('metricsReportingEnabled').disabled = disabled; |
| 124 |
| 125 if (user_changed) |
| 126 AdvancedOptions.getInstance().showRestartRequiredAlert_(); |
| 127 } |
| 128 |
| 99 // Set the download path. | 129 // Set the download path. |
| 100 AdvancedOptions.SetDownloadLocationPath = function(path) { | 130 AdvancedOptions.SetDownloadLocationPath = function(path) { |
| 101 if (!cr.isChromeOS) | 131 if (!cr.isChromeOS) |
| 102 $('downloadLocationPath').value = path; | 132 $('downloadLocationPath').value = path; |
| 103 }; | 133 }; |
| 104 | 134 |
| 105 // Set the enabled state for the autoOpenFileTypesResetToDefault button. | 135 // Set the enabled state for the autoOpenFileTypesResetToDefault button. |
| 106 AdvancedOptions.SetAutoOpenFileTypesDisabledAttribute = function(disabled) { | 136 AdvancedOptions.SetAutoOpenFileTypesDisabledAttribute = function(disabled) { |
| 107 $('autoOpenFileTypesResetToDefault').disabled = disabled; | 137 $('autoOpenFileTypesResetToDefault').disabled = disabled; |
| 108 }; | 138 }; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 122 AdvancedOptions.SetUseSSL2CheckboxState = function(checked) { | 152 AdvancedOptions.SetUseSSL2CheckboxState = function(checked) { |
| 123 $('sslUseSSL2').checked = checked; | 153 $('sslUseSSL2').checked = checked; |
| 124 }; | 154 }; |
| 125 | 155 |
| 126 // Export | 156 // Export |
| 127 return { | 157 return { |
| 128 AdvancedOptions: AdvancedOptions | 158 AdvancedOptions: AdvancedOptions |
| 129 }; | 159 }; |
| 130 | 160 |
| 131 }); | 161 }); |
| OLD | NEW |