Chromium Code Reviews| 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(); |