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

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

Issue 2092763004: [MD Settings] Implement search in material design passwords. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update to better match mocks Created 4 years, 5 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 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
*/

Powered by Google App Engine
This is Rietveld 408576698