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 // State variables. | 9 // State variables. |
10 var syncEnabled = false; | 10 var syncEnabled = false; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
117 } | 117 } |
118 | 118 |
119 if (PersonalOptions.disableAutofillManagement()) { | 119 if (PersonalOptions.disableAutofillManagement()) { |
120 $('autofill-settings').disabled = true; | 120 $('autofill-settings').disabled = true; |
121 | 121 |
122 // Disable and turn off autofill. | 122 // Disable and turn off autofill. |
123 var autofillEnabled = $('autofill-enabled'); | 123 var autofillEnabled = $('autofill-enabled'); |
124 autofillEnabled.disabled = true; | 124 autofillEnabled.disabled = true; |
125 autofillEnabled.checked = false; | 125 autofillEnabled.checked = false; |
126 cr.dispatchSimpleEvent(autofillEnabled, 'change'); | 126 cr.dispatchSimpleEvent(autofillEnabled, 'change'); |
127 } | 127 } |
Joao da Silva
2011/07/08 08:56:28
I'd suggest handling updates to the pref here, sim
pastarmovj
2011/07/08 09:33:30
True good idea. This will save one unneeded IPC ca
| |
128 }, | 128 }, |
129 | 129 |
130 setSyncEnabled_: function(enabled) { | 130 setSyncEnabled_: function(enabled) { |
131 this.syncEnabled = enabled; | 131 this.syncEnabled = enabled; |
132 }, | 132 }, |
133 | 133 |
134 setSyncSetupCompleted_: function(completed) { | 134 setSyncSetupCompleted_: function(completed) { |
135 this.syncSetupCompleted = completed; | 135 this.syncSetupCompleted = completed; |
136 $('customize-sync').hidden = !completed; | 136 $('customize-sync').hidden = !completed; |
137 }, | 137 }, |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
191 setGtkThemeButtonEnabled_: function(enabled) { | 191 setGtkThemeButtonEnabled_: function(enabled) { |
192 if (!cr.isChromeOS && navigator.platform.match(/linux|BSD/i)) { | 192 if (!cr.isChromeOS && navigator.platform.match(/linux|BSD/i)) { |
193 $('themes-GTK-button').disabled = !enabled; | 193 $('themes-GTK-button').disabled = !enabled; |
194 } | 194 } |
195 }, | 195 }, |
196 | 196 |
197 setThemesResetButtonEnabled_: function(enabled) { | 197 setThemesResetButtonEnabled_: function(enabled) { |
198 $('themes-reset').disabled = !enabled; | 198 $('themes-reset').disabled = !enabled; |
199 }, | 199 }, |
200 | 200 |
201 setAutoFillButtonEnabled_: function(enabled) { | |
202 $('autofill-settings').disabled = !enabled; | |
Joao da Silva
2011/07/08 08:56:28
This can reenable the control when it was disabled
pastarmovj
2011/07/08 09:33:30
You are right. Good catch!
On 2011/07/08 08:56:28
| |
203 }, | |
204 | |
201 hideSyncSection_: function() { | 205 hideSyncSection_: function() { |
202 $('sync-section').hidden = true; | 206 $('sync-section').hidden = true; |
203 }, | 207 }, |
204 | 208 |
205 /** | 209 /** |
206 * Toggles the visibility of the data type checkboxes based on whether they | 210 * Toggles the visibility of the data type checkboxes based on whether they |
207 * are enabled on not. | 211 * are enabled on not. |
208 * @param {Object} dict A mapping from data type to a boolean indicating | 212 * @param {Object} dict A mapping from data type to a boolean indicating |
209 * whether it is enabled. | 213 * whether it is enabled. |
210 * @private | 214 * @private |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
247 'setSyncStatusErrorVisible', | 251 'setSyncStatusErrorVisible', |
248 'setSyncActionLinkEnabled', | 252 'setSyncActionLinkEnabled', |
249 'setSyncActionLinkLabel', | 253 'setSyncActionLinkLabel', |
250 'setProfilesSectionVisible', | 254 'setProfilesSectionVisible', |
251 'setNewProfileButtonEnabled', | 255 'setNewProfileButtonEnabled', |
252 'setStartStopButtonVisible', | 256 'setStartStopButtonVisible', |
253 'setStartStopButtonEnabled', | 257 'setStartStopButtonEnabled', |
254 'setStartStopButtonLabel', | 258 'setStartStopButtonLabel', |
255 'setGtkThemeButtonEnabled', | 259 'setGtkThemeButtonEnabled', |
256 'setThemesResetButtonEnabled', | 260 'setThemesResetButtonEnabled', |
261 'setAutoFillButtonEnabled', | |
257 'hideSyncSection', | 262 'hideSyncSection', |
258 'setRegisteredDataTypes', | 263 'setRegisteredDataTypes', |
259 ].forEach(function(name) { | 264 ].forEach(function(name) { |
260 PersonalOptions[name] = function(value) { | 265 PersonalOptions[name] = function(value) { |
261 PersonalOptions.getInstance()[name + '_'](value); | 266 PersonalOptions.getInstance()[name + '_'](value); |
262 }; | 267 }; |
263 }); | 268 }); |
264 | 269 |
265 // Export | 270 // Export |
266 return { | 271 return { |
267 PersonalOptions: PersonalOptions | 272 PersonalOptions: PersonalOptions |
268 }; | 273 }; |
269 | 274 |
270 }); | 275 }); |
OLD | NEW |