| Index: chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
|
| diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
|
| index 188f72c2ed56d1f8e52fccd8a70cb138e15ff676..63e321343b490dae79571987225b6ea2e7bbee07 100644
|
| --- a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
|
| +++ b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
|
| @@ -697,7 +697,9 @@ void AutofillDialogControllerImpl::Show() {
|
| country_code = model->GetDefaultCountryCode();
|
|
|
| DetailInputs* inputs = MutableRequestedFieldsForSection(section);
|
| - common::BuildInputsForSection(section, country_code, inputs);
|
| + common::BuildInputsForSection(
|
| + section, country_code, inputs,
|
| + MutableAddressLanguageCodeForSection(section));
|
| }
|
|
|
| // Test whether we need to show the shipping section. If filling that section
|
| @@ -1851,6 +1853,7 @@ ValidityMessages AutofillDialogControllerImpl::InputsAreValid(
|
| AddressData address_data;
|
| i18ninput::CreateAddressData(base::Bind(&GetInfoFromProfile, profile),
|
| &address_data);
|
| + address_data.language_code = AddressLanguageCodeForSection(section);
|
|
|
| AddressProblems problems;
|
| status = GetValidator()->ValidateAddress(address_data,
|
| @@ -3057,7 +3060,8 @@ void AutofillDialogControllerImpl::FillOutputForSectionWithComparator(
|
|
|
| DetailInputs inputs;
|
| std::string country_code = CountryCodeForSection(section);
|
| - common::BuildInputsForSection(section, country_code, &inputs);
|
| + common::BuildInputsForSection(section, country_code, &inputs,
|
| + MutableAddressLanguageCodeForSection(section));
|
| std::vector<ServerFieldType> types = common::TypesFromInputs(inputs);
|
|
|
| scoped_ptr<DataModelWrapper> wrapper = CreateWrapper(section);
|
| @@ -3111,6 +3115,7 @@ void AutofillDialogControllerImpl::FillOutputForSectionWithComparator(
|
| } else {
|
| AutofillProfile profile;
|
| FillFormGroupFromOutputs(output, &profile);
|
| + profile.set_language_code(AddressLanguageCodeForSection(section));
|
|
|
| if (ShouldSaveDetailsLocally()) {
|
| profile.set_origin(RulesAreLoaded(section) ?
|
| @@ -3259,6 +3264,7 @@ void AutofillDialogControllerImpl::GetI18nValidatorSuggestions(
|
| AddressData user_input;
|
| i18ninput::CreateAddressData(
|
| base::Bind(&GetInfoFromProfile, profile), &user_input);
|
| + user_input.language_code = AddressLanguageCodeForSection(section);
|
|
|
| static const size_t kSuggestionsLimit = 10;
|
| AddressValidator::Status status = GetValidator()->GetSuggestions(
|
| @@ -3296,6 +3302,27 @@ DetailInputs* AutofillDialogControllerImpl::MutableRequestedFieldsForSection(
|
| return const_cast<DetailInputs*>(&RequestedFieldsForSection(section));
|
| }
|
|
|
| +std::string* AutofillDialogControllerImpl::MutableAddressLanguageCodeForSection(
|
| + DialogSection section) {
|
| + switch (section) {
|
| + case SECTION_BILLING:
|
| + case SECTION_CC_BILLING:
|
| + return &billing_address_language_code_;
|
| + case SECTION_SHIPPING:
|
| + return &shipping_address_language_code_;
|
| + case SECTION_CC:
|
| + return NULL;
|
| + }
|
| + NOTREACHED();
|
| + return NULL;
|
| +}
|
| +
|
| +std::string AutofillDialogControllerImpl::AddressLanguageCodeForSection(
|
| + DialogSection section) {
|
| + std::string* language_code = MutableAddressLanguageCodeForSection(section);
|
| + return language_code != NULL ? *language_code : std::string();
|
| +}
|
| +
|
| std::vector<ServerFieldType> AutofillDialogControllerImpl::
|
| RequestedTypesForSection(DialogSection section) const {
|
| return common::TypesFromInputs(RequestedFieldsForSection(section));
|
| @@ -3341,7 +3368,8 @@ bool AutofillDialogControllerImpl::RebuildInputsForCountry(
|
|
|
| DetailInputs* inputs = MutableRequestedFieldsForSection(section);
|
| inputs->clear();
|
| - common::BuildInputsForSection(section, country_code, inputs);
|
| + common::BuildInputsForSection(section, country_code, inputs,
|
| + MutableAddressLanguageCodeForSection(section));
|
| return true;
|
| }
|
|
|
| @@ -3599,6 +3627,8 @@ scoped_ptr<wallet::Address>AutofillDialogControllerImpl::
|
|
|
| AutofillProfile profile;
|
| FillFormGroupFromOutputs(output, &profile);
|
| + profile.set_language_code(
|
| + AddressLanguageCodeForSection(SECTION_SHIPPING));
|
| CanonicalizeState(validator_.get(), &profile);
|
|
|
| return scoped_ptr<wallet::Address>(new wallet::Address(profile));
|
| @@ -3919,6 +3949,8 @@ void AutofillDialogControllerImpl::MaybeShowCreditCardBubble() {
|
| view_->GetUserInput(SECTION_BILLING, &outputs);
|
| billing_profile.reset(new AutofillProfile);
|
| FillFormGroupFromOutputs(outputs, billing_profile.get());
|
| + billing_profile->set_language_code(
|
| + AddressLanguageCodeForSection(SECTION_BILLING));
|
| } else {
|
| // Just snag the currently suggested profile.
|
| std::string item_key = SuggestionsMenuModelForSection(SECTION_BILLING)->
|
|
|