Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2534)

Unified Diff: chrome/browser/resources/settings/passwords_and_forms_page/autofill_section.js

Issue 2015463003: Add dialog to edit and save credit cards. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 845d87f7ed077b7ad25fffd257d2ec5743854423..4d3b0f5d9bd953f3cf909aae987316c7d2ff6b03 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
@@ -17,17 +17,13 @@
* An array of saved addresses.
* @type {!Array<!chrome.autofillPrivate.AddressEntry>}
*/
- addresses: {
- type: Array,
- },
+ addresses: Array,
/**
* An array of saved addresses.
* @type {!Array<!chrome.autofillPrivate.CreditCardEntry>}
*/
- creditCards: {
- type: Array,
- },
+ creditCards: Array,
},
listeners: {
@@ -39,7 +35,7 @@
/**
* Formats an AddressEntry so it's displayed as an address.
* @param {!chrome.autofillPrivate.AddressEntry} item
- * @return {!string}
+ * @return {string}
*/
address_: function(item) {
return item.metadata.summaryLabel + item.metadata.summarySublabel;
@@ -48,7 +44,7 @@
/**
* Formats the expiration date so it's displayed as MM/YYYY.
* @param {!chrome.autofillPrivate.CreditCardEntry} item
- * @return {!string}
+ * @return {string}
*/
expiration_: function(item) {
return item.expirationMonth + '/' + item.expirationYear;
@@ -122,7 +118,13 @@
* @private
*/
onAddCreditCardTap_: function(e) {
- // TODO(hcarmona): implement adding a credit card.
+ var date = new Date(); // Default to current month/year.
+ var expirationMonth = date.getMonth() + 1; // Months are 0 based.
+ // Pass in a new object to edit.
+ this.$.editCreditCardDialog.open({
+ expirationMonth: expirationMonth.toString(),
+ expirationYear: date.getFullYear().toString(),
+ });
e.preventDefault();
},
@@ -131,8 +133,10 @@
* @private
*/
onMenuEditCreditCardTap_: function() {
- // TODO(hcarmona): implement editing a credit card.
- this.$.creditCardSharedMenu.closeMenu();
+ var menu = this.$.creditCardSharedMenu;
+ this.$.editCreditCardDialog.open(
+ /** @type {chrome.autofillPrivate.CreditCardEntry} */(menu.itemData));
+ menu.closeMenu();
},
/**

Powered by Google App Engine
This is Rietveld 408576698