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

Unified Diff: chrome/browser/ui/autofill/autofill_dialog_common.cc

Issue 25620002: [rac] Use i18n address inputs with --enable-autofill-address-i18n flag (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Avoid initializer list Created 7 years, 2 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
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 ecffc7da5f9b21fc1cca038161b6482ac9696be2..8eb2015ee48d4c8db5d32237b561d814d33af623 100644
--- a/chrome/browser/ui/autofill/autofill_dialog_common.cc
+++ b/chrome/browser/ui/autofill/autofill_dialog_common.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/ui/autofill/autofill_dialog_common.h"
+#include "chrome/browser/ui/autofill/autofill_dialog_i18n_input.h"
#include "components/autofill/core/browser/autofill_field.h"
#include "components/autofill/core/browser/autofill_type.h"
#include "grit/chromium_strings.h"
@@ -72,6 +73,12 @@ void BuildInputs(const DetailInput* input_template,
// Constructs |inputs| from template data for a given |dialog_section|.
void BuildInputsForSection(DialogSection dialog_section,
DetailInputs* inputs) {
+ BuildInputsForSection(dialog_section, inputs, i18ninput::GuessCountry());
+}
+
+void BuildInputsForSection(DialogSection dialog_section,
+ 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 },
@@ -81,6 +88,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,
@@ -89,29 +97,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 },
};
@@ -121,17 +132,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;
}
}
« no previous file with comments | « chrome/browser/ui/autofill/autofill_dialog_common.h ('k') | chrome/browser/ui/autofill/autofill_dialog_i18n_input.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698