summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorbinji@chromium.org <binji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-17 21:39:16 +0000
committerbinji@chromium.org <binji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-17 21:39:16 +0000
commit013d2d98d9527a8956504ba0ec6eaf92cc007f20 (patch)
tree2afd9ca3e24873483202139da6dae8d7e8bf603d /chrome
parentaa0b33eda7f49c544a973b5acd8f9f0611d7e765 (diff)
downloadchromium_src-013d2d98d9527a8956504ba0ec6eaf92cc007f20.zip
chromium_src-013d2d98d9527a8956504ba0ec6eaf92cc007f20.tar.gz
chromium_src-013d2d98d9527a8956504ba0ec6eaf92cc007f20.tar.bz2
[Multi Profile] Double-clicking an item in the user list should edit that profile.
BUG=92536 TEST=Go to chrome://settings/personal. Ensure there are >= 2 users. Double-click a user item. The edit user dialog should open. Review URL: http://codereview.chromium.org/8273026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105926 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/resources/options/autofill_options_list.js27
-rw-r--r--chrome/browser/resources/options/personal_options_profile_list.js5
-rw-r--r--chrome/browser/resources/shared/js/cr/ui/list.js23
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);