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 447315621d0c1da87d7dedcaa431f44b0af3110e..2a7278ad83c83d6706e1ecca915a94954040371b 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 |
@@ -46,6 +46,30 @@ Polymer({ |
type: Array, |
value: function() { return []; }, |
}, |
+ |
+ /** Filter on the saved passwords and exceptions. */ |
+ filter: { |
+ type: String, |
+ value: '', |
+ }, |
+ |
+ /** |
+ * A filtered list of saved passwords. |
+ * @type {!Array<!chrome.passwordsPrivate.PasswordUiEntry>} |
+ */ |
+ filteredPasswords: { |
+ type: Array, |
+ computed: 'savedPasswords_(savedPasswords, filter)', |
+ }, |
+ |
+ /** |
+ * A filtered list of password exceptions. |
+ * @type {!Array<!chrome.passwordsPrivate.ExceptionPair>} |
+ */ |
+ filteredExceptions: { |
+ type: Array, |
+ computed: 'passwordExceptions_(passwordExceptions, filter)', |
+ }, |
}, |
listeners: { |
@@ -56,7 +80,7 @@ Polymer({ |
/** |
* Sets the password in the current password dialog if the loginPair matches. |
* @param {!chrome.passwordsPrivate.LoginPair} loginPair |
- * @param {!string} password |
+ * @param {string} password |
*/ |
setPassword: function(loginPair, password) { |
var passwordDialog = this.$.passwordEditDialog; |
@@ -81,6 +105,37 @@ Polymer({ |
}, |
/** |
+ * @param {!Array<!chrome.passwordsPrivate.PasswordUiEntry>} savedPasswords |
+ * @param {string} filter |
+ * @return {!Array<!chrome.passwordsPrivate.PasswordUiEntry>} |
+ * @private |
+ */ |
+ savedPasswords_: function(savedPasswords, filter) { |
+ if (!filter) |
+ return savedPasswords; |
+ |
+ return savedPasswords.filter(function(password) { |
+ return password.loginPair.originUrl.indexOf(filter) >= 0 || |
+ password.loginPair.username.indexOf(filter) >= 0; |
+ }); |
+ }, |
+ |
+ /** |
+ * @param {!Array<!chrome.passwordsPrivate.ExceptionPair>} passwordExceptions |
+ * @param {string} filter |
+ * @return {!Array<!chrome.passwordsPrivate.ExceptionPair>} |
+ * @private |
+ */ |
+ passwordExceptions_: function(passwordExceptions, filter) { |
+ if (!filter) |
+ return passwordExceptions; |
+ |
+ return passwordExceptions.filter(function(exception) { |
+ return exception.exceptionUrl.indexOf(filter) >= 0; |
+ }); |
+ }, |
+ |
+ /** |
* Fires an event that should delete the saved password. |
* @private |
*/ |