summaryrefslogtreecommitdiffstats
path: root/chrome/browser/resources
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-04 01:58:31 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-04 01:58:31 +0000
commitc48ccf2a389538d50904cfaa74e69d520a5240d8 (patch)
tree916f8c4363e748630311118e989287b5d0d504bc /chrome/browser/resources
parent8a0b3b0ed44bf64d38fd1065a1fa3dcf9f44d729 (diff)
downloadchromium_src-c48ccf2a389538d50904cfaa74e69d520a5240d8.zip
chromium_src-c48ccf2a389538d50904cfaa74e69d520a5240d8.tar.gz
chromium_src-c48ccf2a389538d50904cfaa74e69d520a5240d8.tar.bz2
Disable startup page list in tabbed options when it's managed.
BUG=74423 TEST=see bug Review URL: http://codereview.chromium.org/6613007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76861 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/resources')
-rw-r--r--chrome/browser/resources/options/browser_options.js61
1 files changed, 42 insertions, 19 deletions
diff --git a/chrome/browser/resources/options/browser_options.js b/chrome/browser/resources/options/browser_options.js
index 2819807..9ae0aca 100644
--- a/chrome/browser/resources/options/browser_options.js
+++ b/chrome/browser/resources/options/browser_options.js
@@ -22,6 +22,11 @@ cr.define('options', function() {
// Inherit BrowserOptions from OptionsPage.
__proto__: options.OptionsPage.prototype,
+ startup_pages_pref_: {
+ 'name': 'session.urls_to_restore_on_startup',
+ 'managed': false
+ },
+
homepage_pref_: {
'name': 'homepage',
'value': '',
@@ -108,10 +113,15 @@ cr.define('options', function() {
// Initialize control enabled states.
Preferences.getInstance().addEventListener('session.restore_on_startup',
this.updateCustomStartupPageControlStates_.bind(this));
- Preferences.getInstance().addEventListener('homepage_is_newtabpage',
- this.handleHomepageIsNewTabPageChange_.bind(this));
- Preferences.getInstance().addEventListener('homepage',
+ Preferences.getInstance().addEventListener(
+ this.startup_pages_pref_.name,
+ this.handleStartupPageListChange_.bind(this));
+ Preferences.getInstance().addEventListener(
+ this.homepage_pref_.name,
this.handleHomepageChange_.bind(this));
+ Preferences.getInstance().addEventListener(
+ this.homepage_is_newtabpage_pref_.name,
+ this.handleHomepageIsNewTabPageChange_.bind(this));
this.updateCustomStartupPageControlStates_();
}
@@ -129,11 +139,11 @@ cr.define('options', function() {
/**
* Update the Default Browsers section based on the current state.
- * @private
* @param {string} statusString Description of the current default state.
* @param {boolean} isDefault Whether or not the browser is currently
* default.
* @param {boolean} canBeDefault Whether or not the browser can be default.
+ * @private
*/
updateDefaultBrowserState_: function(statusString, isDefault,
canBeDefault) {
@@ -180,13 +190,14 @@ cr.define('options', function() {
* enabled.
*/
shouldEnableCustomStartupPageControls: function(pages) {
- return $('startupShowPagesButton').checked;
+ return $('startupShowPagesButton').checked &&
+ !this.startup_pages_pref_.managed;
},
/**
* Updates the startup pages list with the given entries.
- * @private
* @param {Array} pages List of startup pages.
+ * @private
*/
updateStartupPages_: function(pages) {
$('startupPagesList').dataModel = new ArrayDataModel(pages);
@@ -194,26 +205,26 @@ cr.define('options', function() {
/**
* Handles change events of the radio button 'homepageUseURLButton'.
- * @private
* @param {event} change event.
+ * @private
*/
handleHomepageUseURLButtonChange_: function(event) {
- Preferences.setBooleanPref('homepage_is_newtabpage', false);
+ Preferences.setBooleanPref(this.homepage_is_newtabpage_pref_.name, false);
},
/**
* Handles change events of the radio button 'homepageUseNTPButton'.
- * @private
* @param {event} change event.
+ * @private
*/
handleHomepageUseNTPButtonChange_: function(event) {
- Preferences.setBooleanPref('homepage_is_newtabpage', true);
+ Preferences.setBooleanPref(this.homepage_is_newtabpage_pref_.name, true);
},
/**
* Handles input and change events of the text field 'homepageURL'.
- * @private
* @param {event} input/change event.
+ * @private
*/
handleHomepageURLChange_: function(event) {
var doFixup = event.type == 'change' ? '1' : '0';
@@ -222,8 +233,8 @@ cr.define('options', function() {
/**
* Handle change events of the preference 'homepage'.
- * @private
* @param {event} preference changed event.
+ * @private
*/
handleHomepageChange_: function(event) {
this.homepage_pref_.value = event.value['value'];
@@ -231,16 +242,17 @@ cr.define('options', function() {
if (this.isHomepageURLNewTabPageURL_() && !this.homepage_pref_.managed &&
!this.homepage_is_newtabpage_pref_.managed) {
var useNewTabPage = this.isHomepageIsNewTabPageChoiceSelected_();
- Preferences.setStringPref('homepage', '')
- Preferences.setBooleanPref('homepage_is_newtabpage', useNewTabPage)
+ Preferences.setStringPref(this.homepage_pref_.name, '')
+ Preferences.setBooleanPref(this.homepage_is_newtabpage_pref_.name,
+ useNewTabPage)
}
this.updateHomepageControlStates_();
},
/**
* Handle change events of the preference homepage_is_newtabpage.
- * @private
* @param {event} preference changed event.
+ * @private
*/
handleHomepageIsNewTabPageChange_: function(event) {
this.homepage_is_newtabpage_pref_.value = event.value['value'];
@@ -303,9 +315,9 @@ cr.define('options', function() {
/**
* Tests whether the value of the 'homepage' preference equls the new tab
* page url (chrome://newtab).
- * @private
* @returns {boolean} True if the 'homepage' value equals the new tab page
* url.
+ * @private
*/
isHomepageURLNewTabPageURL_ : function() {
return (this.homepage_pref_.value.toLowerCase() == 'chrome://newtab');
@@ -313,8 +325,8 @@ cr.define('options', function() {
/**
* Tests whether the Homepage choice "Use New Tab Page" is selected.
- * @private
* @returns {boolean} True if "Use New Tab Page" is selected.
+ * @private
*/
isHomepageIsNewTabPageChoiceSelected_: function() {
return (this.homepage_is_newtabpage_pref_.value ||
@@ -325,8 +337,8 @@ cr.define('options', function() {
/**
* Tests whether the home page choice controls are enabled.
- * @private
* @returns {boolean} True if the home page choice controls are enabled.
+ * @private
*/
isHomepageChoiceEnabled_: function() {
return (!this.homepage_is_newtabpage_pref_.managed &&
@@ -336,8 +348,8 @@ cr.define('options', function() {
/**
* Checks whether the home page field should be enabled.
- * @private
* @returns {boolean} True if the home page field should be enabled.
+ * @private
*/
isHomepageURLFieldEnabled_: function() {
return (!this.homepage_is_newtabpage_pref_.value &&
@@ -359,6 +371,17 @@ cr.define('options', function() {
},
/**
+ * Handle change events of the preference
+ * 'session.urls_to_restore_on_startup'.
+ * @param {event} preference changed event.
+ * @private
+ */
+ handleStartupPageListChange_: function(event) {
+ this.startup_pages_pref_.managed = event.value['managed'];
+ this.updateCustomStartupPageControlStates_();
+ },
+
+ /**
* Set the default search engine based on the popup selection.
*/
setDefaultSearchEngine: function() {