OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 * @extends {options.ValuesListItem} | 167 * @extends {options.ValuesListItem} |
168 * @private | 168 * @private |
169 */ | 169 */ |
170 onEditCommitted_: function(e) { | 170 onEditCommitted_: function(e) { |
171 var i = this.list.items.indexOf(this); | 171 var i = this.list.items.indexOf(this); |
172 if (i < 0 || i >= this.list.dataModel.length) | 172 if (i < 0 || i >= this.list.dataModel.length) |
173 return; | 173 return; |
174 | 174 |
175 if (this.input.value && | 175 if (this.input.value && |
176 this.list.dataModel.indexOf(this.input.value) == -1) { | 176 this.list.dataModel.indexOf(this.input.value) == -1) { |
| 177 // It is important that updateIndex is done before validateAndSave. |
| 178 // Otherwise we can not be sure about AddRow index. |
| 179 this.list.dataModel.updateIndex(i); |
177 this.list.validateAndSave(i, 0, this.input.value); | 180 this.list.validateAndSave(i, 0, this.input.value); |
178 } else { | 181 } else { |
179 this.input.value = ''; | 182 this.input.value = ''; |
180 this.list.dataModel.updateIndex(i); | 183 this.list.dataModel.updateIndex(i); |
181 } | 184 } |
182 }, | 185 }, |
183 }; | 186 }; |
184 | 187 |
185 /** | 188 /** |
186 * Create a new address list. | 189 * Create a new address list. |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 CreditCardListItem: CreditCardListItem, | 376 CreditCardListItem: CreditCardListItem, |
374 ValuesListItem: ValuesListItem, | 377 ValuesListItem: ValuesListItem, |
375 ValuesAddRowListItem: ValuesAddRowListItem, | 378 ValuesAddRowListItem: ValuesAddRowListItem, |
376 AutofillAddressList: AutofillAddressList, | 379 AutofillAddressList: AutofillAddressList, |
377 AutofillCreditCardList: AutofillCreditCardList, | 380 AutofillCreditCardList: AutofillCreditCardList, |
378 AutofillValuesList: AutofillValuesList, | 381 AutofillValuesList: AutofillValuesList, |
379 AutofillPhoneValuesList: AutofillPhoneValuesList, | 382 AutofillPhoneValuesList: AutofillPhoneValuesList, |
380 AutofillFaxValuesList: AutofillFaxValuesList, | 383 AutofillFaxValuesList: AutofillFaxValuesList, |
381 }; | 384 }; |
382 }); | 385 }); |
OLD | NEW |