Index: chrome/browser/resources/options2/startup_overlay.js |
diff --git a/chrome/browser/resources/options2/startup_overlay.js b/chrome/browser/resources/options2/startup_overlay.js |
index 36878e6589735095a1d628e07ec96cd1106ca6de..086ccdc64a762f0b4363bd75dec9904268a528e5 100644 |
--- a/chrome/browser/resources/options2/startup_overlay.js |
+++ b/chrome/browser/resources/options2/startup_overlay.js |
@@ -33,6 +33,11 @@ cr.define('options', function() { |
*/ |
autocompleteList_: null, |
+ startup_pages_pref_: { |
+ 'name': 'session.urls_to_restore_on_startup', |
+ 'disabled': false |
+ }, |
+ |
/** |
* Initialize the page. |
*/ |
@@ -49,6 +54,10 @@ cr.define('options', function() { |
chrome.send('setStartupPagesToCurrentPages'); |
}; |
+ Preferences.getInstance().addEventListener( |
+ this.startup_pages_pref_.name, |
+ this.handleStartupPageListChange_.bind(this)); |
+ |
var suggestionList = new cr.ui.AutocompleteList(); |
suggestionList.autoExpands = true; |
suggestionList.suggestionUpdateRequestCallback = |
@@ -71,6 +80,34 @@ cr.define('options', function() { |
}, |
/** |
+ * Sets the enabled state of the custom startup page list controls |
+ * based on the current startup radio button selection. |
+ * @private |
+ */ |
+ updateCustomStartupPageControlStates_: function() { |
+ var disable = this.startup_pages_pref_.disabled; |
+ var startupPagesList = $('startupPagesList'); |
+ startupPagesList.disabled = disable; |
+ startupPagesList.setAttribute('tabindex', disable ? -1 : 0); |
+ // Explicitly set disabled state for input text elements. |
+ var inputs = startupPagesList.querySelectorAll("input[type='text']"); |
+ for (var i = 0; i < inputs.length; i++) |
+ inputs[i].disabled = disable; |
+ $('startupUseCurrentButton').disabled = disable; |
+ }, |
+ |
+ /** |
+ * Handles change events of the preference |
+ * 'session.urls_to_restore_on_startup'. |
+ * @param {event} preference changed event. |
+ * @private |
+ */ |
+ handleStartupPageListChange_: function(event) { |
+ this.startup_pages_pref_.disabled = event.value['disabled']; |
+ this.updateCustomStartupPageControlStates_(); |
+ }, |
+ |
+ /** |
* Updates the startup pages list with the given entries. |
* @param {Array} pages List of startup pages. |
* @private |