Chromium Code Reviews| 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..9e920d0d6aac3ec05283ef51f65349b8d3d25df0 100644 |
| --- a/chrome/browser/resources/options/content_settings_exceptions_area.js |
| +++ b/chrome/browser/resources/options/content_settings_exceptions_area.js |
| @@ -281,6 +281,11 @@ cr.define('options.contentSettings', function() { |
| select.classList.toggle('hidden'); |
| var doc = this.ownerDocument; |
| + |
| + var area = document.querySelector('div[contentType=' + |
|
Mike Mammarella
2010/11/16 00:00:01
You should use the doc variable declared just abov
Evan Stade
2010/11/16 01:31:25
Done.
|
| + listItem.contentType + '][mode=' + listItem.mode + ']'); |
| + area.enableAddAndEditButtons(!editing); |
| + |
| if (editing) { |
| this.setAttribute('editing', ''); |
| cr.ui.limitInputWidth(input, this, 20); |
| @@ -456,6 +461,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 +515,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 |