Commit f538ae59 authored by estade's avatar estade Committed by Commit bot

Autofill settings - Fix editing of local addresses and credit cards.

BUG=469868

Review URL: https://codereview.chromium.org/1027393002

Cr-Commit-Position: refs/heads/master@{#322095}
parent 29d88220
......@@ -174,34 +174,6 @@ cr.define('options', function() {
chrome.send('coreOptionsUserMetricsAction', [metricsAction]);
},
/**
* For local Autofill data, this function causes the AutofillOptionsHandler
* to call showEditAddressOverlay(). For Wallet data, the user is
* redirected to the Wallet web interface.
* @param {Object} entry The relevant entry in data model.
* @private
*/
loadAddressEditor_: function(entry) {
if (entry.isLocal)
chrome.send('loadAddressEditor', [entry.guid]);
else
window.open(loadTimeData.getString('manageWalletAddressesUrl'));
},
/**
* For local Autofill data, this function causes the AutofillOptionsHandler
* to call showEditCreditCardOverlay(). For Wallet data, the user is
* redirected to the Wallet web interface.
* @param {Object} entry The relevant entry in data model.
* @private
*/
loadCreditCardEditor_: function(entry) {
if (entry.isLocal)
chrome.send('loadCreditCardEditor', [entry.guid]);
else
window.open(loadTimeData.getString('manageWalletPaymentMethodsUrl'));
},
/**
* Shows the 'Edit address' overlay, using the data in |address| to fill the
* input fields. |address| is a list with one item, an associative array
......@@ -252,14 +224,6 @@ cr.define('options', function() {
AutofillOptions.getInstance().removeData_(guid, metricsAction);
};
AutofillOptions.loadAddressEditor = function(entry) {
AutofillOptions.getInstance().loadAddressEditor_(entry);
};
AutofillOptions.loadCreditCardEditor = function(entry) {
AutofillOptions.getInstance().loadCreditCardEditor_(entry);
};
AutofillOptions.editAddress = function(address) {
AutofillOptions.getInstance().showEditAddressOverlay_(address);
};
......
......@@ -90,11 +90,23 @@ cr.define('options.autofillOptions', function() {
}
// The 'Edit' button.
var guid = this.metadata_.guid;
var metadata = this.metadata_;
var editButtonEl = AutofillEditProfileButton(
function() { AutofillOptions.loadAddressEditor(guid); });
AddressListItem.prototype.loadAddressEditor.bind(this));
this.contentElement.appendChild(editButtonEl);
},
/**
* For local Autofill data, this function causes the AutofillOptionsHandler
* to call showEditAddressOverlay(). For Wallet data, the user is
* redirected to the Wallet web interface.
*/
loadAddressEditor: function() {
if (this.metadata_.isLocal)
chrome.send('loadAddressEditor', [this.metadata_.guid]);
else
window.open(loadTimeData.getString('manageWalletAddressesUrl'));
},
};
/**
......@@ -151,10 +163,23 @@ cr.define('options.autofillOptions', function() {
}
// The 'Edit' button.
var metadata = this.metadata_;
var editButtonEl = AutofillEditProfileButton(
function() { AutofillOptions.loadCreditCardEditor(guid); });
CreditCardListItem.prototype.loadCreditCardEditor.bind(this));
this.contentElement.appendChild(editButtonEl);
},
/**
* For local Autofill data, this function causes the AutofillOptionsHandler
* to call showEditCreditCardOverlay(). For Wallet data, the user is
* redirected to the Wallet web interface.
*/
loadCreditCardEditor: function() {
if (this.metadata_.isLocal)
chrome.send('loadCreditCardEditor', [this.metadata_.guid]);
else
window.open(loadTimeData.getString('manageWalletPaymentMethodsUrl'));
},
};
/**
......@@ -408,7 +433,7 @@ cr.define('options.autofillOptions', function() {
/** @override */
activateItemAtIndex: function(index) {
AutofillOptions.loadAddressEditor(this.dataModel.item(index));
this.getListItemByIndex(index).loadAddressEditor();
},
/**
......@@ -442,7 +467,7 @@ cr.define('options.autofillOptions', function() {
/** @override */
activateItemAtIndex: function(index) {
AutofillOptions.loadCreditCardEditor(this.dataModel.item(index));
this.getListItemByIndex(index).loadCreditCardEditor();
},
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment