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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
320 var option = new Option(countryList[i].name, | 320 var option = new Option(countryList[i].name, |
321 countryList[i].value); | 321 countryList[i].value); |
322 option.disabled = countryList[i].value == 'separator'; | 322 option.disabled = countryList[i].value == 'separator'; |
323 countrySelect.appendChild(option); | 323 countrySelect.appendChild(option); |
324 } | 324 } |
325 }, | 325 }, |
326 | 326 |
327 /** | 327 /** |
328 * Loads the address data from |address|, sets the input fields based on | 328 * Loads the address data from |address|, sets the input fields based on |
329 * this data, and stores the GUID and language code of the address. | 329 * this data, and stores the GUID and language code of the address. |
330 * @param {!Object} address Lots of info about an address from the browser. | 330 * @param {Object} address Lots of info about an address from the browser. |
331 * @private | 331 * @private |
332 */ | 332 */ |
333 loadAddress_: function(address) { | 333 loadAddress_: function(address) { |
334 if (!address) { | |
arv (Not doing code reviews)
2014/09/02 17:01:04
A better solution would be to have another functio
Evan Stade
2014/09/02 18:41:17
Done.
| |
335 // Adding a new address --- focus the first element. | |
336 this.pageDiv.querySelector('input').focus(); | |
337 return; | |
338 } | |
339 | |
334 this.rebuildInputFields_(address.components); | 340 this.rebuildInputFields_(address.components); |
335 this.setInputFields_(address); | 341 this.setInputFields_(address); |
336 this.inputFieldChanged_(); | 342 this.inputFieldChanged_(); |
337 this.connectInputEvents_(); | 343 this.connectInputEvents_(); |
338 this.guid_ = address.guid; | 344 this.guid_ = address.guid; |
339 this.languageCode_ = address.languageCode; | 345 this.languageCode_ = address.languageCode; |
340 }, | 346 }, |
341 | 347 |
342 /** | 348 /** |
343 * Takes a snapshot of the input values, clears the input values, loads the | 349 * Takes a snapshot of the input values, clears the input values, loads the |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
424 var phoneList = instance.pageDiv.querySelector('[field=phone]'); | 430 var phoneList = instance.pageDiv.querySelector('[field=phone]'); |
425 instance.setMultiValueList_(phoneList, numbers); | 431 instance.setMultiValueList_(phoneList, numbers); |
426 phoneList.didReceiveValidationResult(); | 432 phoneList.didReceiveValidationResult(); |
427 }; | 433 }; |
428 | 434 |
429 // Export | 435 // Export |
430 return { | 436 return { |
431 AutofillEditAddressOverlay: AutofillEditAddressOverlay | 437 AutofillEditAddressOverlay: AutofillEditAddressOverlay |
432 }; | 438 }; |
433 }); | 439 }); |
OLD | NEW |