Chromium Code Reviews| Index: chrome/browser/resources/shared/js/cr/ui/list.js |
| diff --git a/chrome/browser/resources/shared/js/cr/ui/list.js b/chrome/browser/resources/shared/js/cr/ui/list.js |
| index 042733b32b371bcd2f52376ee57794ba3734acba..f7e87d9925da9ca0b3cf178960ef54ee6f03cc1a 100644 |
| --- a/chrome/browser/resources/shared/js/cr/ui/list.js |
| +++ b/chrome/browser/resources/shared/js/cr/ui/list.js |
| @@ -96,6 +96,13 @@ cr.define('cr.ui', function() { |
| */ |
| autoExpands_: false, |
| + /** |
| + * Whether or not the list is disabled. |
| + * @type {boolean} |
| + * @private |
| + */ |
| + disabled_: false, |
|
arv (Not doing code reviews)
2010/12/04 01:03:27
cr.defineProperty(List, 'disabled', cr.PropertyKin
stuartmorgan
2010/12/04 01:36:51
Ah-ha, this is the magic I was missing; I original
|
| + |
| dataModel_: null, |
| /** |
| @@ -187,6 +194,21 @@ cr.define('cr.ui', function() { |
| }, |
| /** |
| + * Whether or not the list is disabled. |
| + * @type {boolean} |
| + */ |
| + get disabled() { |
| + return this.disabled_; |
| + }, |
| + set disabled(disabled) { |
| + this.disabled_ = disabled; |
| + if (disabled) |
| + this.classList.add('disabled'); |
| + else |
| + this.classList.remove('disabled'); |
| + }, |
| + |
| + /** |
| * Convenience alias for selectionModel.selectedItem |
| * @type {cr.ui.ListItem} |
| */ |
| @@ -285,6 +307,9 @@ cr.define('cr.ui', function() { |
| handleMouseDownUp_: function(e) { |
| var target = e.target; |
| + if (this.disabled) |
|
arv (Not doing code reviews)
2010/12/04 01:03:27
Do this before "var target"
stuartmorgan
2010/12/04 01:36:51
Done.
|
| + return; |
| + |
| // If the target was this element we need to make sure that the user did |
| // not click on a border or a scrollbar. |
| if (target == this && !inViewport(target, e)) |
| @@ -311,6 +336,9 @@ cr.define('cr.ui', function() { |
| * @return {boolean} Whether the key event was handled. |
| */ |
| handleKeyDown: function(e) { |
| + if (this.disabled) |
| + return; |
| + |
| return this.selectionController_.handleKeyDown(e); |
| }, |