Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Unified Diff: chrome/browser/resources/options/content_settings_exceptions_area.js

Issue 4983005: Tabbed options - disable add/edit buttons in content settings lists (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use doc without ument Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/options/content_settings_exceptions_area.js
diff --git a/chrome/browser/resources/options/content_settings_exceptions_area.js b/chrome/browser/resources/options/content_settings_exceptions_area.js
index 31abc1f23dd3306a0717dc85b3ce9bf4a79e9476..66dab83b49f5f66c12ce1a15b34a349484a64b9c 100644
--- a/chrome/browser/resources/options/content_settings_exceptions_area.js
+++ b/chrome/browser/resources/options/content_settings_exceptions_area.js
@@ -281,6 +281,10 @@ cr.define('options.contentSettings', function() {
select.classList.toggle('hidden');
var doc = this.ownerDocument;
+ var area = doc.querySelector('div[contentType=' +
+ listItem.contentType + '][mode=' + listItem.mode + ']');
+ area.enableAddAndEditButtons(!editing);
+
if (editing) {
this.setAttribute('editing', '');
cr.ui.limitInputWidth(input, this, 20);
@@ -456,6 +460,7 @@ cr.define('options.contentSettings', function() {
emptyException.setting = '';
self.exceptionsList.addException(emptyException);
};
+ this.addRow = addRow;
var editRow = cr.doc.createElement('button');
editRow.textContent = templateData.editExceptionRow;
@@ -509,12 +514,26 @@ cr.define('options.contentSettings', function() {
*/
updateButtonSensitivity: function() {
var selectionSize = this.exceptionsList.selectedItems.length;
- if (this.editRow)
- this.editRow.disabled = selectionSize != 1;
+ if (this.addRow)
+ this.addRow.disabled = this.addAndEditButtonsDisabled;
+ if (this.editRow) {
+ this.editRow.disabled = selectionSize != 1 ||
+ this.addAndEditButtonsDisabled;
+ }
this.removeRow.disabled = selectionSize == 0;
},
/**
+ * Manually toggle the enabled/disabled state for the add and edit buttons.
+ * They'll be disabled while another row is being edited.
+ * @param {boolean}
+ */
+ enableAddAndEditButtons: function(enable) {
+ this.addAndEditButtonsDisabled = !enable;
+ this.updateButtonSensitivity();
+ },
+
+ /**
* Callback from the selection model.
* @param {!cr.Event} ce Event with change info.
* @private
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698