| Index: chrome/browser/ui/webui/options/autofill_options_handler.cc
|
| diff --git a/chrome/browser/ui/webui/options/autofill_options_handler.cc b/chrome/browser/ui/webui/options/autofill_options_handler.cc
|
| index 75087f672bce7a807592d1d0ab271021170f68e3..7df8838a425a8e18c3c7180f21fb046b265e05ea 100644
|
| --- a/chrome/browser/ui/webui/options/autofill_options_handler.cc
|
| +++ b/chrome/browser/ui/webui/options/autofill_options_handler.cc
|
| @@ -28,9 +28,10 @@
|
| #include "content/public/browser/web_ui.h"
|
| #include "grit/components_strings.h"
|
| #include "grit/generated_resources.h"
|
| -#include "grit/libaddressinput_strings.h"
|
| -#include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/address_ui.h"
|
| -#include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/address_ui_component.h"
|
| +#include "grit/libaddressinput/messages.h"
|
| +#include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_ui.h"
|
| +#include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_ui_component.h"
|
| +#include "third_party/libaddressinput/src/cpp/include/libaddressinput/localization.h"
|
| #include "ui/base/l10n/l10n_util.h"
|
| #include "ui/base/webui/web_ui_util.h"
|
|
|
| @@ -68,14 +69,17 @@ void GetAddressComponents(const std::string& country_code,
|
| base::ListValue* address_components,
|
| std::string* components_language_code) {
|
| DCHECK(address_components);
|
| + DCHECK(components_language_code);
|
|
|
| + i18n::addressinput::Localization localization;
|
| + localization.SetGetter(l10n_util::GetStringUTF8, ui_language_code);
|
| std::vector<AddressUiComponent> components =
|
| i18n::addressinput::BuildComponents(
|
| - country_code, ui_language_code, components_language_code);
|
| + country_code, localization, components_language_code);
|
| if (components.empty()) {
|
| static const char kDefaultCountryCode[] = "US";
|
| components = i18n::addressinput::BuildComponents(
|
| - kDefaultCountryCode, ui_language_code, components_language_code);
|
| + kDefaultCountryCode, localization, components_language_code);
|
| }
|
| DCHECK(!components.empty());
|
|
|
| @@ -91,8 +95,7 @@ void GetAddressComponents(const std::string& country_code,
|
| }
|
|
|
| scoped_ptr<base::DictionaryValue> component(new base::DictionaryValue);
|
| - component->SetString(
|
| - "name", l10n_util::GetStringUTF16(components[i].name_id));
|
| + component->SetString("name", components[i].name);
|
|
|
| switch (components[i].field) {
|
| case i18n::addressinput::COUNTRY:
|
| @@ -116,9 +119,6 @@ void GetAddressComponents(const std::string& country_code,
|
| case i18n::addressinput::STREET_ADDRESS:
|
| component->SetString(kField, kAddressLineField);
|
| break;
|
| - case i18n::addressinput::ORGANIZATION:
|
| - component->SetString(kField, kCompanyNameField);
|
| - break;
|
| case i18n::addressinput::RECIPIENT:
|
| component->SetString(kField, kFullNameField);
|
| component->SetString(
|
| @@ -373,7 +373,7 @@ void AutofillOptionsHandler::SetAddressOverlayStrings(
|
| localized_strings->SetString("autofillEditAddressTitle",
|
| l10n_util::GetStringUTF16(IDS_AUTOFILL_EDIT_ADDRESS_CAPTION));
|
| localized_strings->SetString("autofillCountryLabel",
|
| - l10n_util::GetStringUTF16(IDS_LIBADDRESSINPUT_I18N_COUNTRY_LABEL));
|
| + l10n_util::GetStringUTF16(IDS_LIBADDRESSINPUT_COUNTRY_OR_REGION_LABEL));
|
| localized_strings->SetString("autofillPhoneLabel",
|
| l10n_util::GetStringUTF16(IDS_AUTOFILL_FIELD_LABEL_PHONE));
|
| localized_strings->SetString("autofillEmailLabel",
|
| @@ -497,9 +497,10 @@ void AutofillOptionsHandler::LoadAddressEditor(const base::ListValue* args) {
|
| address.SetString(kLanguageCode, profile->language_code());
|
|
|
| scoped_ptr<base::ListValue> components(new base::ListValue);
|
| + std::string best_address_language;
|
| GetAddressComponents(
|
| base::UTF16ToUTF8(profile->GetRawInfo(autofill::ADDRESS_HOME_COUNTRY)),
|
| - profile->language_code(), components.get(), NULL);
|
| + profile->language_code(), components.get(), &best_address_language);
|
| address.Set(kComponents, components.release());
|
|
|
| web_ui()->CallJavascriptFunction("AutofillOptions.editAddress", address);
|
|
|