| Index: chrome/browser/dom_ui/options/autofill_options_handler.cc
|
| diff --git a/chrome/browser/dom_ui/options/autofill_options_handler.cc b/chrome/browser/dom_ui/options/autofill_options_handler.cc
|
| index 946f77c4b6a10d62343039809da11c5254146d3d..b72ecd00687592c0fab5dc97d5ad2272df7462bf 100644
|
| --- a/chrome/browser/dom_ui/options/autofill_options_handler.cc
|
| +++ b/chrome/browser/dom_ui/options/autofill_options_handler.cc
|
| @@ -11,8 +11,10 @@
|
| #include "base/string_number_conversions.h"
|
| #include "base/utf_string_conversions.h"
|
| #include "base/values.h"
|
| +#include "chrome/browser/autofill/autofill_country.h"
|
| #include "chrome/browser/autofill/autofill_profile.h"
|
| #include "chrome/browser/autofill/credit_card.h"
|
| +#include "chrome/browser/browser_process.h"
|
| #include "chrome/browser/dom_ui/web_ui_util.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "chrome/common/guid.h"
|
| @@ -46,6 +48,26 @@ int CreditCardTypeToResourceID(const string16& type16) {
|
| return 0;
|
| }
|
|
|
| +// Returns a dictionary that maps country codes to data for the country.
|
| +DictionaryValue* GetCountryData() {
|
| + std::vector<AutoFillCountry> countries;
|
| + AutoFillCountry::GetAvailableCountries(&countries);
|
| +
|
| + DictionaryValue* country_data = new DictionaryValue();
|
| + for (size_t i = 0; i < countries.size(); ++i) {
|
| + const AutoFillCountry& country = countries[i];
|
| +
|
| + DictionaryValue* details = new DictionaryValue();
|
| + details->SetString("name", country.name());
|
| + details->SetString("postalCodeLabel", country.postal_code_label());
|
| + details->SetString("stateLabel", country.state_label());
|
| +
|
| + country_data->Set(country.country_code(), details);
|
| + }
|
| +
|
| + return country_data;
|
| +}
|
| +
|
| } // namespace
|
|
|
| AutoFillOptionsHandler::AutoFillOptionsHandler()
|
| @@ -147,18 +169,23 @@ void AutoFillOptionsHandler::SetAddressOverlayStrings(
|
| l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_CITY));
|
| localized_strings->SetString("stateLabel",
|
| l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_STATE));
|
| - localized_strings->SetString("zipCodeLabel",
|
| + localized_strings->SetString("postalCodeLabel",
|
| l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_ZIP_CODE));
|
| localized_strings->SetString("countryLabel",
|
| l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_COUNTRY));
|
| - localized_strings->SetString("countryLabel",
|
| - l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_COUNTRY));
|
| localized_strings->SetString("phoneLabel",
|
| l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_PHONE));
|
| localized_strings->SetString("faxLabel",
|
| l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_FAX));
|
| localized_strings->SetString("emailLabel",
|
| l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_EMAIL));
|
| +
|
| + std::string app_locale = g_browser_process->GetApplicationLocale();
|
| + std::string default_country_code =
|
| + AutoFillCountry::CountryForLocale(app_locale).country_code();
|
| +
|
| + localized_strings->SetString("defaultCountryCode", default_country_code);
|
| + localized_strings->Set("autofillCountryData", GetCountryData());
|
| }
|
|
|
| void AutoFillOptionsHandler::SetCreditCardOverlayStrings(
|
| @@ -267,7 +294,7 @@ void AutoFillOptionsHandler::LoadAddressEditor(const ListValue* args) {
|
| profile->GetFieldText(AutoFillType(ADDRESS_HOME_CITY)));
|
| address->SetString("state",
|
| profile->GetFieldText(AutoFillType(ADDRESS_HOME_STATE)));
|
| - address->SetString("zipCode",
|
| + address->SetString("postalCode",
|
| profile->GetFieldText(AutoFillType(ADDRESS_HOME_ZIP)));
|
| address->SetString("country",
|
| profile->GetFieldText(AutoFillType(ADDRESS_HOME_COUNTRY)));
|
|
|