| OLD | NEW |
| 1 // Copyright (c) 2011 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 DeletableItem = options.DeletableItem; | 6 const DeletableItem = options.DeletableItem; |
| 7 const DeletableItemList = options.DeletableItemList; | 7 const DeletableItemList = options.DeletableItemList; |
| 8 const InlineEditableItem = options.InlineEditableItem; | 8 const InlineEditableItem = options.InlineEditableItem; |
| 9 const InlineEditableItemList = options.InlineEditableItemList; | 9 const InlineEditableItemList = options.InlineEditableItemList; |
| 10 | 10 |
| 11 function AutofillEditProfileButton(guid, edit) { | 11 function AutofillEditProfileButton(guid, edit) { |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 | 139 |
| 140 if (this.isPlaceholder) { | 140 if (this.isPlaceholder) { |
| 141 this.input.placeholder = this.list.getAttribute('placeholder'); | 141 this.input.placeholder = this.list.getAttribute('placeholder'); |
| 142 this.deletable = false; | 142 this.deletable = false; |
| 143 } | 143 } |
| 144 | 144 |
| 145 this.addEventListener('commitedit', this.onEditCommitted_); | 145 this.addEventListener('commitedit', this.onEditCommitted_); |
| 146 }, | 146 }, |
| 147 | 147 |
| 148 /** | 148 /** |
| 149 * @return This item's value. | 149 * @return {string} This item's value. |
| 150 * @protected | 150 * @protected |
| 151 */ | 151 */ |
| 152 value_: function() { | 152 value_: function() { |
| 153 return this.input.value; | 153 return this.input.value; |
| 154 }, | 154 }, |
| 155 | 155 |
| 156 /** | 156 /** |
| 157 * @param {Object} value The value to test. | 157 * @param {Object} value The value to test. |
| 158 * @return true if the given value is non-empty. | 158 * @return {boolean} True if the given value is non-empty. |
| 159 * @protected | 159 * @protected |
| 160 */ | 160 */ |
| 161 valueIsNonEmpty_: function(value) { | 161 valueIsNonEmpty_: function(value) { |
| 162 return !!value; | 162 return !!value; |
| 163 }, | 163 }, |
| 164 | 164 |
| 165 /** | 165 /** |
| 166 * @return true if value1 is logically equal to value2. | 166 * @return {boolean} True if value1 is logically equal to value2. |
| 167 */ | 167 */ |
| 168 valuesAreEqual_: function(value1, value2) { | 168 valuesAreEqual_: function(value1, value2) { |
| 169 return value1 === value2; | 169 return value1 === value2; |
| 170 }, | 170 }, |
| 171 | 171 |
| 172 /** | 172 /** |
| 173 * Clears the item's value. | 173 * Clears the item's value. |
| 174 * @protected | 174 * @protected |
| 175 */ | 175 */ |
| 176 clearValue_: function() { | 176 clearValue_: function() { |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 this.lastNameInput.placeholder = | 268 this.lastNameInput.placeholder = |
| 269 templateData.autofillAddLastNamePlaceholder; | 269 templateData.autofillAddLastNamePlaceholder; |
| 270 this.deletable = false; | 270 this.deletable = false; |
| 271 } | 271 } |
| 272 | 272 |
| 273 this.addEventListener('commitedit', this.onEditCommitted_); | 273 this.addEventListener('commitedit', this.onEditCommitted_); |
| 274 }, | 274 }, |
| 275 | 275 |
| 276 /** @inheritDoc */ | 276 /** @inheritDoc */ |
| 277 value_: function() { | 277 value_: function() { |
| 278 return [ this.firstNameInput.value, | 278 return [this.firstNameInput.value, |
| 279 this.middleNameInput.value, | 279 this.middleNameInput.value, |
| 280 this.lastNameInput.value ]; | 280 this.lastNameInput.value]; |
| 281 }, | 281 }, |
| 282 | 282 |
| 283 /** @inheritDoc */ | 283 /** @inheritDoc */ |
| 284 valueIsNonEmpty_: function(value) { | 284 valueIsNonEmpty_: function(value) { |
| 285 return value[0] || value[1] || value[2]; | 285 return value[0] || value[1] || value[2]; |
| 286 }, | 286 }, |
| 287 | 287 |
| 288 /** @inheritDoc */ | 288 /** @inheritDoc */ |
| 289 valuesAreEqual_: function(value1, value2) { | 289 valuesAreEqual_: function(value1, value2) { |
| 290 // First, check for null values. | 290 // First, check for null values. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 307 /** | 307 /** |
| 308 * Base class for shared implementation between address and credit card lists. | 308 * Base class for shared implementation between address and credit card lists. |
| 309 * @constructor | 309 * @constructor |
| 310 * @extends {options.DeletableItemList} | 310 * @extends {options.DeletableItemList} |
| 311 */ | 311 */ |
| 312 var AutofillProfileList = cr.ui.define('list'); | 312 var AutofillProfileList = cr.ui.define('list'); |
| 313 | 313 |
| 314 AutofillProfileList.prototype = { | 314 AutofillProfileList.prototype = { |
| 315 __proto__: DeletableItemList.prototype, | 315 __proto__: DeletableItemList.prototype, |
| 316 | 316 |
| 317 decorate: function() { | 317 decorate: function() { |
| 318 DeletableItemList.prototype.decorate.call(this); | 318 DeletableItemList.prototype.decorate.call(this); |
| 319 | 319 |
| 320 this.addEventListener('blur', this.onBlur_); | 320 this.addEventListener('blur', this.onBlur_); |
| 321 }, | 321 }, |
| 322 | 322 |
| 323 /** | 323 /** |
| 324 * When the list loses focus, unselect all items in the list. | 324 * When the list loses focus, unselect all items in the list. |
| 325 * @private | 325 * @private |
| 326 */ | 326 */ |
| 327 onBlur_: function() { | 327 onBlur_: function() { |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 CreditCardListItem: CreditCardListItem, | 497 CreditCardListItem: CreditCardListItem, |
| 498 ValuesListItem: ValuesListItem, | 498 ValuesListItem: ValuesListItem, |
| 499 NameListItem: NameListItem, | 499 NameListItem: NameListItem, |
| 500 AutofillAddressList: AutofillAddressList, | 500 AutofillAddressList: AutofillAddressList, |
| 501 AutofillCreditCardList: AutofillCreditCardList, | 501 AutofillCreditCardList: AutofillCreditCardList, |
| 502 AutofillValuesList: AutofillValuesList, | 502 AutofillValuesList: AutofillValuesList, |
| 503 AutofillNameValuesList: AutofillNameValuesList, | 503 AutofillNameValuesList: AutofillNameValuesList, |
| 504 AutofillPhoneValuesList: AutofillPhoneValuesList, | 504 AutofillPhoneValuesList: AutofillPhoneValuesList, |
| 505 }; | 505 }; |
| 506 }); | 506 }); |
| OLD | NEW |