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

Unified Diff: chrome/browser/resources/options/password_manager.js

Issue 489103004: Allow editing passwords in settings/passwords (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added one more test. Modified the comments and the string. Created 6 years, 4 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/options/password_manager.js
diff --git a/chrome/browser/resources/options/password_manager.js b/chrome/browser/resources/options/password_manager.js
index 4758254538cf243d93e99601941836210b30514d..e5f77b33409fc06232627a85e94f5fad33d10b92 100644
--- a/chrome/browser/resources/options/password_manager.js
+++ b/chrome/browser/resources/options/password_manager.js
@@ -169,6 +169,9 @@ cr.define('options', function() {
return false;
};
entries = entries.filter(filter);
+ } else {
+ // Adds the Add New Entry row.
+ entries.push(null);
}
this.savedPasswordsList_.dataModel = new ArrayDataModel(entries);
this.updateListVisibility_(this.savedPasswordsList_);
@@ -208,6 +211,49 @@ cr.define('options', function() {
var item = this.savedPasswordsList_.getListItemByIndex(index);
item.showPassword(password);
},
+
+ /**
+ * Forwards the validity of the origin to the Add New Entry row.
+ * @param {string} url The origin.
+ * @param {boolean} valid The validity of the origin for adding.
Dan Beam 2014/08/26 17:39:05 @private
jaekyeom 2014/08/27 12:28:52 Done.
+ */
+ originValidityCheckComplete_: function(url, valid) {
+ // There is no Add New Entry row when a filter is active.
+ if (this.lastQuery_)
+ return;
+ var model = this.savedPasswordsList_.dataModel;
Dan Beam 2014/08/26 17:39:05 what if model.length == 0?
jaekyeom 2014/08/27 12:28:53 Done. I modified the condition a bit and added a c
+ var addRowItem = this.savedPasswordsList_.getListItemByIndex(
+ model.length - 1);
+ addRowItem.originValidityCheckComplete(url, valid);
+ },
+ };
+
+ /**
+ * Requests the browser to check the validity of the origin being edited by
+ * the user in the Add New Entry row.
+ * @param {string} url The origin being edited.
+ */
+ PasswordManager.checkOriginValidityForAdding = function(url) {
+ chrome.send('checkOriginValidityForAdding', [url]);
+ };
+
+ /**
+ * Adds a new password entry.
+ * @param {string} url The origin.
+ * @param {string} username The username value.
+ * @param {string} password The password value.
+ */
+ PasswordManager.addPassword = function(url, username, password) {
+ chrome.send('addPassword', [url, username, password]);
+ };
+
+ /**
+ * Updates the password value of an entry.
+ * @param {number} rowIndex The row to update.
+ * @param {string} newPassword The new password value.
+ */
+ PasswordManager.updatePassword = function(rowIndex, newPassword) {
+ chrome.send('updatePassword', [String(rowIndex), newPassword]);
};
/**
@@ -234,7 +280,8 @@ cr.define('options', function() {
[
'setSavedPasswordsList',
'setPasswordExceptionsList',
- 'showPassword'
+ 'showPassword',
+ 'originValidityCheckComplete'
].forEach(function(name) {
PasswordManager[name] = function() {
var instance = PasswordManager.getInstance();

Powered by Google App Engine
This is Rietveld 408576698