| Index: chrome/browser/ui/autofill/autofill_dialog_common.cc
|
| diff --git a/chrome/browser/ui/autofill/autofill_dialog_common.cc b/chrome/browser/ui/autofill/autofill_dialog_common.cc
|
| index 4391a6b0d18d94711069617aaa590d3ce8457c76..51459d3163acf35d0d39b9e209bcebdd3e70f4c2 100644
|
| --- a/chrome/browser/ui/autofill/autofill_dialog_common.cc
|
| +++ b/chrome/browser/ui/autofill/autofill_dialog_common.cc
|
| @@ -5,6 +5,7 @@
|
| #include "chrome/browser/ui/autofill/autofill_dialog_common.h"
|
|
|
| #include "chrome/browser/browser_process.h"
|
| +#include "chrome/browser/ui/autofill/autofill_dialog_i18n_input.h"
|
| #include "components/autofill/core/browser/autofill_country.h"
|
| #include "components/autofill/core/browser/autofill_field.h"
|
| #include "components/autofill/core/browser/autofill_type.h"
|
| @@ -71,9 +72,9 @@ void BuildInputs(const DetailInput* input_template,
|
| }
|
| }
|
|
|
| -// Constructs |inputs| from template data for a given |dialog_section|.
|
| void BuildInputsForSection(DialogSection dialog_section,
|
| - DetailInputs* inputs) {
|
| + DetailInputs* inputs,
|
| + const std::string& country_region) {
|
| const DetailInput kCCInputs[] = {
|
| { 1, CREDIT_CARD_NUMBER, IDS_AUTOFILL_DIALOG_PLACEHOLDER_CARD_NUMBER },
|
| { 2, CREDIT_CARD_EXP_MONTH, IDS_AUTOFILL_DIALOG_PLACEHOLDER_EXPIRY_MONTH },
|
| @@ -83,6 +84,7 @@ void BuildInputsForSection(DialogSection dialog_section,
|
| 1.5 },
|
| };
|
|
|
| + const int kBillingInputsStartRow = 3;
|
| const DetailInput kBillingInputs[] = {
|
| { 3, NAME_BILLING_FULL, IDS_AUTOFILL_DIALOG_PLACEHOLDER_CARDHOLDER_NAME },
|
| { 4, ADDRESS_BILLING_LINE1,
|
| @@ -91,29 +93,32 @@ void BuildInputsForSection(DialogSection dialog_section,
|
| IDS_AUTOFILL_DIALOG_PLACEHOLDER_ADDRESS_LINE_2 },
|
| { 6, ADDRESS_BILLING_CITY,
|
| IDS_AUTOFILL_DIALOG_PLACEHOLDER_LOCALITY },
|
| - // TODO(estade): state placeholder should depend on locale.
|
| { 7, ADDRESS_BILLING_STATE, IDS_AUTOFILL_FIELD_LABEL_STATE },
|
| { 7, ADDRESS_BILLING_ZIP,
|
| IDS_AUTOFILL_DIALOG_PLACEHOLDER_POSTAL_CODE },
|
| - // We don't allow the user to change the country: http://crbug.com/247518
|
| - { -1, ADDRESS_BILLING_COUNTRY, 0 },
|
| - { 9, PHONE_BILLING_WHOLE_NUMBER,
|
| + };
|
| +
|
| + const DetailInput kBillingPhoneInputs[] = {
|
| + { 19, PHONE_BILLING_WHOLE_NUMBER,
|
| IDS_AUTOFILL_DIALOG_PLACEHOLDER_PHONE_NUMBER },
|
| };
|
|
|
| const DetailInput kEmailInputs[] = {
|
| - { 10, EMAIL_ADDRESS, IDS_AUTOFILL_DIALOG_PLACEHOLDER_EMAIL },
|
| + { 20, EMAIL_ADDRESS, IDS_AUTOFILL_DIALOG_PLACEHOLDER_EMAIL },
|
| };
|
|
|
| + const int kShippingInputsStartRow = 21;
|
| const DetailInput kShippingInputs[] = {
|
| - { 11, NAME_FULL, IDS_AUTOFILL_DIALOG_PLACEHOLDER_ADDRESSEE_NAME },
|
| - { 12, ADDRESS_HOME_LINE1, IDS_AUTOFILL_DIALOG_PLACEHOLDER_ADDRESS_LINE_1 },
|
| - { 13, ADDRESS_HOME_LINE2, IDS_AUTOFILL_DIALOG_PLACEHOLDER_ADDRESS_LINE_2 },
|
| - { 14, ADDRESS_HOME_CITY, IDS_AUTOFILL_DIALOG_PLACEHOLDER_LOCALITY },
|
| - { 15, ADDRESS_HOME_STATE, IDS_AUTOFILL_FIELD_LABEL_STATE },
|
| - { 15, ADDRESS_HOME_ZIP, IDS_AUTOFILL_DIALOG_PLACEHOLDER_POSTAL_CODE },
|
| - { -1, ADDRESS_HOME_COUNTRY, 0 },
|
| - { 17, PHONE_HOME_WHOLE_NUMBER,
|
| + { 21, NAME_FULL, IDS_AUTOFILL_DIALOG_PLACEHOLDER_ADDRESSEE_NAME },
|
| + { 22, ADDRESS_HOME_LINE1, IDS_AUTOFILL_DIALOG_PLACEHOLDER_ADDRESS_LINE_1 },
|
| + { 23, ADDRESS_HOME_LINE2, IDS_AUTOFILL_DIALOG_PLACEHOLDER_ADDRESS_LINE_2 },
|
| + { 24, ADDRESS_HOME_CITY, IDS_AUTOFILL_DIALOG_PLACEHOLDER_LOCALITY },
|
| + { 25, ADDRESS_HOME_STATE, IDS_AUTOFILL_FIELD_LABEL_STATE },
|
| + { 25, ADDRESS_HOME_ZIP, IDS_AUTOFILL_DIALOG_PLACEHOLDER_POSTAL_CODE },
|
| + };
|
| +
|
| + const DetailInput kShippingPhoneInputs[] = {
|
| + { 37, PHONE_HOME_WHOLE_NUMBER,
|
| IDS_AUTOFILL_DIALOG_PLACEHOLDER_PHONE_NUMBER },
|
| };
|
|
|
| @@ -123,17 +128,42 @@ void BuildInputsForSection(DialogSection dialog_section,
|
| break;
|
|
|
| case SECTION_BILLING:
|
| - BuildInputs(kBillingInputs, arraysize(kBillingInputs), inputs);
|
| + if (i18ninput::IsI18nAddressInputEnabled()) {
|
| + i18ninput::BuildI18nInputs(i18ninput::ADDRESS_TYPE_BILLING,
|
| + country_region,
|
| + kBillingInputsStartRow,
|
| + inputs);
|
| + } else {
|
| + BuildInputs(kBillingInputs, arraysize(kBillingInputs), inputs);
|
| + }
|
| + BuildInputs(kBillingPhoneInputs, arraysize(kBillingPhoneInputs), inputs);
|
| BuildInputs(kEmailInputs, arraysize(kEmailInputs), inputs);
|
| break;
|
|
|
| case SECTION_CC_BILLING:
|
| BuildInputs(kCCInputs, arraysize(kCCInputs), inputs);
|
| - BuildInputs(kBillingInputs, arraysize(kBillingInputs), inputs);
|
| + if (i18ninput::IsI18nAddressInputEnabled()) {
|
| + i18ninput::BuildI18nInputs(i18ninput::ADDRESS_TYPE_BILLING,
|
| + country_region,
|
| + kBillingInputsStartRow,
|
| + inputs);
|
| + } else {
|
| + BuildInputs(kBillingInputs, arraysize(kBillingInputs), inputs);
|
| + }
|
| + BuildInputs(kBillingPhoneInputs, arraysize(kBillingPhoneInputs), inputs);
|
| break;
|
|
|
| case SECTION_SHIPPING:
|
| - BuildInputs(kShippingInputs, arraysize(kShippingInputs), inputs);
|
| + if (i18ninput::IsI18nAddressInputEnabled()) {
|
| + i18ninput::BuildI18nInputs(i18ninput::ADDRESS_TYPE_SHIPPING,
|
| + country_region,
|
| + kShippingInputsStartRow,
|
| + inputs);
|
| + } else {
|
| + BuildInputs(kShippingInputs, arraysize(kShippingInputs), inputs);
|
| + }
|
| + BuildInputs(
|
| + kShippingPhoneInputs, arraysize(kShippingPhoneInputs), inputs);
|
| break;
|
| }
|
| }
|
|
|