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 0ec93b7a71c8b2fe2c8a0c33e1ad396e1737e4b0..676deec659326d823629d43cc22d5d9d64c9532b 100644 |
| --- a/chrome/browser/resources/options/password_manager.js |
| +++ b/chrome/browser/resources/options/password_manager.js |
| @@ -3,8 +3,9 @@ |
| // found in the LICENSE file. |
| cr.define('options', function() { |
| - |
| - var OptionsPage = options.OptionsPage; |
| + const OptionsPage = options.OptionsPage; |
| + const ArrayDataModel = cr.ui.ArrayDataModel; |
| + const ListSingleSelectionModel = cr.ui.ListSingleSelectionModel; |
| ///////////////////////////////////////////////////////////////////////////// |
| // PasswordManager class: |
| @@ -17,8 +18,8 @@ cr.define('options', function() { |
| this.activeNavTab = null; |
| OptionsPage.call(this, |
| 'passwordManager', |
| - templateData.savedPasswordsTitle, |
| - 'passwordManager'); |
| + templateData.passwordsTitle, |
| + 'password-manager'); |
| } |
| cr.addSingletonGetter(PasswordManager); |
| @@ -26,37 +27,41 @@ cr.define('options', function() { |
| PasswordManager.prototype = { |
| __proto__: OptionsPage.prototype, |
| + savedPasswordsList_: null, |
|
stuartmorgan
2010/12/17 00:40:21
Should these be documented? I've been documenting
James Hawkins
2010/12/17 02:33:57
Done.
|
| + passwordExceptionsList_: null, |
| + |
| initializePage: function() { |
| OptionsPage.prototype.initializePage.call(this); |
| - options.passwordManager.PasswordsListArea.decorate($('passwordsArea')); |
| - options.passwordManager.PasswordExceptionsListArea.decorate( |
| - $('passwordExceptionsArea')); |
| + this.createSavedPasswordsList_(); |
| + this.createPasswordExceptionsList_(); |
| - $('password-exceptions-nav-tab').onclick = function() { |
| - OptionsPage.showTab($('password-exceptions-nav-tab')); |
| - passwordExceptionsList.redraw(); |
| - } |
| + chrome.send('updatePasswordLists'); |
| }, |
| - setSavedPasswordsList_: function(entries) { |
| - savedPasswordsList.clear(); |
| - for (var i = 0; i < entries.length; i++) { |
| - savedPasswordsList.addEntry(entries[i]); |
| - } |
| + createSavedPasswordsList_: function() { |
|
stuartmorgan
2010/12/17 00:40:21
Needs documentation
|
| + this.savedPasswordsList_ = $('saved-passwords-list'); |
| + options.passwordManager.PasswordsList.decorate(this.savedPasswordsList_); |
| + this.savedPasswordsList_.selectionModel = new ListSingleSelectionModel; |
| + this.savedPasswordsList_.autoExpands = true; |
| }, |
| - setPasswordExceptionsList_: function(entries) { |
| - passwordExceptionsList.clear(); |
| - for (var i = 0; i < entries.length; i++) { |
| - passwordExceptionsList.addEntry(entries[i]); |
| - } |
| + createPasswordExceptionsList_: function() { |
| + this.passwordExceptionsList_ = $('password-exceptions-list'); |
| + options.passwordManager.PasswordExceptionsList.decorate( |
| + this.passwordExceptionsList_); |
| + this.passwordExceptionsList_.selectionModel = |
| + new ListSingleSelectionModel; |
| + this.passwordExceptionsList_.autoExpands = true; |
| }, |
| - }; |
| + setSavedPasswordsList_: function(entries) { |
|
stuartmorgan
2010/12/17 00:40:21
Ditto
James Hawkins
2010/12/17 02:33:57
Done.
|
| + this.savedPasswordsList_.dataModel = new ArrayDataModel(entries); |
| + }, |
| - PasswordManager.load = function() { |
| - chrome.send('loadLists'); |
| + setPasswordExceptionsList_: function(entries) { |
|
stuartmorgan
2010/12/17 00:40:21
Ditto
James Hawkins
2010/12/17 02:33:57
Done.
|
| + this.passwordExceptionsList_.dataModel = new ArrayDataModel(entries); |
| + }, |
| }; |
| /** |
| @@ -75,7 +80,6 @@ cr.define('options', function() { |
| chrome.send('removePasswordException', [String(rowIndex)]); |
| }; |
| - |
| /** |
| * Call to remove all saved passwords. |
| * @param tab contentType of the tab currently on. |
| @@ -92,10 +96,6 @@ cr.define('options', function() { |
| chrome.send('removeAllPasswordExceptions'); |
| }; |
| - PasswordManager.showSelectedPassword = function(index) { |
| - chrome.send('showSelectedPassword', [String(index)]); |
| - }; |
| - |
| PasswordManager.setSavedPasswordsList = function(entries) { |
| PasswordManager.getInstance().setSavedPasswordsList_(entries); |
| }; |
| @@ -104,10 +104,6 @@ cr.define('options', function() { |
| PasswordManager.getInstance().setPasswordExceptionsList_(entries); |
| }; |
| - PasswordManager.selectedPasswordCallback = function(password) { |
| - passwordsArea.displayReturnedPassword(password); |
| - }; |
| - |
| // Export |
| return { |
| PasswordManager: PasswordManager |