| Index: chrome/browser/resources/settings/passwords_and_forms_page/autofill_section.js
|
| diff --git a/chrome/browser/resources/settings/passwords_and_forms_page/autofill_section.js b/chrome/browser/resources/settings/passwords_and_forms_page/autofill_section.js
|
| index cc1a2d8a72f55e80858b8888eb7cde1788b6cc26..a272527382bcb264a1dc614d31dad14f6129848d 100644
|
| --- a/chrome/browser/resources/settings/passwords_and_forms_page/autofill_section.js
|
| +++ b/chrome/browser/resources/settings/passwords_and_forms_page/autofill_section.js
|
| @@ -146,114 +146,114 @@ AutofillManagerImpl.prototype = {
|
| };
|
|
|
| (function() {
|
| - 'use strict';
|
| +'use strict';
|
|
|
| - Polymer({
|
| - is: 'settings-autofill-section',
|
| +Polymer({
|
| + is: 'settings-autofill-section',
|
|
|
| - behaviors: [I18nBehavior],
|
| + behaviors: [I18nBehavior],
|
|
|
| - properties: {
|
| + properties: {
|
| /**
|
| * An array of saved addresses.
|
| * @type {!Array<!AutofillManager.AddressEntry>}
|
| */
|
| - addresses: Array,
|
| + addresses: Array,
|
|
|
| /**
|
| * The model for any address related action menus or dialogs.
|
| * @private {?chrome.autofillPrivate.AddressEntry}
|
| */
|
| - activeAddress: Object,
|
| + activeAddress: Object,
|
|
|
| /** @private */
|
| - showAddressDialog_: Boolean,
|
| + showAddressDialog_: Boolean,
|
|
|
| /**
|
| * An array of saved credit cards.
|
| * @type {!Array<!AutofillManager.CreditCardEntry>}
|
| */
|
| - creditCards: Array,
|
| + creditCards: Array,
|
|
|
| /**
|
| * The model for any credit card related action menus or dialogs.
|
| * @private {?chrome.autofillPrivate.CreditCardEntry}
|
| */
|
| - activeCreditCard: Object,
|
| + activeCreditCard: Object,
|
|
|
| /** @private */
|
| - showCreditCardDialog_: Boolean,
|
| - },
|
| + showCreditCardDialog_: Boolean,
|
| + },
|
|
|
| - listeners: {
|
| - 'save-address': 'saveAddress_',
|
| - 'save-credit-card': 'saveCreditCard_',
|
| - },
|
| + listeners: {
|
| + 'save-address': 'saveAddress_',
|
| + 'save-credit-card': 'saveCreditCard_',
|
| + },
|
|
|
| /**
|
| * The element to return focus to, when the currently active dialog is
|
| * closed.
|
| * @private {?HTMLElement}
|
| */
|
| - activeDialogAnchor_: null,
|
| + activeDialogAnchor_: null,
|
|
|
| /**
|
| * @type {AutofillManager}
|
| * @private
|
| */
|
| - autofillManager_: null,
|
| + autofillManager_: null,
|
|
|
| /**
|
| * @type {?function(!Array<!AutofillManager.AddressEntry>)}
|
| * @private
|
| */
|
| - setAddressesListener_: null,
|
| + setAddressesListener_: null,
|
|
|
| /**
|
| * @type {?function(!Array<!AutofillManager.CreditCardEntry>)}
|
| * @private
|
| */
|
| - setCreditCardsListener_: null,
|
| + setCreditCardsListener_: null,
|
|
|
| /** @override */
|
| - attached: function() {
|
| + attached: function() {
|
| // Create listener functions.
|
| /** @type {function(!Array<!AutofillManager.AddressEntry>)} */
|
| - var setAddressesListener = function(list) {
|
| - this.addresses = list;
|
| - }.bind(this);
|
| + var setAddressesListener = function(list) {
|
| + this.addresses = list;
|
| + }.bind(this);
|
|
|
| /** @type {function(!Array<!AutofillManager.CreditCardEntry>)} */
|
| - var setCreditCardsListener = function(list) {
|
| - this.creditCards = list;
|
| - }.bind(this);
|
| + var setCreditCardsListener = function(list) {
|
| + this.creditCards = list;
|
| + }.bind(this);
|
|
|
| // Remember the bound reference in order to detach.
|
| - this.setAddressesListener_ = setAddressesListener;
|
| - this.setCreditCardsListener_ = setCreditCardsListener;
|
| + this.setAddressesListener_ = setAddressesListener;
|
| + this.setCreditCardsListener_ = setCreditCardsListener;
|
|
|
| // Set the managers. These can be overridden by tests.
|
| - this.autofillManager_ = AutofillManagerImpl.getInstance();
|
| + this.autofillManager_ = AutofillManagerImpl.getInstance();
|
|
|
| // Request initial data.
|
| - this.autofillManager_.getAddressList(setAddressesListener);
|
| - this.autofillManager_.getCreditCardList(setCreditCardsListener);
|
| + this.autofillManager_.getAddressList(setAddressesListener);
|
| + this.autofillManager_.getCreditCardList(setCreditCardsListener);
|
|
|
| // Listen for changes.
|
| - this.autofillManager_.addAddressListChangedListener(setAddressesListener);
|
| - this.autofillManager_.addCreditCardListChangedListener(
|
| + this.autofillManager_.addAddressListChangedListener(setAddressesListener);
|
| + this.autofillManager_.addCreditCardListChangedListener(
|
| setCreditCardsListener);
|
| - },
|
| + },
|
|
|
| /** @override */
|
| - detached: function() {
|
| - this.autofillManager_.removeAddressListChangedListener(
|
| + detached: function() {
|
| + this.autofillManager_.removeAddressListChangedListener(
|
| /** @type {function(!Array<!AutofillManager.AddressEntry>)} */(
|
| this.setAddressesListener_));
|
| - this.autofillManager_.removeCreditCardListChangedListener(
|
| + this.autofillManager_.removeCreditCardListChangedListener(
|
| /** @type {function(!Array<!AutofillManager.CreditCardEntry>)} */(
|
| this.setCreditCardsListener_));
|
| - },
|
| + },
|
|
|
| /**
|
| * Formats the expiration date so it's displayed as MM/YYYY.
|
| @@ -261,159 +261,159 @@ AutofillManagerImpl.prototype = {
|
| * @return {string}
|
| * @private
|
| */
|
| - expiration_: function(item) {
|
| - return item.expirationMonth + '/' + item.expirationYear;
|
| - },
|
| + expiration_: function(item) {
|
| + return item.expirationMonth + '/' + item.expirationYear;
|
| + },
|
|
|
| /**
|
| * Open the address action menu.
|
| * @param {!Event} e The polymer event.
|
| * @private
|
| */
|
| - onAddressMenuTap_: function(e) {
|
| - var menuEvent = /** @type {!{model: !{item: !Object}}} */(e);
|
| + onAddressMenuTap_: function(e) {
|
| + var menuEvent = /** @type {!{model: !{item: !Object}}} */(e);
|
|
|
| /* TODO(scottchen): drop the [dataHost][dataHost] once this bug is fixed:
|
| https://github.com/Polymer/polymer/issues/2574 */
|
| - var item = menuEvent.model['dataHost']['dataHost'].item;
|
| + var item = menuEvent.model['dataHost']['dataHost'].item;
|
|
|
| // Copy item so dialog won't update model on cancel.
|
| - this.activeAddress = /** @type {!chrome.autofillPrivate.AddressEntry} */(
|
| + this.activeAddress = /** @type {!chrome.autofillPrivate.AddressEntry} */(
|
| Object.assign({}, item));
|
|
|
| - var dotsButton = /** @type {!HTMLElement} */ (Polymer.dom(e).localTarget);
|
| - /** @type {!CrActionMenuElement} */ (
|
| + var dotsButton = /** @type {!HTMLElement} */ (Polymer.dom(e).localTarget);
|
| + /** @type {!CrActionMenuElement} */ (
|
| this.$.addressSharedMenu).showAt(dotsButton);
|
| - this.activeDialogAnchor_ = dotsButton;
|
| - },
|
| + this.activeDialogAnchor_ = dotsButton;
|
| + },
|
|
|
| /**
|
| * Handles tapping on the "Add address" button.
|
| * @param {!Event} e The polymer event.
|
| * @private
|
| */
|
| - onAddAddressTap_: function(e) {
|
| - e.preventDefault();
|
| - this.activeAddress = {};
|
| - this.showAddressDialog_ = true;
|
| - this.activeDialogAnchor_ = this.$.addAddress;
|
| - },
|
| + onAddAddressTap_: function(e) {
|
| + e.preventDefault();
|
| + this.activeAddress = {};
|
| + this.showAddressDialog_ = true;
|
| + this.activeDialogAnchor_ = this.$.addAddress;
|
| + },
|
|
|
| /** @private */
|
| - onAddressDialogClosed_: function() {
|
| - this.showAddressDialog_ = false;
|
| - this.activeDialogAnchor_.focus();
|
| - this.activeDialogAnchor_ = null;
|
| - },
|
| + onAddressDialogClosed_: function() {
|
| + this.showAddressDialog_ = false;
|
| + this.activeDialogAnchor_.focus();
|
| + this.activeDialogAnchor_ = null;
|
| + },
|
|
|
| /**
|
| * Handles tapping on the "Edit" address button.
|
| * @param {!Event} e The polymer event.
|
| * @private
|
| */
|
| - onMenuEditAddressTap_: function(e) {
|
| - e.preventDefault();
|
| - this.showAddressDialog_ = true;
|
| - this.$.addressSharedMenu.close();
|
| - },
|
| + onMenuEditAddressTap_: function(e) {
|
| + e.preventDefault();
|
| + this.showAddressDialog_ = true;
|
| + this.$.addressSharedMenu.close();
|
| + },
|
|
|
| /** @private */
|
| - onRemoteEditAddressTap_: function() {
|
| - window.open(this.i18n('manageAddressesUrl'));
|
| - },
|
| + onRemoteEditAddressTap_: function() {
|
| + window.open(this.i18n('manageAddressesUrl'));
|
| + },
|
|
|
| /**
|
| * Handles tapping on the "Remove" address button.
|
| * @private
|
| */
|
| - onMenuRemoveAddressTap_: function() {
|
| - this.autofillManager_.removeAddress(
|
| + onMenuRemoveAddressTap_: function() {
|
| + this.autofillManager_.removeAddress(
|
| /** @type {string} */(this.activeAddress.guid));
|
| - this.$.addressSharedMenu.close();
|
| - },
|
| + this.$.addressSharedMenu.close();
|
| + },
|
|
|
| /**
|
| * Opens the credit card action menu.
|
| * @param {!Event} e The polymer event.
|
| * @private
|
| */
|
| - onCreditCardMenuTap_: function(e) {
|
| - var menuEvent = /** @type {!{model: !{item: !Object}}} */(e);
|
| + onCreditCardMenuTap_: function(e) {
|
| + var menuEvent = /** @type {!{model: !{item: !Object}}} */(e);
|
|
|
| /* TODO(scottchen): drop the [dataHost][dataHost] once this bug is fixed:
|
| https://github.com/Polymer/polymer/issues/2574 */
|
| - var item = menuEvent.model['dataHost']['dataHost'].item;
|
| + var item = menuEvent.model['dataHost']['dataHost'].item;
|
|
|
| // Copy item so dialog won't update model on cancel.
|
| - this.activeCreditCard =
|
| + this.activeCreditCard =
|
| /** @type {!chrome.autofillPrivate.CreditCardEntry} */(
|
| Object.assign({}, item));
|
|
|
| - var dotsButton = /** @type {!HTMLElement} */ (Polymer.dom(e).localTarget);
|
| - /** @type {!CrActionMenuElement} */ (
|
| + var dotsButton = /** @type {!HTMLElement} */ (Polymer.dom(e).localTarget);
|
| + /** @type {!CrActionMenuElement} */ (
|
| this.$.creditCardSharedMenu).showAt(dotsButton);
|
| - this.activeDialogAnchor_ = dotsButton;
|
| - },
|
| + this.activeDialogAnchor_ = dotsButton;
|
| + },
|
|
|
| /**
|
| * Handles tapping on the "Add credit card" button.
|
| * @param {!Event} e
|
| * @private
|
| */
|
| - onAddCreditCardTap_: function(e) {
|
| - e.preventDefault();
|
| - var date = new Date(); // Default to current month/year.
|
| - var expirationMonth = date.getMonth() + 1; // Months are 0 based.
|
| - this.activeCreditCard = {
|
| - expirationMonth: expirationMonth.toString(),
|
| - expirationYear: date.getFullYear().toString(),
|
| - };
|
| - this.showCreditCardDialog_ = true;
|
| - this.activeDialogAnchor_ = this.$.addCreditCard;
|
| - },
|
| + onAddCreditCardTap_: function(e) {
|
| + e.preventDefault();
|
| + var date = new Date(); // Default to current month/year.
|
| + var expirationMonth = date.getMonth() + 1; // Months are 0 based.
|
| + this.activeCreditCard = {
|
| + expirationMonth: expirationMonth.toString(),
|
| + expirationYear: date.getFullYear().toString(),
|
| + };
|
| + this.showCreditCardDialog_ = true;
|
| + this.activeDialogAnchor_ = this.$.addCreditCard;
|
| + },
|
|
|
| /** @private */
|
| - onCreditCardDialogClosed_: function() {
|
| - this.showCreditCardDialog_ = false;
|
| - this.activeDialogAnchor_.focus();
|
| - this.activeDialogAnchor_ = null;
|
| - },
|
| + onCreditCardDialogClosed_: function() {
|
| + this.showCreditCardDialog_ = false;
|
| + this.activeDialogAnchor_.focus();
|
| + this.activeDialogAnchor_ = null;
|
| + },
|
|
|
| /**
|
| * Handles tapping on the "Edit" credit card button.
|
| * @param {!Event} e The polymer event.
|
| * @private
|
| */
|
| - onMenuEditCreditCardTap_: function(e) {
|
| - e.preventDefault();
|
| - this.showCreditCardDialog_ = true;
|
| - this.$.creditCardSharedMenu.close();
|
| - },
|
| + onMenuEditCreditCardTap_: function(e) {
|
| + e.preventDefault();
|
| + this.showCreditCardDialog_ = true;
|
| + this.$.creditCardSharedMenu.close();
|
| + },
|
|
|
| /** @private */
|
| - onRemoteEditCreditCardTap_: function() {
|
| - window.open(this.i18n('manageCreditCardsUrl'));
|
| - },
|
| + onRemoteEditCreditCardTap_: function() {
|
| + window.open(this.i18n('manageCreditCardsUrl'));
|
| + },
|
|
|
| /**
|
| * Handles tapping on the "Remove" credit card button.
|
| * @private
|
| */
|
| - onMenuRemoveCreditCardTap_: function() {
|
| - this.autofillManager_.removeCreditCard(
|
| + onMenuRemoveCreditCardTap_: function() {
|
| + this.autofillManager_.removeCreditCard(
|
| /** @type {string} */(this.activeCreditCard.guid));
|
| - this.$.creditCardSharedMenu.close();
|
| - },
|
| + this.$.creditCardSharedMenu.close();
|
| + },
|
|
|
| /**
|
| * Handles tapping on the "Clear copy" button for cached credit cards.
|
| * @private
|
| */
|
| - onMenuClearCreditCardTap_: function() {
|
| - this.autofillManager_.clearCachedCreditCard(
|
| + onMenuClearCreditCardTap_: function() {
|
| + this.autofillManager_.clearCachedCreditCard(
|
| /** @type {string} */(this.activeCreditCard.guid));
|
| - this.$.creditCardSharedMenu.close();
|
| - },
|
| + this.$.creditCardSharedMenu.close();
|
| + },
|
|
|
| /**
|
| * Returns true if the list exists and has items.
|
| @@ -421,35 +421,35 @@ AutofillManagerImpl.prototype = {
|
| * @return {boolean}
|
| * @private
|
| */
|
| - hasSome_: function(list) {
|
| - return !!(list && list.length);
|
| - },
|
| + hasSome_: function(list) {
|
| + return !!(list && list.length);
|
| + },
|
|
|
| /**
|
| * Listens for the save-address event, and calls the private API.
|
| * @param {!Event} event
|
| * @private
|
| */
|
| - saveAddress_: function(event) {
|
| - this.autofillManager_.saveAddress(event.detail);
|
| - },
|
| + 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);
|
| - },
|
| + saveCreditCard_: function(event) {
|
| + this.autofillManager_.saveCreditCard(event.detail);
|
| + },
|
|
|
| /**
|
| * @private
|
| * @param {boolean} toggleValue
|
| * @return {string}
|
| */
|
| - getOnOffLabel_: function(toggleValue) {
|
| - return toggleValue ? this.i18n('toggleOn') : this.i18n('toggleOff');
|
| - }
|
| - });
|
| + getOnOffLabel_: function(toggleValue) {
|
| + return toggleValue ? this.i18n('toggleOn') : this.i18n('toggleOff');
|
| + }
|
| +});
|
| })();
|
|
|