Chromium Code Reviews| 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 a932c48b5f2e4a97d54ac7f2f501f5f40e18565a..a21cc33b972e5f4ba09fc848eba497c443fb2538 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 |
| @@ -116,7 +116,7 @@ AutofillManager.prototype = { |
| */ |
| getAddressList: assertNotReached, |
| - /** @param {!AutofillManager.AddressEntry} address The address to remove. */ |
| + /** @param {string} guid The guid of the address to remove. */ |
| removeAddress: assertNotReached, |
| /** |
| @@ -137,12 +137,12 @@ AutofillManager.prototype = { |
| */ |
| getCreditCardList: assertNotReached, |
| - /** |
| - * @param {!AutofillManager.CreditCardEntry} creditCard The credit card to |
| - * remove. |
| - */ |
| + /** @param {string} guid The GUID of the credit card to remove. */ |
| removeCreditCard: assertNotReached, |
| + /** @param {string} guid The GUID to credit card to remove from the cache. */ |
| + clearCachedCreditCard: assertNotReached, |
| + |
| /** |
| * Saves the given credit card. |
| * @param {!AutofillManager.CreditCardEntry} creditCard |
| @@ -247,8 +247,11 @@ AutofillManagerImpl.prototype = { |
| }, |
| /** @override */ |
| - removeAddress: function(address) { |
| - chrome.autofillPrivate.removeEntry(/** @type {string} */(address.guid)); |
| + removeAddress: function(guid) { |
| + // GUID identifies an address: can't delete one if you don't know which |
|
tommycli
2016/06/27 22:31:28
The assert is pretty self explanatory. No need for
hcarmona
2016/06/27 22:42:13
👍
|
| + // address. |
| + assert(guid); |
| + chrome.autofillPrivate.removeEntry(guid); |
| }, |
| /** @override */ |
| @@ -267,8 +270,19 @@ AutofillManagerImpl.prototype = { |
| }, |
| /** @override */ |
| - removeCreditCard: function(creditCard) { |
| - chrome.autofillPrivate.removeEntry(/** @type {string} */(creditCard.guid)); |
| + removeCreditCard: function(guid) { |
| + // GUID identifies a credit card: can't delete one if you don't know which |
| + // credit card. |
| + assert(guid); |
| + chrome.autofillPrivate.removeEntry(guid); |
| + }, |
| + |
| + /** @override */ |
| + clearCachedCreditCard: function(guid) { |
| + // GUID identifies a credit card: can't clear cache if you don't know which |
| + // credit card. |
| + assert(guid); |
| + chrome.autofillPrivate.maskCreditCard(guid); |
| }, |
| /** @override */ |
| @@ -326,6 +340,7 @@ Polymer({ |
| }, |
| listeners: { |
| + 'clear-credit-card': 'clearCreditCard_', |
| 'remove-address': 'removeAddress_', |
| 'remove-credit-card': 'removeCreditCard_', |
| 'remove-password-exception': 'removePasswordException_', |
| @@ -422,7 +437,7 @@ Polymer({ |
| * @private |
| */ |
| removeAddress_: function(event) { |
| - this.autofillManager_.removeAddress(event.detail); |
| + this.autofillManager_.removeAddress(event.detail.guid); |
| }, |
| /** |
| @@ -431,7 +446,16 @@ Polymer({ |
| * @private |
| */ |
| removeCreditCard_: function(event) { |
| - this.autofillManager_.removeCreditCard(event.detail); |
| + 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); |
| }, |
| /** |