OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 var OptionsPage = options.OptionsPage; | 6 var OptionsPage = options.OptionsPage; |
7 var ArrayDataModel = cr.ui.ArrayDataModel; | 7 var ArrayDataModel = cr.ui.ArrayDataModel; |
8 var RepeatingButton = cr.ui.RepeatingButton; | 8 var RepeatingButton = cr.ui.RepeatingButton; |
9 | 9 |
10 // | 10 // |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 103 |
104 // Internet connection section (ChromeOS only). | 104 // Internet connection section (ChromeOS only). |
105 if (cr.isChromeOS) { | 105 if (cr.isChromeOS) { |
106 options.network.NetworkList.decorate($('network-list')); | 106 options.network.NetworkList.decorate($('network-list')); |
107 options.network.NetworkList.refreshNetworkData( | 107 options.network.NetworkList.refreshNetworkData( |
108 loadTimeData.getValue('networkData')); | 108 loadTimeData.getValue('networkData')); |
109 } | 109 } |
110 | 110 |
111 // On Startup section. | 111 // On Startup section. |
112 Preferences.getInstance().addEventListener('session.restore_on_startup', | 112 Preferences.getInstance().addEventListener('session.restore_on_startup', |
113 this.onRestoreOnStartupChanged_.bind(this)); | 113 this.onRestoreOnStartupChanged_.bind(this)); |
| 114 Preferences.getInstance().addEventListener( |
| 115 'session.urls_to_restore_on_startup', |
| 116 function(event) { |
| 117 $('startup-set-pages').disabled = event.value.disabled; |
| 118 }); |
114 | 119 |
115 $('startup-set-pages').onclick = function() { | 120 $('startup-set-pages').onclick = function() { |
116 OptionsPage.navigateToPage('startup'); | 121 OptionsPage.navigateToPage('startup'); |
117 }; | 122 }; |
118 | 123 |
119 // Appearance section. | 124 // Appearance section. |
120 Preferences.getInstance().addEventListener('browser.show_home_button', | 125 Preferences.getInstance().addEventListener('browser.show_home_button', |
121 this.onShowHomeButtonChanged_.bind(this)); | 126 this.onShowHomeButtonChanged_.bind(this)); |
122 | 127 |
123 Preferences.getInstance().addEventListener('homepage', | 128 Preferences.getInstance().addEventListener('homepage', |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 didShowPage: function() { | 465 didShowPage: function() { |
461 $('search-field').focus(); | 466 $('search-field').focus(); |
462 }, | 467 }, |
463 | 468 |
464 /** | 469 /** |
465 * Event listener for the 'session.restore_on_startup' pref. | 470 * Event listener for the 'session.restore_on_startup' pref. |
466 * @param {Event} event The preference change event. | 471 * @param {Event} event The preference change event. |
467 * @private | 472 * @private |
468 */ | 473 */ |
469 onRestoreOnStartupChanged_: function(event) { | 474 onRestoreOnStartupChanged_: function(event) { |
470 /** @const */ var showPagesValue = Number($('startup-show-pages').value); | |
471 /** @const */ var showHomePageValue = 0; | 475 /** @const */ var showHomePageValue = 0; |
472 | 476 |
473 $('startup-set-pages').disabled = event.value.disabled && | |
474 event.value.value != showPagesValue; | |
475 | |
476 if (event.value.value == showHomePageValue) { | 477 if (event.value.value == showHomePageValue) { |
477 // If the user previously selected "Show the homepage", the | 478 // If the user previously selected "Show the homepage", the |
478 // preference will already be migrated to "Open a specific page". So | 479 // preference will already be migrated to "Open a specific page". So |
479 // the only way to reach this code is if the 'restore on startup' | 480 // the only way to reach this code is if the 'restore on startup' |
480 // preference is managed. | 481 // preference is managed. |
481 assert(event.value.controlledBy); | 482 assert(event.value.controlledBy); |
482 | 483 |
483 // Select "open the following pages" and lock down the list of URLs | 484 // Select "open the following pages" and lock down the list of URLs |
484 // to reflect the intention of the policy. | 485 // to reflect the intention of the policy. |
485 $('startup-show-pages').checked = true; | 486 $('startup-show-pages').checked = true; |
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1341 BrowserOptions.getLoggedInUsername = function() { | 1342 BrowserOptions.getLoggedInUsername = function() { |
1342 return BrowserOptions.getInstance().username_; | 1343 return BrowserOptions.getInstance().username_; |
1343 }; | 1344 }; |
1344 } | 1345 } |
1345 | 1346 |
1346 // Export | 1347 // Export |
1347 return { | 1348 return { |
1348 BrowserOptions: BrowserOptions | 1349 BrowserOptions: BrowserOptions |
1349 }; | 1350 }; |
1350 }); | 1351 }); |
OLD | NEW |