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

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

Issue 1591053002: Add a password handler to get the list of passwords in md-settings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Feedback Created 4 years, 11 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 b46e9fb3b2389df1a434bc8350d6d947227cd203..ff7d7d85c55ef003f10e6ee097b6e95867bd62f8 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
@@ -27,9 +27,9 @@ Polymer({
/**
* An array of passwords to display.
* Lazy loaded when the password section is expanded.
+ * @type {!Array<!chrome.passwordsPrivate.PasswordUiEntry>}
*/
savedPasswords: {
- type: Array,
value: function() { return []; },
},
@@ -44,23 +44,23 @@ Polymer({
},
/**
- * Called when the section is expanded. This will load the list of passwords
- * only when needed.
+ * Called when the section is expanded. This will set up a callback to update
+ * the list of passwords and trigger it.
* @param {boolean} passwordSectionOpened
*/
loadPasswords_: function(passwordSectionOpened) {
hcarmona 2016/01/27 02:46:18 Had to change this b/c I realized that I was addin
michaelpg 2016/01/27 04:23:43 ok, but why is passwordSectionOpened necessary?
hcarmona 2016/01/29 23:52:11 Not used any more :-)
- if (passwordSectionOpened) {
- // TODO(hcarmona): Get real data.
- this.savedPasswords =
- [{origin: 'otherwebsite.com',
- username: 'bowser',
- password: '************'},
- {origin: 'otherlongwebsite.com',
- username: 'koopa',
- password: '*********'},
- {origin: 'otherverylongwebsite.com',
- username: 'goomba',
- password: '******'}];
+ if (passwordSectionOpened && !this.onSavedPasswordsListChanged_) {
+ /**
+ * Callback for updating the list of passwords.
+ * @param {!Array<!chrome.passwordsPrivate.PasswordUiEntry>} passwordList
+ */
+ this.onSavedPasswordsListChanged_ = function(passwordList) {
michaelpg 2016/01/27 04:23:43 Why create this dynamically rather than have this
hcarmona 2016/01/29 23:52:11 Updated: now part of the prototype and bound on |r
+ this.savedPasswords = passwordList;
+ };
+
+ // Triggers a callback after the listener is added.
+ chrome.passwordsPrivate.onSavedPasswordsListChanged.addListener(
+ this.onSavedPasswordsListChanged_.bind(this));
stevenjb 2016/01/27 19:28:45 Looking at this again, I think it would be more cl
hcarmona 2016/01/29 23:52:11 Awesome! Done. My only concern is that this API t
}
},
});

Powered by Google App Engine
This is Rietveld 408576698