| 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.
|
| + */
|
| + 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;
|
| + 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();
|
|
|