diff options
Diffstat (limited to 'chrome')
3 files changed, 30 insertions, 25 deletions
diff --git a/chrome/browser/resources/options/autofill_options_list.js b/chrome/browser/resources/options/autofill_options_list.js index c6591ed..89ed6bb 100644 --- a/chrome/browser/resources/options/autofill_options_list.js +++ b/chrome/browser/resources/options/autofill_options_list.js @@ -318,7 +318,6 @@ cr.define('options.autofillOptions', function() { DeletableItemList.prototype.decorate.call(this); this.addEventListener('blur', this.onBlur_); - this.addEventListener('dblclick', this.onDoubleClick_); }, /** @@ -328,28 +327,6 @@ cr.define('options.autofillOptions', function() { onBlur_: function() { this.selectionModel.unselectAll(); }, - - /** - * When a list item is double clicked, open the corresponding profile for - * editing. - * @param {Event} event The double-click event. - * @private - */ - onDoubleClick_: function(event) { - if (this.disabled) - return; - - var target = this.getListItemAncestor(event.target); - if (target) - this.activateItemAtIndex_(this.getIndexOfListItem(target)); - }, - - /** - * Opens the item at |index| for editing. Subclasses should override. - * @param {Number} index The item index. - */ - activateItemAtIndex_: function(index) { - }, }; /** @@ -367,7 +344,7 @@ cr.define('options.autofillOptions', function() { }, /** @inheritDoc */ - activateItemAtIndex_: function(index) { + activateItemAtIndex: function(index) { AutofillOptions.loadAddressEditor(this.dataModel.item(index)[0]); }, @@ -397,7 +374,7 @@ cr.define('options.autofillOptions', function() { }, /** @inheritDoc */ - activateItemAtIndex_: function(index) { + activateItemAtIndex: function(index) { AutofillOptions.loadCreditCardEditor(this.dataModel.item(index)[0]); }, diff --git a/chrome/browser/resources/options/personal_options_profile_list.js b/chrome/browser/resources/options/personal_options_profile_list.js index a27f04e..0b67df0 100644 --- a/chrome/browser/resources/options/personal_options_profile_list.js +++ b/chrome/browser/resources/options/personal_options_profile_list.js @@ -83,6 +83,11 @@ cr.define('options.personal_options', function() { deleteItemAtIndex: function(index) { ManageProfileOverlay.showDeleteDialog(this.dataModel.item(index)); }, + + /** @inheritDoc */ + activateItemAtIndex: function(index) { + ManageProfileOverlay.showManageDialog(this.dataModel.item(index)); + }, }; return { diff --git a/chrome/browser/resources/shared/js/cr/ui/list.js b/chrome/browser/resources/shared/js/cr/ui/list.js index 0357c2f..291d5ff 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); |