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

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

Issue 1822913003: Handle the button presses in the password edit dialog. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@password-edit-dialog.gitbr
Patch Set: simplify Created 4 years, 8 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_and_forms_page.js
diff --git a/chrome/browser/resources/settings/passwords_and_forms_page/passwords_and_forms_page.js b/chrome/browser/resources/settings/passwords_and_forms_page/passwords_and_forms_page.js
index a6853f054ca2e6fb6cd002ae081ea5619908449a..17cb463942f04097e328d82901779f65fe20022f 100644
--- a/chrome/browser/resources/settings/passwords_and_forms_page/passwords_and_forms_page.js
+++ b/chrome/browser/resources/settings/passwords_and_forms_page/passwords_and_forms_page.js
@@ -19,6 +19,9 @@ PasswordManager.PasswordUiEntry;
/** @typedef {chrome.passwordsPrivate.LoginPair} */
PasswordManager.LoginPair;
+/** @typedef {chrome.passwordsPrivate.PlaintextPasswordEventParameters} */
+PasswordManager.PlaintextPasswordEvent;
+
PasswordManager.prototype = {
/**
* Register a callback for when the list of passwords is updated.
@@ -47,6 +50,19 @@ PasswordManager.prototype = {
* list. No-op if |exception| is not in the list.
*/
removePasswordException: assertNotReached,
+
+ /**
+ * Register a callback for when a password is requested.
+ * @param {function(!Array<!PasswordManager.LoginPair>):void} callback
+ */
+ onPlaintextPasswordRequestedCallback: assertNotReached,
+
+ /**
+ * Should request the saved password for a given login pair.
+ * @param {!PasswordManager.LoginPair} loginPair The saved password that
+ * should be retrieved.
+ */
+ requestPlaintextPassword: assertNotReached,
};
/**
@@ -80,6 +96,16 @@ PasswordManagerImpl.prototype = {
removePasswordException: function(exception) {
chrome.passwordsPrivate.removePasswordException(exception);
},
+
+ /** @override */
+ onPlaintextPasswordRequestedCallback: function(callback) {
+ chrome.passwordsPrivate.onPlaintextPasswordRetrieved.addListener(callback);
+ },
+
+ /** @override */
+ requestPlaintextPassword: function(loginPair) {
+ chrome.passwordsPrivate.requestPlaintextPassword(loginPair);
+ },
};
(function() {
@@ -128,6 +154,7 @@ Polymer({
listeners: {
'remove-password-exception': 'removePasswordException_',
'remove-saved-password': 'removeSavedPassword_',
+ 'show-password': 'showPassword_',
},
/** @override */
@@ -140,6 +167,9 @@ Polymer({
this.passwordManager_.onExceptionListChangedCallback(function(list) {
this.passwordExceptions = list;
}.bind(this));
+ this.passwordManager_.onPlaintextPasswordRequestedCallback(function(e) {
+ this.$$('#passwordSection').setPassword(e.loginPair, e.plaintextPassword);
+ }.bind(this));
},
/**
@@ -173,5 +203,14 @@ Polymer({
this.$.pages.setSubpageChain(['manage-passwords']);
}
},
+
+ /**
+ * Listens for the show-password event, and calls the private API.
+ * @param {!Event} event
+ * @private
+ */
+ showPassword_: function(event) {
+ this.passwordManager_.requestPlaintextPassword(event.detail);
+ },
});
})();

Powered by Google App Engine
This is Rietveld 408576698