| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 cr.define('options.autofillOptions', function() { | 5 cr.define('options.autofillOptions', function() { |
| 6 /** @const */ var DeletableItem = options.DeletableItem; | 6 /** @const */ var DeletableItem = options.DeletableItem; |
| 7 /** @const */ var DeletableItemList = options.DeletableItemList; | 7 /** @const */ var DeletableItemList = options.DeletableItemList; |
| 8 /** @const */ var InlineEditableItem = options.InlineEditableItem; | 8 /** @const */ var InlineEditableItem = options.InlineEditableItem; |
| 9 /** @const */ var InlineEditableItemList = options.InlineEditableItemList; | 9 /** @const */ var InlineEditableItemList = options.InlineEditableItemList; |
| 10 | 10 |
| 11 /** |
| 12 * @return {!HTMLButtonElement} |
| 13 */ |
| 11 function AutofillEditProfileButton(guid, edit) { | 14 function AutofillEditProfileButton(guid, edit) { |
| 12 var editButtonEl = document.createElement('button'); | 15 var editButtonEl = document.createElement('button'); |
| 13 editButtonEl.className = 'list-inline-button custom-appearance'; | 16 editButtonEl.className = 'list-inline-button custom-appearance'; |
| 14 editButtonEl.textContent = | 17 editButtonEl.textContent = |
| 15 loadTimeData.getString('autofillEditProfileButton'); | 18 loadTimeData.getString('autofillEditProfileButton'); |
| 16 editButtonEl.onclick = function(e) { edit(guid); }; | 19 editButtonEl.onclick = function(e) { edit(guid); }; |
| 17 | 20 |
| 18 editButtonEl.onmousedown = function(e) { | 21 editButtonEl.onmousedown = function(e) { |
| 19 // Don't select the row when clicking the button. | 22 // Don't select the row when clicking the button. |
| 20 e.stopPropagation(); | 23 e.stopPropagation(); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 48 decorate: function() { | 51 decorate: function() { |
| 49 DeletableItem.prototype.decorate.call(this); | 52 DeletableItem.prototype.decorate.call(this); |
| 50 | 53 |
| 51 // The stored label. | 54 // The stored label. |
| 52 var label = this.ownerDocument.createElement('div'); | 55 var label = this.ownerDocument.createElement('div'); |
| 53 label.className = 'autofill-list-item'; | 56 label.className = 'autofill-list-item'; |
| 54 label.textContent = this.label; | 57 label.textContent = this.label; |
| 55 this.contentElement.appendChild(label); | 58 this.contentElement.appendChild(label); |
| 56 | 59 |
| 57 // The 'Edit' button. | 60 // The 'Edit' button. |
| 58 var editButtonEl = new AutofillEditProfileButton( | 61 var editButtonEl = AutofillEditProfileButton( |
| 59 this.guid, | 62 this.guid, |
| 60 AutofillOptions.loadAddressEditor); | 63 AutofillOptions.loadAddressEditor); |
| 61 this.contentElement.appendChild(editButtonEl); | 64 this.contentElement.appendChild(editButtonEl); |
| 62 }, | 65 }, |
| 63 }; | 66 }; |
| 64 | 67 |
| 65 /** | 68 /** |
| 66 * Creates a new credit card list item. | 69 * Creates a new credit card list item. |
| 67 * @param {Array} entry An array of the form [guid, label, icon]. | 70 * @param {Array} entry An array of the form [guid, label, icon]. |
| 68 * @constructor | 71 * @constructor |
| (...skipping 24 matching lines...) Expand all Loading... |
| 93 label.textContent = this.label; | 96 label.textContent = this.label; |
| 94 this.contentElement.appendChild(label); | 97 this.contentElement.appendChild(label); |
| 95 | 98 |
| 96 // The credit card icon. | 99 // The credit card icon. |
| 97 var icon = this.ownerDocument.createElement('img'); | 100 var icon = this.ownerDocument.createElement('img'); |
| 98 icon.src = this.icon; | 101 icon.src = this.icon; |
| 99 icon.alt = this.description; | 102 icon.alt = this.description; |
| 100 this.contentElement.appendChild(icon); | 103 this.contentElement.appendChild(icon); |
| 101 | 104 |
| 102 // The 'Edit' button. | 105 // The 'Edit' button. |
| 103 var editButtonEl = new AutofillEditProfileButton( | 106 var editButtonEl = AutofillEditProfileButton( |
| 104 this.guid, | 107 this.guid, |
| 105 AutofillOptions.loadCreditCardEditor); | 108 AutofillOptions.loadCreditCardEditor); |
| 106 this.contentElement.appendChild(editButtonEl); | 109 this.contentElement.appendChild(editButtonEl); |
| 107 }, | 110 }, |
| 108 }; | 111 }; |
| 109 | 112 |
| 110 /** | 113 /** |
| 111 * Creates a new value list item. | 114 * Creates a new value list item. |
| 112 * @param {AutofillValuesList} list The parent list of this item. | 115 * @param {AutofillValuesList} list The parent list of this item. |
| 113 * @param {string} entry A string value. | 116 * @param {string} entry A string value. |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 if (!this.isPlaceholder) | 215 if (!this.isPlaceholder) |
| 213 this.list.dataModel.splice(i, 1); | 216 this.list.dataModel.splice(i, 1); |
| 214 else | 217 else |
| 215 this.clearValue_(); | 218 this.clearValue_(); |
| 216 } | 219 } |
| 217 }, | 220 }, |
| 218 }; | 221 }; |
| 219 | 222 |
| 220 /** | 223 /** |
| 221 * Creates a new name value list item. | 224 * Creates a new name value list item. |
| 222 * @param {AutofillNameValuesList} list The parent list of this item. | 225 * @param {options.autofillOptions.AutofillNameValuesList} list The parent |
| 223 * @param {array} entry An array of [first, middle, last] names. | 226 * list of this item. |
| 227 * @param {Array.<string>} entry An array of [first, middle, last] names. |
| 224 * @constructor | 228 * @constructor |
| 225 * @extends {options.ValuesListItem} | 229 * @extends {options.ValuesListItem} |
| 226 */ | 230 */ |
| 227 function NameListItem(list, entry) { | 231 function NameListItem(list, entry) { |
| 228 var el = cr.doc.createElement('div'); | 232 var el = cr.doc.createElement('div'); |
| 229 el.list = list; | 233 el.list = list; |
| 230 el.first = entry ? entry[0] : ''; | 234 el.first = entry ? entry[0] : ''; |
| 231 el.middle = entry ? entry[1] : ''; | 235 el.middle = entry ? entry[1] : ''; |
| 232 el.last = entry ? entry[2] : ''; | 236 el.last = entry ? entry[2] : ''; |
| 233 el.__proto__ = NameListItem.prototype; | 237 el.__proto__ = NameListItem.prototype; |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 CreditCardListItem: CreditCardListItem, | 546 CreditCardListItem: CreditCardListItem, |
| 543 ValuesListItem: ValuesListItem, | 547 ValuesListItem: ValuesListItem, |
| 544 NameListItem: NameListItem, | 548 NameListItem: NameListItem, |
| 545 AutofillAddressList: AutofillAddressList, | 549 AutofillAddressList: AutofillAddressList, |
| 546 AutofillCreditCardList: AutofillCreditCardList, | 550 AutofillCreditCardList: AutofillCreditCardList, |
| 547 AutofillValuesList: AutofillValuesList, | 551 AutofillValuesList: AutofillValuesList, |
| 548 AutofillNameValuesList: AutofillNameValuesList, | 552 AutofillNameValuesList: AutofillNameValuesList, |
| 549 AutofillPhoneValuesList: AutofillPhoneValuesList, | 553 AutofillPhoneValuesList: AutofillPhoneValuesList, |
| 550 }; | 554 }; |
| 551 }); | 555 }); |
| OLD | NEW |