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 const OptionsPage = options.OptionsPage; | 6 const OptionsPage = options.OptionsPage; |
7 const ArrayDataModel = cr.ui.ArrayDataModel; | 7 const ArrayDataModel = cr.ui.ArrayDataModel; |
8 | 8 |
9 // | 9 // |
10 // BrowserOptions class | 10 // BrowserOptions class |
11 // Encapsulated handling of browser options page. | 11 // Encapsulated handling of browser options page. |
12 // | 12 // |
13 function BrowserOptions() { | 13 function BrowserOptions() { |
14 OptionsPage.call(this, 'browser', | 14 OptionsPage.call(this, 'browser', |
15 templateData.browserPageTabTitle, | 15 templateData.browserPageTabTitle, |
16 'browserPage'); | 16 'browserPage'); |
17 } | 17 } |
18 | 18 |
19 cr.addSingletonGetter(BrowserOptions); | 19 cr.addSingletonGetter(BrowserOptions); |
20 | 20 |
21 BrowserOptions.prototype = { | 21 BrowserOptions.prototype = { |
22 // Inherit BrowserOptions from OptionsPage. | 22 // Inherit BrowserOptions from OptionsPage. |
23 __proto__: options.OptionsPage.prototype, | 23 __proto__: options.OptionsPage.prototype, |
24 | 24 |
25 startup_pages_pref_: { | 25 startup_pages_pref_: { |
26 'name': 'session.urls_to_restore_on_startup', | 26 'name': 'session.urls_to_restore_on_startup', |
27 'managed': false | 27 'disabled': false |
28 }, | 28 }, |
29 | 29 |
30 /** | 30 /** |
31 * At autocomplete list that can be attached to a text field during editing. | 31 * At autocomplete list that can be attached to a text field during editing. |
32 * @type {HTMLElement} | 32 * @type {HTMLElement} |
33 * @private | 33 * @private |
34 */ | 34 */ |
35 autocompleteList_: null, | 35 autocompleteList_: null, |
36 | 36 |
37 // The cached value of the instant.confirm_dialog_shown preference. | 37 // The cached value of the instant.confirm_dialog_shown preference. |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 }, | 240 }, |
241 | 241 |
242 /** | 242 /** |
243 * Returns true if the custom startup page control block should | 243 * Returns true if the custom startup page control block should |
244 * be enabled. | 244 * be enabled. |
245 * @returns {boolean} Whether the startup page controls should be | 245 * @returns {boolean} Whether the startup page controls should be |
246 * enabled. | 246 * enabled. |
247 */ | 247 */ |
248 shouldEnableCustomStartupPageControls: function(pages) { | 248 shouldEnableCustomStartupPageControls: function(pages) { |
249 return $('startupShowPagesButton').checked && | 249 return $('startupShowPagesButton').checked && |
250 !this.startup_pages_pref_.controlledBy; | 250 !this.startup_pages_pref_.disabled; |
251 }, | 251 }, |
252 | 252 |
253 /** | 253 /** |
254 * Updates the startup pages list with the given entries. | 254 * Updates the startup pages list with the given entries. |
255 * @param {Array} pages List of startup pages. | 255 * @param {Array} pages List of startup pages. |
256 * @private | 256 * @private |
257 */ | 257 */ |
258 updateStartupPages_: function(pages) { | 258 updateStartupPages_: function(pages) { |
259 var model = new ArrayDataModel(pages); | 259 var model = new ArrayDataModel(pages); |
260 // Add a "new page" row. | 260 // Add a "new page" row. |
(...skipping 19 matching lines...) Expand all Loading... |
280 $('startupUseCurrentButton').disabled = disable; | 280 $('startupUseCurrentButton').disabled = disable; |
281 }, | 281 }, |
282 | 282 |
283 /** | 283 /** |
284 * Handle change events of the preference | 284 * Handle change events of the preference |
285 * 'session.urls_to_restore_on_startup'. | 285 * 'session.urls_to_restore_on_startup'. |
286 * @param {event} preference changed event. | 286 * @param {event} preference changed event. |
287 * @private | 287 * @private |
288 */ | 288 */ |
289 handleStartupPageListChange_: function(event) { | 289 handleStartupPageListChange_: function(event) { |
290 this.startup_pages_pref_.controlledBy = event.value['controlledBy']; | 290 this.startup_pages_pref_.disabled = event.value['disabled']; |
291 this.updateCustomStartupPageControlStates_(); | 291 this.updateCustomStartupPageControlStates_(); |
292 }, | 292 }, |
293 | 293 |
294 /** | 294 /** |
295 * Set the default search engine based on the popup selection. | 295 * Set the default search engine based on the popup selection. |
296 */ | 296 */ |
297 setDefaultSearchEngine_: function() { | 297 setDefaultSearchEngine_: function() { |
298 var engineSelect = $('defaultSearchEngine'); | 298 var engineSelect = $('defaultSearchEngine'); |
299 var selectedIndex = engineSelect.selectedIndex; | 299 var selectedIndex = engineSelect.selectedIndex; |
300 if (selectedIndex >= 0) { | 300 if (selectedIndex >= 0) { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 BrowserOptions.setInstantFieldTrialStatus = function(enabled) { | 356 BrowserOptions.setInstantFieldTrialStatus = function(enabled) { |
357 BrowserOptions.getInstance().setInstantFieldTrialStatus_(enabled); | 357 BrowserOptions.getInstance().setInstantFieldTrialStatus_(enabled); |
358 }; | 358 }; |
359 | 359 |
360 // Export | 360 // Export |
361 return { | 361 return { |
362 BrowserOptions: BrowserOptions | 362 BrowserOptions: BrowserOptions |
363 }; | 363 }; |
364 | 364 |
365 }); | 365 }); |
OLD | NEW |