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

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

Issue 390083003: Use street address collapser instead of line separator. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments. Created 6 years, 5 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_i18n_input.cc
diff --git a/chrome/browser/ui/autofill/autofill_dialog_i18n_input.cc b/chrome/browser/ui/autofill/autofill_dialog_i18n_input.cc
index 083b32dcfe246abfd9368aaab20f253032b80cd1..5c3172170eb65f1d248bfab77f57bf9ba5bd3cb3 100644
--- a/chrome/browser/ui/autofill/autofill_dialog_i18n_input.cc
+++ b/chrome/browser/ui/autofill/autofill_dialog_i18n_input.cc
@@ -60,7 +60,7 @@ void BuildAddressInputs(common::AddressType address_type,
for (size_t i = 0; i < components.size(); ++i) {
const AddressUiComponent& component = components[i];
- ServerFieldType server_type = TypeForField(component.field, address_type);
+ ServerFieldType server_type = i18n::TypeForField(component.field, billing);
DetailInput::Length length = LengthFromHint(component.length_hint);
base::string16 placeholder = base::UTF8ToUTF16(component.name);
DetailInput input = { length, server_type, placeholder };
@@ -118,83 +118,5 @@ bool AddressHasCompleteAndVerifiedData(const AutofillProfile& profile,
return true;
}
-ServerFieldType TypeForField(AddressField address_field,
- common::AddressType address_type) {
- bool billing = address_type == common::ADDRESS_TYPE_BILLING;
- switch (address_field) {
- case ::i18n::addressinput::COUNTRY:
- return billing ? ADDRESS_BILLING_COUNTRY : ADDRESS_HOME_COUNTRY;
- case ::i18n::addressinput::ADMIN_AREA:
- return billing ? ADDRESS_BILLING_STATE : ADDRESS_HOME_STATE;
- case ::i18n::addressinput::LOCALITY:
- return billing ? ADDRESS_BILLING_CITY : ADDRESS_HOME_CITY;
- case ::i18n::addressinput::DEPENDENT_LOCALITY:
- return billing ? ADDRESS_BILLING_DEPENDENT_LOCALITY :
- ADDRESS_HOME_DEPENDENT_LOCALITY;
- case ::i18n::addressinput::POSTAL_CODE:
- return billing ? ADDRESS_BILLING_ZIP : ADDRESS_HOME_ZIP;
- case ::i18n::addressinput::SORTING_CODE:
- return billing ? ADDRESS_BILLING_SORTING_CODE : ADDRESS_HOME_SORTING_CODE;
- case ::i18n::addressinput::STREET_ADDRESS:
- return billing ? ADDRESS_BILLING_STREET_ADDRESS :
- ADDRESS_HOME_STREET_ADDRESS;
- case ::i18n::addressinput::RECIPIENT:
- return billing ? NAME_BILLING_FULL : NAME_FULL;
- }
- NOTREACHED();
- return UNKNOWN_TYPE;
-}
-
-bool FieldForType(ServerFieldType server_type, AddressField* field) {
- switch (server_type) {
- case ADDRESS_BILLING_COUNTRY:
- case ADDRESS_HOME_COUNTRY:
- if (field)
- *field = ::i18n::addressinput::COUNTRY;
- return true;
- case ADDRESS_BILLING_STATE:
- case ADDRESS_HOME_STATE:
- if (field)
- *field = ::i18n::addressinput::ADMIN_AREA;
- return true;
- case ADDRESS_BILLING_CITY:
- case ADDRESS_HOME_CITY:
- if (field)
- *field = ::i18n::addressinput::LOCALITY;
- return true;
- case ADDRESS_BILLING_DEPENDENT_LOCALITY:
- case ADDRESS_HOME_DEPENDENT_LOCALITY:
- if (field)
- *field = ::i18n::addressinput::DEPENDENT_LOCALITY;
- return true;
- case ADDRESS_BILLING_SORTING_CODE:
- case ADDRESS_HOME_SORTING_CODE:
- if (field)
- *field = ::i18n::addressinput::SORTING_CODE;
- return true;
- case ADDRESS_BILLING_ZIP:
- case ADDRESS_HOME_ZIP:
- if (field)
- *field = ::i18n::addressinput::POSTAL_CODE;
- return true;
- case ADDRESS_BILLING_STREET_ADDRESS:
- case ADDRESS_BILLING_LINE1:
- case ADDRESS_BILLING_LINE2:
- case ADDRESS_HOME_STREET_ADDRESS:
- case ADDRESS_HOME_LINE1:
- case ADDRESS_HOME_LINE2:
- if (field)
- *field = ::i18n::addressinput::STREET_ADDRESS;
- return true;
- case NAME_BILLING_FULL:
- case NAME_FULL:
- if (field)
- *field = ::i18n::addressinput::RECIPIENT;
- return true;
- default:
- return false;
- }
-}
-
} // namespace i18ninput
} // namespace autofill
« no previous file with comments | « chrome/browser/ui/autofill/autofill_dialog_i18n_input.h ('k') | chrome/browser/ui/autofill/data_model_wrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698