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

Unified Diff: chrome/browser/resources/options/autofill_options_list.js

Issue 996973003: Revamp Autofill Wallet settings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mac compiles Created 5 years, 9 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/options/autofill_options_list.js
diff --git a/chrome/browser/resources/options/autofill_options_list.js b/chrome/browser/resources/options/autofill_options_list.js
index 22897302c87961805261139d6ddf91dc48c607c3..493199cada09400cc8efdea3282dfa4639731545 100644
--- a/chrome/browser/resources/options/autofill_options_list.js
+++ b/chrome/browser/resources/options/autofill_options_list.js
@@ -11,13 +11,13 @@ cr.define('options.autofillOptions', function() {
/**
* @return {!HTMLButtonElement}
*/
- function AutofillEditProfileButton(guid, edit) {
+ function AutofillEditProfileButton(edit) {
var editButtonEl = /** @type {HTMLButtonElement} */(
document.createElement('button'));
editButtonEl.className = 'list-inline-button custom-appearance';
editButtonEl.textContent =
loadTimeData.getString('autofillEditProfileButton');
- editButtonEl.onclick = function(e) { edit(guid); };
+ editButtonEl.onclick = edit;
editButtonEl.onmousedown = function(e) {
// Don't select the row when clicking the button.
@@ -31,14 +31,15 @@ cr.define('options.autofillOptions', function() {
/**
* Creates a new address list item.
- * @param {Array} entry An array of the form [guid, label].
+ * @param {Object} entry An object with metadata about an address profile.
* @constructor
* @extends {options.DeletableItem}
*/
function AddressListItem(entry) {
var el = cr.doc.createElement('div');
- el.guid = entry[0];
- el.label = entry[1];
+ for (var key in entry) {
+ el[key] = entry[key];
+ }
el.__proto__ = AddressListItem.prototype;
el.decorate();
@@ -58,26 +59,28 @@ cr.define('options.autofillOptions', function() {
label.textContent = this.label;
this.contentElement.appendChild(label);
+ if (!this.isLocal)
+ this.deletable = false;
+
// The 'Edit' button.
+ var guid = this.guid;
var editButtonEl = AutofillEditProfileButton(
- this.guid,
- AutofillOptions.loadAddressEditor);
+ function() { AutofillOptions.loadAddressEditor(guid); });
this.contentElement.appendChild(editButtonEl);
},
};
/**
* Creates a new credit card list item.
- * @param {Array} entry An array of the form [guid, label, icon].
+ * @param {Object} entry An object with metadata about a credit card.
* @constructor
* @extends {options.DeletableItem}
*/
function CreditCardListItem(entry) {
var el = cr.doc.createElement('div');
- el.guid = entry[0];
- el.label = entry[1];
- el.icon = entry[2];
- el.description = entry[3];
+ for (var key in entry) {
+ el[key] = entry[key];
+ }
el.__proto__ = CreditCardListItem.prototype;
el.decorate();
@@ -97,16 +100,26 @@ cr.define('options.autofillOptions', function() {
label.textContent = this.label;
this.contentElement.appendChild(label);
- // The credit card icon.
- var icon = this.ownerDocument.createElement('img');
- icon.src = this.icon;
- icon.alt = this.description;
- this.contentElement.appendChild(icon);
+ if (!this.isLocal)
+ this.deletable = false;
+
+ var guid = this.guid;
+ if (this.isCached) {
+ var localCopyText = this.ownerDocument.createElement('span');
+ localCopyText.textContent =
+ loadTimeData.getString('autofillDescribeLocalCopy');
+ this.contentElement.appendChild(localCopyText);
+
+ var clearLocalCopyButton = AutofillEditProfileButton(
+ function() { chrome.send('clearLocalCardCopy', [guid]); });
+ clearLocalCopyButton.textContent =
+ loadTimeData.getString('autofillClearLocalCopyButton');
+ this.contentElement.appendChild(clearLocalCopyButton);
+ }
// The 'Edit' button.
var editButtonEl = AutofillEditProfileButton(
- this.guid,
- AutofillOptions.loadCreditCardEditor);
+ function() { AutofillOptions.loadCreditCardEditor(guid); });
this.contentElement.appendChild(editButtonEl);
},
};
@@ -362,7 +375,7 @@ cr.define('options.autofillOptions', function() {
/** @override */
activateItemAtIndex: function(index) {
- AutofillOptions.loadAddressEditor(this.dataModel.item(index)[0]);
+ AutofillOptions.loadAddressEditor(this.dataModel.item(index));
},
/**
@@ -375,7 +388,7 @@ cr.define('options.autofillOptions', function() {
/** @override */
deleteItemAtIndex: function(index) {
- AutofillOptions.removeData(this.dataModel.item(index)[0],
+ AutofillOptions.removeData(this.dataModel.item(index).guid,
'Options_AutofillAddressDeleted');
},
};
@@ -396,7 +409,7 @@ cr.define('options.autofillOptions', function() {
/** @override */
activateItemAtIndex: function(index) {
- AutofillOptions.loadCreditCardEditor(this.dataModel.item(index)[0]);
+ AutofillOptions.loadCreditCardEditor(this.dataModel.item(index));
},
/**
@@ -409,7 +422,7 @@ cr.define('options.autofillOptions', function() {
/** @override */
deleteItemAtIndex: function(index) {
- AutofillOptions.removeData(this.dataModel.item(index)[0],
+ AutofillOptions.removeData(this.dataModel.item(index).guid,
'Options_AutofillCreditCardDeleted');
},
};
« no previous file with comments | « chrome/browser/resources/options/autofill_options.js ('k') | chrome/browser/ui/webui/options/autofill_options_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698