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 cecb4a55d5a33c2cd7d0857af52609fc3c155ab2..064fbeb1705035fa5fce2162b5e065d89975ae59 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 |
@@ -53,6 +53,30 @@ Polymer({ |
* @private {?chrome.passwordsPrivate.PasswordUiEntry} |
*/ |
activePassword: Object, |
+ |
+ /** Filter on the saved passwords and exceptions. */ |
+ filter: { |
+ type: String, |
+ value: '', |
+ }, |
+ |
+ /** |
+ * A filtered list of saved passwords. |
+ * @type {!Array<!chrome.passwordsPrivate.PasswordUiEntry>} |
+ */ |
+ filteredPasswords: { |
dpapad
2016/07/20 19:34:51
If you end up keeping those (see previous comment
hcarmona
2016/07/20 21:06:07
Removed.
|
+ 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: { |
@@ -91,6 +115,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 |
*/ |