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

Unified Diff: chrome/browser/resources/shared/js/cr/ui/list.js

Issue 8273026: [Multi Profile] Double-clicking an item in the user list should edit that profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add dblclick to list, remove from autofill Created 9 years, 2 months 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 | « chrome/browser/resources/options/personal_options_profile_list.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « chrome/browser/resources/options/personal_options_profile_list.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698