Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1077)

Unified Diff: chrome/browser/resources/options/autofill_edit_address_overlay.js

Issue 12328091: set a default country in the autofill dialog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ilya review 2 Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/autofill/autofill_dialog_controller_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/options/autofill_edit_address_overlay.js
diff --git a/chrome/browser/resources/options/autofill_edit_address_overlay.js b/chrome/browser/resources/options/autofill_edit_address_overlay.js
index b239e99911a97b2b5431486d2945a4a0682a72ed..e2fab6a3499729c3bf9b42a43fbb8d845b209de9 100644
--- a/chrome/browser/resources/options/autofill_edit_address_overlay.js
+++ b/chrome/browser/resources/options/autofill_edit_address_overlay.js
@@ -207,47 +207,17 @@ cr.define('options', function() {
* @private
*/
populateCountryList_: function() {
- var countryData = loadTimeData.getValue('autofillCountryData');
- var defaultCountryCode = loadTimeData.getString('defaultCountryCode');
-
- // Build an array of the country names and their corresponding country
- // codes, so that we can sort and insert them in order.
- var countries = [];
- for (var countryCode in countryData) {
- var country = {
- countryCode: countryCode,
- name: countryData[countryCode].name
- };
- countries.push(country);
- }
-
- // Sort the countries in alphabetical order by name.
- countries = countries.sort(function(a, b) {
- return a.name < b.name ? -1 : 1;
- });
-
- // Insert the empty and default countries at the beginning of the array.
- var emptyCountry = {
- countryCode: '',
- name: ''
- };
- var defaultCountry = {
- countryCode: defaultCountryCode,
- name: countryData[defaultCountryCode].name
- };
- var separator = {
- countryCode: '',
- name: '---',
- disabled: true
- };
- countries.unshift(emptyCountry, defaultCountry, separator);
+ var countryList = loadTimeData.getValue('autofillCountrySelectList');
// Add the countries to the country <select> list.
- var countryList = $('country');
- for (var i = 0; i < countries.length; i++) {
- var country = new Option(countries[i].name, countries[i].countryCode);
- country.disabled = countries[i].disabled;
- countryList.appendChild(country);
+ var countrySelect = $('country');
+ // Add an empty option.
+ countrySelect.appendChild(new Option('', ''));
+ for (var i = 0; i < countryList.length; i++) {
+ var option = new Option(countryList[i].name,
+ countryList[i].value);
+ option.disabled = countryList[i].value == 'separator';
+ countrySelect.appendChild(option);
}
},
« no previous file with comments | « no previous file | chrome/browser/ui/autofill/autofill_dialog_controller_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698