| Index: chrome/browser/resources/settings/passwords_and_forms_page/passwords_and_forms_page.js
|
| diff --git a/chrome/browser/resources/settings/passwords_and_forms_page/passwords_and_forms_page.js b/chrome/browser/resources/settings/passwords_and_forms_page/passwords_and_forms_page.js
|
| index fd81d8f1ee390ac739aa6e2dfb59e1ece33bc6d4..402db4bd4dd990d31334d635a4a931f629a3aaf9 100644
|
| --- a/chrome/browser/resources/settings/passwords_and_forms_page/passwords_and_forms_page.js
|
| +++ b/chrome/browser/resources/settings/passwords_and_forms_page/passwords_and_forms_page.js
|
| @@ -297,216 +297,220 @@ AutofillManagerImpl.prototype = {
|
| };
|
|
|
| (function() {
|
| -'use strict';
|
| + 'use strict';
|
| +
|
| + Polymer({
|
| + is: 'settings-passwords-and-forms-page',
|
| +
|
| + behaviors: [PrefsBehavior],
|
| +
|
| + properties: {
|
| + /**
|
| + * An array of passwords to display.
|
| + * @type {!Array<!PasswordManager.PasswordUiEntry>}
|
| + */
|
| + savedPasswords: Array,
|
| +
|
| + /**
|
| + * An array of sites to display.
|
| + * @type {!Array<!PasswordManager.ExceptionPair>}
|
| + */
|
| + passwordExceptions: Array,
|
| +
|
| + /** @private Filter applied to passwords and password exceptions. */
|
| + passwordFilter_: String,
|
| +
|
| + /**
|
| + * An array of saved addresses.
|
| + * @type {!Array<!AutofillManager.AddressEntry>}
|
| + */
|
| + addresses: Array,
|
| +
|
| + /**
|
| + * An array of saved addresses.
|
| + * @type {!Array<!AutofillManager.CreditCardEntry>}
|
| + */
|
| + creditCards: Array,
|
| + },
|
| +
|
| + listeners: {
|
| + 'clear-credit-card': 'clearCreditCard_',
|
| + 'remove-address': 'removeAddress_',
|
| + 'remove-credit-card': 'removeCreditCard_',
|
| + 'remove-password-exception': 'removePasswordException_',
|
| + 'remove-saved-password': 'removeSavedPassword_',
|
| + 'save-address': 'saveAddress_',
|
| + 'save-credit-card': 'saveCreditCard_',
|
| + 'show-password': 'showPassword_',
|
| + },
|
| +
|
| + /** @type {?function(!Array<PasswordManager.PasswordUiEntry>):void} */
|
| + setSavedPasswordsListener_: null,
|
| +
|
| + /** @type {?function(!Array<PasswordManager.ExceptionPair>):void} */
|
| + setPasswordExceptionsListener_: null,
|
| +
|
| + /** @type {?function(!Array<!AutofillManager.AddressEntry>)} */
|
| + setAddressesListener_: null,
|
| +
|
| + /** @type {?function(!Array<!AutofillManager.CreditCardEntry>)} */
|
| + setCreditCardsListener_: null,
|
| +
|
| + /** @override */
|
| + ready: function() {
|
| + // Create listener functions.
|
| + this.setSavedPasswordsListener_ = function(list) {
|
| + this.savedPasswords = list;
|
| + }.bind(this);
|
| +
|
| + this.setPasswordExceptionsListener_ = function(list) {
|
| + this.passwordExceptions = list;
|
| + }.bind(this);
|
| +
|
| + this.setAddressesListener_ = function(list) {
|
| + this.addresses = list;
|
| + }.bind(this);
|
| +
|
| + this.setCreditCardsListener_ = function(list) {
|
| + this.creditCards = list;
|
| + }.bind(this);
|
| +
|
| + // Set the managers. These can be overridden by tests.
|
| + this.passwordManager_ = PasswordManagerImpl.getInstance();
|
| + this.autofillManager_ = AutofillManagerImpl.getInstance();
|
| +
|
| + // Request initial data.
|
| + this.passwordManager_.getSavedPasswordList(
|
| + this.setSavedPasswordsListener_);
|
| + this.passwordManager_.getExceptionList(
|
| + this.setPasswordExceptionsListener_);
|
| + this.autofillManager_.getAddressList(this.setAddressesListener_);
|
| + this.autofillManager_.getCreditCardList(this.setCreditCardsListener_);
|
| +
|
| + // Listen for changes.
|
| + this.passwordManager_.addSavedPasswordListChangedListener(
|
| + this.setSavedPasswordsListener_);
|
| + this.passwordManager_.addExceptionListChangedListener(
|
| + this.setPasswordExceptionsListener_);
|
| + this.autofillManager_.addAddressListChangedListener(
|
| + this.setAddressesListener_);
|
| + this.autofillManager_.addCreditCardListChangedListener(
|
| + this.setCreditCardsListener_);
|
| + },
|
| +
|
| + /** @override */
|
| + detached: function() {
|
| + this.passwordManager_.removeSavedPasswordListChangedListener(
|
| + this.setSavedPasswordsListener_);
|
| + this.passwordManager_.removeExceptionListChangedListener(
|
| + this.setPasswordExceptionsListener_);
|
| + this.autofillManager_.removeAddressListChangedListener(
|
| + this.setAddressesListener_);
|
| + this.autofillManager_.removeCreditCardListChangedListener(
|
| + this.setCreditCardsListener_);
|
| + },
|
|
|
| -Polymer({
|
| - is: 'settings-passwords-and-forms-page',
|
| -
|
| - behaviors: [PrefsBehavior],
|
| -
|
| - properties: {
|
| /**
|
| - * An array of passwords to display.
|
| - * @type {!Array<!PasswordManager.PasswordUiEntry>}
|
| + * Listens for the remove-password-exception event, and calls the private
|
| + * API.
|
| + * @param {!Event} event
|
| + * @private
|
| */
|
| - savedPasswords: Array,
|
| + removePasswordException_: function(event) {
|
| + this.passwordManager_.removeException(event.detail);
|
| + },
|
|
|
| /**
|
| - * An array of sites to display.
|
| - * @type {!Array<!PasswordManager.ExceptionPair>}
|
| + * Listens for the remove-saved-password event, and calls the private API.
|
| + * @param {!Event} event
|
| + * @private
|
| */
|
| - passwordExceptions: Array,
|
| -
|
| - /** @private Filter applied to passwords and password exceptions. */
|
| - passwordFilter_: String,
|
| + removeSavedPassword_: function(event) {
|
| + this.passwordManager_.removeSavedPassword(event.detail);
|
| + },
|
|
|
| /**
|
| - * An array of saved addresses.
|
| - * @type {!Array<!AutofillManager.AddressEntry>}
|
| + * Listens for the remove-address event, and calls the private API.
|
| + * @param {!Event} event
|
| + * @private
|
| */
|
| - addresses: Array,
|
| + removeAddress_: function(event) {
|
| + this.autofillManager_.removeAddress(event.detail.guid);
|
| + },
|
|
|
| /**
|
| - * An array of saved addresses.
|
| - * @type {!Array<!AutofillManager.CreditCardEntry>}
|
| + * Listens for the remove-credit-card event, and calls the private API.
|
| + * @param {!Event} event
|
| + * @private
|
| */
|
| - creditCards: Array,
|
| - },
|
| -
|
| - listeners: {
|
| - 'clear-credit-card': 'clearCreditCard_',
|
| - 'remove-address': 'removeAddress_',
|
| - 'remove-credit-card': 'removeCreditCard_',
|
| - 'remove-password-exception': 'removePasswordException_',
|
| - 'remove-saved-password': 'removeSavedPassword_',
|
| - 'save-address': 'saveAddress_',
|
| - 'save-credit-card': 'saveCreditCard_',
|
| - 'show-password': 'showPassword_',
|
| - },
|
| -
|
| - /** @type {?function(!Array<PasswordManager.PasswordUiEntry>):void} */
|
| - setSavedPasswordsListener_: null,
|
| -
|
| - /** @type {?function(!Array<PasswordManager.ExceptionPair>):void} */
|
| - setPasswordExceptionsListener_: null,
|
| -
|
| - /** @type {?function(!Array<!AutofillManager.AddressEntry>)} */
|
| - setAddressesListener_: null,
|
| -
|
| - /** @type {?function(!Array<!AutofillManager.CreditCardEntry>)} */
|
| - setCreditCardsListener_: null,
|
| -
|
| - /** @override */
|
| - ready: function() {
|
| - // Create listener functions.
|
| - this.setSavedPasswordsListener_ = function(list) {
|
| - this.savedPasswords = list;
|
| - }.bind(this);
|
| -
|
| - this.setPasswordExceptionsListener_ = function(list) {
|
| - this.passwordExceptions = list;
|
| - }.bind(this);
|
| -
|
| - this.setAddressesListener_ = function(list) {
|
| - this.addresses = list;
|
| - }.bind(this);
|
| -
|
| - this.setCreditCardsListener_ = function(list) {
|
| - this.creditCards = list;
|
| - }.bind(this);
|
| -
|
| - // Set the managers. These can be overridden by tests.
|
| - this.passwordManager_ = PasswordManagerImpl.getInstance();
|
| - this.autofillManager_ = AutofillManagerImpl.getInstance();
|
| -
|
| - // Request initial data.
|
| - this.passwordManager_.getSavedPasswordList(this.setSavedPasswordsListener_);
|
| - this.passwordManager_.getExceptionList(this.setPasswordExceptionsListener_);
|
| - this.autofillManager_.getAddressList(this.setAddressesListener_);
|
| - this.autofillManager_.getCreditCardList(this.setCreditCardsListener_);
|
| -
|
| - // Listen for changes.
|
| - this.passwordManager_.addSavedPasswordListChangedListener(
|
| - this.setSavedPasswordsListener_);
|
| - this.passwordManager_.addExceptionListChangedListener(
|
| - this.setPasswordExceptionsListener_);
|
| - this.autofillManager_.addAddressListChangedListener(
|
| - this.setAddressesListener_);
|
| - this.autofillManager_.addCreditCardListChangedListener(
|
| - this.setCreditCardsListener_);
|
| - },
|
| -
|
| - /** @override */
|
| - detached: function() {
|
| - this.passwordManager_.removeSavedPasswordListChangedListener(
|
| - this.setSavedPasswordsListener_);
|
| - this.passwordManager_.removeExceptionListChangedListener(
|
| - this.setPasswordExceptionsListener_);
|
| - this.autofillManager_.removeAddressListChangedListener(
|
| - this.setAddressesListener_);
|
| - this.autofillManager_.removeCreditCardListChangedListener(
|
| - this.setCreditCardsListener_);
|
| - },
|
| -
|
| - /**
|
| - * Listens for the remove-password-exception event, and calls the private API.
|
| - * @param {!Event} event
|
| - * @private
|
| - */
|
| - removePasswordException_: function(event) {
|
| - this.passwordManager_.removeException(event.detail);
|
| - },
|
| -
|
| - /**
|
| - * Listens for the remove-saved-password event, and calls the private API.
|
| - * @param {!Event} event
|
| - * @private
|
| - */
|
| - removeSavedPassword_: function(event) {
|
| - this.passwordManager_.removeSavedPassword(event.detail);
|
| - },
|
| -
|
| - /**
|
| - * Listens for the remove-address event, and calls the private API.
|
| - * @param {!Event} event
|
| - * @private
|
| - */
|
| - removeAddress_: function(event) {
|
| - this.autofillManager_.removeAddress(event.detail.guid);
|
| - },
|
| -
|
| - /**
|
| - * Listens for the remove-credit-card event, and calls the private API.
|
| - * @param {!Event} event
|
| - * @private
|
| - */
|
| - removeCreditCard_: function(event) {
|
| - this.autofillManager_.removeCreditCard(event.detail.guid);
|
| - },
|
| + removeCreditCard_: function(event) {
|
| + this.autofillManager_.removeCreditCard(event.detail.guid);
|
| + },
|
|
|
| - /**
|
| - * Listens for the clear-credit-card event, and calls the private API.
|
| - * @param {!Event} event
|
| - * @private
|
| - */
|
| - clearCreditCard_: function(event) {
|
| - this.autofillManager_.clearCachedCreditCard(event.detail.guid);
|
| - },
|
| + /**
|
| + * Listens for the clear-credit-card event, and calls the private API.
|
| + * @param {!Event} event
|
| + * @private
|
| + */
|
| + clearCreditCard_: function(event) {
|
| + this.autofillManager_.clearCachedCreditCard(event.detail.guid);
|
| + },
|
|
|
| - /**
|
| - * Shows the manage autofill sub page.
|
| - * @param {!Event} event
|
| - * @private
|
| - */
|
| - onAutofillTap_: function(event) {
|
| - // Ignore clicking on the toggle button and verify autofill is enabled.
|
| - if (Polymer.dom(event).localTarget != this.$.autofillToggle &&
|
| - this.getPref('autofill.enabled').value) {
|
| - settings.navigateTo(settings.Route.AUTOFILL);
|
| - }
|
| - },
|
| + /**
|
| + * Shows the manage autofill sub page.
|
| + * @param {!Event} event
|
| + * @private
|
| + */
|
| + onAutofillTap_: function(event) {
|
| + // Ignore clicking on the toggle button and verify autofill is enabled.
|
| + if (Polymer.dom(event).localTarget != this.$.autofillToggle &&
|
| + this.getPref('autofill.enabled').value) {
|
| + settings.navigateTo(settings.Route.AUTOFILL);
|
| + }
|
| + },
|
|
|
| - /**
|
| - * Shows the manage passwords sub page.
|
| - * @param {!Event} event
|
| - * @private
|
| - */
|
| - onPasswordsTap_: function(event) {
|
| - // Ignore clicking on the toggle button and only expand if the manager is
|
| - // enabled.
|
| - if (Polymer.dom(event).localTarget != this.$.passwordToggle &&
|
| - this.getPref('profile.password_manager_enabled').value) {
|
| - settings.navigateTo(settings.Route.MANAGE_PASSWORDS);
|
| - }
|
| - },
|
| + /**
|
| + * Shows the manage passwords sub page.
|
| + * @param {!Event} event
|
| + * @private
|
| + */
|
| + onPasswordsTap_: function(event) {
|
| + // Ignore clicking on the toggle button and only expand if the manager is
|
| + // enabled.
|
| + if (Polymer.dom(event).localTarget != this.$.passwordToggle &&
|
| + this.getPref('profile.password_manager_enabled').value) {
|
| + settings.navigateTo(settings.Route.MANAGE_PASSWORDS);
|
| + }
|
| + },
|
|
|
| - /**
|
| - * Listens for the save-address event, and calls the private API.
|
| - * @param {!Event} event
|
| - * @private
|
| - */
|
| - saveAddress_: function(event) {
|
| - this.autofillManager_.saveAddress(event.detail);
|
| - },
|
| + /**
|
| + * Listens for the save-address event, and calls the private API.
|
| + * @param {!Event} event
|
| + * @private
|
| + */
|
| + saveAddress_: function(event) {
|
| + this.autofillManager_.saveAddress(event.detail);
|
| + },
|
|
|
| - /**
|
| - * Listens for the save-credit-card event, and calls the private API.
|
| - * @param {!Event} event
|
| - * @private
|
| - */
|
| - saveCreditCard_: function(event) {
|
| - this.autofillManager_.saveCreditCard(event.detail);
|
| - },
|
| + /**
|
| + * Listens for the save-credit-card event, and calls the private API.
|
| + * @param {!Event} event
|
| + * @private
|
| + */
|
| + saveCreditCard_: function(event) {
|
| + this.autofillManager_.saveCreditCard(event.detail);
|
| + },
|
|
|
| - /**
|
| - * Listens for the show-password event, and calls the private API.
|
| - * @param {!Event} event
|
| - * @private
|
| - */
|
| - showPassword_: function(event) {
|
| - this.passwordManager_.getPlaintextPassword(event.detail, function(e) {
|
| - this.$$('#passwordSection').setPassword(e.loginPair, e.plaintextPassword);
|
| - }.bind(this));
|
| - },
|
| -});
|
| + /**
|
| + * Listens for the show-password event, and calls the private API.
|
| + * @param {!Event} event
|
| + * @private
|
| + */
|
| + showPassword_: function(event) {
|
| + this.passwordManager_.getPlaintextPassword(event.detail, function(e) {
|
| + this.$$('#passwordSection')
|
| + .setPassword(e.loginPair, e.plaintextPassword);
|
| + }.bind(this));
|
| + },
|
| + });
|
| })();
|
|
|