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 0357c2f534f173fc7edb1ee9f33672b260602a9e..291d5ff81284abd6ca37eb45410e12437b6bb14e 100644 |
--- a/chrome/browser/resources/shared/js/cr/ui/list.js |
+++ b/chrome/browser/resources/shared/js/cr/ui/list.js |
@@ -348,6 +348,7 @@ cr.define('cr.ui', function() { |
var length = this.dataModel ? this.dataModel.length : 0; |
this.selectionModel = new ListSelectionModel(length); |
+ this.addEventListener('dblclick', this.handleDoubleClick_); |
this.addEventListener('mousedown', this.handleMouseDownUp_); |
this.addEventListener('mouseup', this.handleMouseDownUp_); |
this.addEventListener('keydown', this.handleKeyDown); |
@@ -390,6 +391,20 @@ cr.define('cr.ui', function() { |
}, |
/** |
+ * Callback for the double click event. |
+ * @param {Event} e The mouse event object. |
+ * @private |
+ */ |
+ handleDoubleClick_: function(e) { |
+ if (this.disabled) |
+ return; |
+ |
+ var target = this.getListItemAncestor(e.target); |
+ if (target) |
+ this.activateItemAtIndex(this.getIndexOfListItem(target)); |
+ }, |
+ |
+ /** |
* Callback for mousedown and mouseup events. |
* @param {Event} e The mouse event object. |
* @private |
@@ -930,6 +945,14 @@ cr.define('cr.ui', function() { |
this.redraw(); |
} |
}, |
+ |
+ /** |
+ * Called when a list item is activated, currently only by a double click |
+ * event. |
+ * @param {number} index The index of the activated item. |
+ */ |
+ activateItemAtIndex: function(index) { |
+ }, |
}; |
cr.defineProperty(List, 'disabled', cr.PropertyKind.BOOL_ATTR); |