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

Unified Diff: chrome/browser/resources/settings/passwords_and_forms_page/passwords_section.js

Issue 2426183002: MD Settings: Migrate passwords cr-shared-menu to settings-action-menu. (Closed)
Patch Set: Nit Created 4 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
Index: chrome/browser/resources/settings/passwords_and_forms_page/passwords_section.js
diff --git a/chrome/browser/resources/settings/passwords_and_forms_page/passwords_section.js b/chrome/browser/resources/settings/passwords_and_forms_page/passwords_section.js
index 721d5eeec69fe5f18c023fd4aae70585edf4ec42..d023d99915a06637a7b4aa208cf4e557cb5f8861 100644
--- a/chrome/browser/resources/settings/passwords_and_forms_page/passwords_section.js
+++ b/chrome/browser/resources/settings/passwords_and_forms_page/passwords_section.js
@@ -57,11 +57,14 @@ Polymer({
/**
- * Assigning a non-null value triggers the add/edit dialog.
+ * The model for any password related action menus or dialogs.
* @private {?chrome.passwordsPrivate.PasswordUiEntry}
*/
activePassword: Object,
+ /** @private */
+ showPasswordEditDialog_: Boolean,
+
/** Filter on the saved passwords and exceptions. */
filter: {
type: String,
@@ -69,10 +72,6 @@ Polymer({
},
},
- listeners: {
- 'passwordList.scroll': 'closeMenu_',
- },
-
observers: ['passwordListChanged_(savedPasswords, filter)'],
/**
@@ -101,15 +100,13 @@ Polymer({
* @private
*/
onMenuEditPasswordTap_: function() {
- var menu = /** @type {CrSharedMenuElement} */(this.$.menu);
- this.activePassword =
- /** @type {chrome.passwordsPrivate.PasswordUiEntry} */(menu.itemData);
- menu.closeMenu();
+ /** @type {SettingsActionMenuElement} */(this.$.menu).close();
+ this.showPasswordEditDialog_ = true;
},
/** @private */
- unstampPasswordEditDialog_: function(e) {
- this.activePassword = null;
+ onPasswordEditDialogClosed_: function() {
+ this.showPasswordEditDialog_ = false;
},
/**
@@ -144,11 +141,8 @@ Polymer({
* @private
*/
onMenuRemovePasswordTap_: function() {
- var menu = /** @type {CrSharedMenuElement} */(this.$.menu);
- var data =
- /** @type {chrome.passwordsPrivate.PasswordUiEntry} */(menu.itemData);
- this.fire('remove-saved-password', data.loginPair);
- menu.closeMenu();
+ this.fire('remove-saved-password', this.activePassword.loginPair);
+ /** @type {SettingsActionMenuElement} */(this.$.menu).close();
},
/**
@@ -169,25 +163,18 @@ Polymer({
getEmptyPassword_: function(length) { return ' '.repeat(length); },
/**
- * Toggles the overflow menu.
- * @param {!Event} e The polymer event.
+ * Opens the password action menu.
* @private
*/
onPasswordMenuTap_: function(e) {
- var menu = /** @type {CrSharedMenuElement} */(this.$.menu);
+ var menu = /** @type {!SettingsActionMenuElement} */(this.$.menu);
var target = /** @type {!Element} */(Polymer.dom(e).localTarget);
var passwordUiEntryEvent = /** @type {!PasswordUiEntryEvent} */(e);
- menu.toggleMenu(target, passwordUiEntryEvent.model.item);
- e.stopPropagation(); // Prevent the tap event from closing the menu.
- },
-
- /**
- * Closes the overflow menu.
- * @private
- */
- closeMenu_: function() {
- /** @type {CrSharedMenuElement} */(this.$.menu).closeMenu();
+ this.activePassword =
+ /** @type {!chrome.passwordsPrivate.PasswordUiEntry} */ (
+ passwordUiEntryEvent.model.item);
+ menu.showAt(target);
},
/**

Powered by Google App Engine
This is Rietveld 408576698