| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 cr.define('options', function() { | 5 cr.define('options', function() { |
| 6 | 6 |
| 7 var OptionsPage = options.OptionsPage; | 7 var OptionsPage = options.OptionsPage; |
| 8 | 8 |
| 9 ///////////////////////////////////////////////////////////////////////////// | 9 ///////////////////////////////////////////////////////////////////////////// |
| 10 // PasswordsExceptions class: | 10 // PasswordsExceptions class: |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 } | 21 } |
| 22 | 22 |
| 23 cr.addSingletonGetter(PasswordsExceptions); | 23 cr.addSingletonGetter(PasswordsExceptions); |
| 24 | 24 |
| 25 PasswordsExceptions.prototype = { | 25 PasswordsExceptions.prototype = { |
| 26 __proto__: OptionsPage.prototype, | 26 __proto__: OptionsPage.prototype, |
| 27 | 27 |
| 28 initializePage: function() { | 28 initializePage: function() { |
| 29 OptionsPage.prototype.initializePage.call(this); | 29 OptionsPage.prototype.initializePage.call(this); |
| 30 | 30 |
| 31 options.passwordsExceptions.ListArea.decorate($('passwordsArea')); | 31 options.passwordsExceptions.PasswordsListArea.decorate($('passwordsArea'))
; |
| 32 options.passwordsExceptions.PasswordExceptionsListArea.decorate( |
| 33 $('passwordExceptionsArea')); |
| 32 | 34 |
| 33 // TODO(sargrass): Passwords filter page -------------------------- | 35 $('password-exceptions-nav-tab').onclick = function() { |
| 34 | 36 OptionsPage.showTab($('password-exceptions-nav-tab')); |
| 35 // TODO(sargrass): Exceptions filter page ------------------------- | 37 passwordExceptionsList.redraw(); |
| 36 | 38 } |
| 37 }, | 39 }, |
| 38 | 40 |
| 39 setAutofillableLogins_: function(entries) { | 41 setSavedPasswordsList_: function(entries) { |
| 40 autofillableLoginsList.clear(); | 42 savedPasswordsList.clear(); |
| 41 for (var i = 0; i < entries.length; i++) { | 43 for (var i = 0; i < entries.length; i++) { |
| 42 autofillableLoginsList.addEntry(entries[i]); | 44 savedPasswordsList.addEntry(entries[i]); |
| 43 } | 45 } |
| 44 }, | 46 }, |
| 47 |
| 48 setPasswordExceptionsList_: function(entries) { |
| 49 passwordExceptionsList.clear(); |
| 50 for (var i = 0; i < entries.length; i++) { |
| 51 passwordExceptionsList.addEntry(entries[i]); |
| 52 } |
| 53 }, |
| 54 |
| 45 }; | 55 }; |
| 46 | 56 |
| 47 PasswordsExceptions.load = function() { | 57 PasswordsExceptions.load = function() { |
| 48 chrome.send('loadSavedPasswords'); | 58 chrome.send('loadLists'); |
| 49 }; | 59 }; |
| 50 | 60 |
| 51 PasswordsExceptions.removeAutofillable = function(index) { | 61 /** |
| 52 chrome.send('removeAutofillable', [String(index)]); | 62 * Call to remove a saved password. |
| 63 * @param rowIndex indicating the row to remove. |
| 64 */ |
| 65 PasswordsExceptions.removeSavedPassword = function(rowIndex) { |
| 66 chrome.send('removeSavedPassword', [String(rowIndex)]); |
| 67 }; |
| 68 |
| 69 /** |
| 70 * Call to remove a password exception. |
| 71 * @param rowIndex indicating the row to remove. |
| 72 */ |
| 73 PasswordsExceptions.removePasswordException = function(rowIndex) { |
| 74 chrome.send('removePasswordException', [String(rowIndex)]); |
| 75 }; |
| 76 |
| 77 |
| 78 /** |
| 79 * Call to remove all saved passwords. |
| 80 * @param tab contentType of the tab currently on. |
| 81 */ |
| 82 PasswordsExceptions.removeAllPasswords = function() { |
| 83 chrome.send('removeAllSavedPasswords'); |
| 84 }; |
| 85 |
| 86 /** |
| 87 * Call to remove all saved passwords. |
| 88 * @param tab contentType of the tab currently on. |
| 89 */ |
| 90 PasswordsExceptions.removeAllPasswordExceptions = function() { |
| 91 chrome.send('removeAllPasswordExceptions'); |
| 53 }; | 92 }; |
| 54 | 93 |
| 55 PasswordsExceptions.showSelectedPassword = function(index) { | 94 PasswordsExceptions.showSelectedPassword = function(index) { |
| 56 chrome.send('showSelectedPassword', [String(index)]); | 95 chrome.send('showSelectedPassword', [String(index)]); |
| 57 }; | 96 }; |
| 58 | 97 |
| 59 PasswordsExceptions.setAutofillableLogins = function(entries) { | 98 PasswordsExceptions.setSavedPasswordsList = function(entries) { |
| 60 PasswordsExceptions.getInstance().setAutofillableLogins_(entries); | 99 PasswordsExceptions.getInstance().setSavedPasswordsList_(entries); |
| 100 }; |
| 101 |
| 102 PasswordsExceptions.setPasswordExceptionsList = function(entries) { |
| 103 PasswordsExceptions.getInstance().setPasswordExceptionsList_(entries); |
| 61 }; | 104 }; |
| 62 | 105 |
| 63 PasswordsExceptions.selectedPasswordCallback = function(password) { | 106 PasswordsExceptions.selectedPasswordCallback = function(password) { |
| 64 passwordsArea.displayReturnedPassword(password); | 107 passwordsArea.displayReturnedPassword(password); |
| 65 }; | 108 }; |
| 66 | 109 |
| 67 // Export | 110 // Export |
| 68 return { | 111 return { |
| 69 PasswordsExceptions: PasswordsExceptions | 112 PasswordsExceptions: PasswordsExceptions |
| 70 }; | 113 }; |
| 71 | 114 |
| 72 }); | 115 }); |
| 73 | 116 |
| OLD | NEW |