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', function() { | 5 cr.define('options', function() { |
6 /** @const */ var Page = cr.ui.pageManager.Page; | 6 /** @const */ var Page = cr.ui.pageManager.Page; |
7 /** @const */ var PageManager = cr.ui.pageManager.PageManager; | 7 /** @const */ var PageManager = cr.ui.pageManager.PageManager; |
8 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; | 8 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; |
9 | 9 |
10 /** | 10 /** |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 this.inputFieldChanged_(); | 353 this.inputFieldChanged_(); |
354 this.connectInputEvents_(); | 354 this.connectInputEvents_(); |
355 this.guid_ = address.guid; | 355 this.guid_ = address.guid; |
356 this.languageCode_ = address.languageCode; | 356 this.languageCode_ = address.languageCode; |
357 }, | 357 }, |
358 | 358 |
359 /** | 359 /** |
360 * Takes a snapshot of the input values, clears the input values, loads the | 360 * Takes a snapshot of the input values, clears the input values, loads the |
361 * address input layout from |input.components|, restores the input values | 361 * address input layout from |input.components|, restores the input values |
362 * from snapshot, and stores the |input.languageCode| for the address. | 362 * from snapshot, and stores the |input.languageCode| for the address. |
363 * @param {{languageCode: string, components: Array.<Array.<Object>>}} input | 363 * @param {{languageCode: string, components: Array<Array<Object>>}} input |
364 * Info about how to layout inputs fields in this dialog. | 364 * Info about how to layout inputs fields in this dialog. |
365 * @private | 365 * @private |
366 */ | 366 */ |
367 loadAddressComponents_: function(input) { | 367 loadAddressComponents_: function(input) { |
368 var inputFields = this.getInputFields_(); | 368 var inputFields = this.getInputFields_(); |
369 for (var fieldName in inputFields) { | 369 for (var fieldName in inputFields) { |
370 if (inputFields.hasOwnProperty(fieldName)) | 370 if (inputFields.hasOwnProperty(fieldName)) |
371 this.savedFieldValues_[fieldName] = inputFields[fieldName]; | 371 this.savedFieldValues_[fieldName] = inputFields[fieldName]; |
372 } | 372 } |
373 this.rebuildInputFields_(input.components); | 373 this.rebuildInputFields_(input.components); |
374 this.setInputFields_(this.savedFieldValues_); | 374 this.setInputFields_(this.savedFieldValues_); |
375 this.inputFieldChanged_(); | 375 this.inputFieldChanged_(); |
376 this.connectInputEvents_(); | 376 this.connectInputEvents_(); |
377 this.languageCode_ = input.languageCode; | 377 this.languageCode_ = input.languageCode; |
378 }, | 378 }, |
379 | 379 |
380 /** | 380 /** |
381 * Clears address inputs and rebuilds the input fields according to | 381 * Clears address inputs and rebuilds the input fields according to |
382 * |components|. | 382 * |components|. |
383 * @param {Array.<Array.<Object>>} components A list of information about | 383 * @param {Array<Array<Object>>} components A list of information about |
384 * each input field. | 384 * each input field. |
385 * @private | 385 * @private |
386 */ | 386 */ |
387 rebuildInputFields_: function(components) { | 387 rebuildInputFields_: function(components) { |
388 var content = $('autofill-edit-address-fields'); | 388 var content = $('autofill-edit-address-fields'); |
389 content.innerHTML = ''; | 389 content.innerHTML = ''; |
390 | 390 |
391 var customContainerElements = {fullName: 'div'}; | 391 var customContainerElements = {fullName: 'div'}; |
392 var customInputElements = {fullName: 'list', addrLines: 'textarea'}; | 392 var customInputElements = {fullName: 'list', addrLines: 'textarea'}; |
393 | 393 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 instance.setMultiValueList_(assertInstanceof(phoneList, cr.ui.List), | 446 instance.setMultiValueList_(assertInstanceof(phoneList, cr.ui.List), |
447 numbers); | 447 numbers); |
448 phoneList.didReceiveValidationResult(); | 448 phoneList.didReceiveValidationResult(); |
449 }; | 449 }; |
450 | 450 |
451 // Export | 451 // Export |
452 return { | 452 return { |
453 AutofillEditAddressOverlay: AutofillEditAddressOverlay | 453 AutofillEditAddressOverlay: AutofillEditAddressOverlay |
454 }; | 454 }; |
455 }); | 455 }); |
OLD | NEW |