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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 | 227 |
228 /** | 228 /** |
229 * Aggregates the values in the input fields into an array and sends the | 229 * Aggregates the values in the input fields into an array and sends the |
230 * array to the Autofill handler. | 230 * array to the Autofill handler. |
231 * @private | 231 * @private |
232 */ | 232 */ |
233 saveAddress_: function() { | 233 saveAddress_: function() { |
234 var inputFields = this.getInputFields_(); | 234 var inputFields = this.getInputFields_(); |
235 var address = [ | 235 var address = [ |
236 this.guid_, | 236 this.guid_, |
237 inputFields.fullName || [], | 237 inputFields['fullName'] || [], |
238 inputFields.companyName || '', | 238 inputFields['companyName'] || '', |
239 inputFields.addrLines || '', | 239 inputFields['addrLines'] || '', |
240 inputFields.dependentLocality || '', | 240 inputFields['dependentLocality'] || '', |
241 inputFields.city || '', | 241 inputFields['city'] || '', |
242 inputFields.state || '', | 242 inputFields['state'] || '', |
243 inputFields.postalCode || '', | 243 inputFields['postalCode'] || '', |
244 inputFields.sortingCode || '', | 244 inputFields['sortingCode'] || '', |
245 inputFields.country || '', | 245 inputFields['country'] || '', |
246 inputFields.phone || [], | 246 inputFields['phone'] || [], |
247 inputFields.email || [], | 247 inputFields['email'] || [], |
248 this.languageCode_, | 248 this.languageCode_, |
249 ]; | 249 ]; |
250 chrome.send('setAddress', address); | 250 chrome.send('setAddress', address); |
251 }, | 251 }, |
252 | 252 |
253 /** | 253 /** |
254 * Connects each input field to the inputFieldChanged_() method that enables | 254 * Connects each input field to the inputFieldChanged_() method that enables |
255 * or disables the 'Ok' button based on whether all the fields are empty or | 255 * or disables the 'Ok' button based on whether all the fields are empty or |
256 * not. | 256 * not. |
257 * @private | 257 * @private |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 AutofillEditAddressOverlay.getInstance().loadAddressComponents_(input); | 429 AutofillEditAddressOverlay.getInstance().loadAddressComponents_(input); |
430 }; | 430 }; |
431 | 431 |
432 AutofillEditAddressOverlay.setTitle = function(title) { | 432 AutofillEditAddressOverlay.setTitle = function(title) { |
433 $('autofill-address-title').textContent = title; | 433 $('autofill-address-title').textContent = title; |
434 }; | 434 }; |
435 | 435 |
436 AutofillEditAddressOverlay.setValidatedPhoneNumbers = function(numbers) { | 436 AutofillEditAddressOverlay.setValidatedPhoneNumbers = function(numbers) { |
437 var instance = AutofillEditAddressOverlay.getInstance(); | 437 var instance = AutofillEditAddressOverlay.getInstance(); |
438 var phoneList = instance.pageDiv.querySelector('[field=phone]'); | 438 var phoneList = instance.pageDiv.querySelector('[field=phone]'); |
439 instance.setMultiValueList_(phoneList, numbers); | 439 instance.setMultiValueList_(assertInstanceof(phoneList, cr.ui.List), |
| 440 numbers); |
440 phoneList.didReceiveValidationResult(); | 441 phoneList.didReceiveValidationResult(); |
441 }; | 442 }; |
442 | 443 |
443 // Export | 444 // Export |
444 return { | 445 return { |
445 AutofillEditAddressOverlay: AutofillEditAddressOverlay | 446 AutofillEditAddressOverlay: AutofillEditAddressOverlay |
446 }; | 447 }; |
447 }); | 448 }); |
OLD | NEW |