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 be42221c8d3e6501e0d971a9c341f9a3c8ae76a6..e4340bc08a4f041642f5276b579e969fd8739ef0 100644 |
--- a/chrome/browser/ui/autofill/autofill_dialog_i18n_input.cc |
+++ b/chrome/browser/ui/autofill/autofill_dialog_i18n_input.cc |
@@ -12,10 +12,11 @@ |
#include "components/autofill/core/browser/credit_card.h" |
#include "components/autofill/core/browser/field_types.h" |
#include "grit/component_strings.h" |
-#include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/address_data.h" |
-#include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/address_field.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 "third_party/libaddressinput/src/cpp/include/libaddressinput/address_data.h" |
+#include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_field.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" |
namespace autofill { |
@@ -41,23 +42,23 @@ void BuildAddressInputs(common::AddressType address_type, |
const std::string& country_code, |
DetailInputs* inputs, |
std::string* language_code) { |
+ DCHECK(inputs); |
+ DCHECK(language_code); |
+ |
+ ::i18n::addressinput::Localization localization; |
+ localization.SetGetter( |
+ l10n_util::GetStringUTF8, g_browser_process->GetApplicationLocale()); |
std::vector<AddressUiComponent> components( |
::i18n::addressinput::BuildComponents( |
- country_code, g_browser_process->GetApplicationLocale(), |
- language_code)); |
+ country_code, localization, language_code)); |
const bool billing = address_type == common::ADDRESS_TYPE_BILLING; |
for (size_t i = 0; i < components.size(); ++i) { |
const AddressUiComponent& component = components[i]; |
- if (component.field == ::i18n::addressinput::ORGANIZATION) { |
- // TODO(dbeam): figure out when we actually need this. |
- continue; |
- } |
- |
ServerFieldType server_type = TypeForField(component.field, address_type); |
DetailInput::Length length = LengthFromHint(component.length_hint); |
- base::string16 placeholder = l10n_util::GetStringUTF16(component.name_id); |
+ base::string16 placeholder = base::UTF8ToUTF16(component.name); |
DetailInput input = { length, server_type, placeholder }; |
inputs->push_back(input); |
} |
@@ -93,8 +94,10 @@ bool AddressHasCompleteAndVerifiedData(const AutofillProfile& profile, |
if (!profile.IsVerified()) |
return false; |
- if (!i18n::CreateAddressDataFromAutofillProfile(profile, app_locale)-> |
- HasAllRequiredFields()) { |
+ if (i18n::CreateAddressDataFromAutofillProfile(profile, app_locale)-> |
+ region_code.empty()) { |
+ // if (!i18n::CreateAddressDataFromAutofillProfile(profile, app_locale)-> |
+ // HasAllRequiredFields()) { |
please use gerrit instead
2014/05/23 14:44:54
Need David's code to get required fields from stat
|
return false; |
} |
@@ -133,8 +136,6 @@ ServerFieldType TypeForField(AddressField address_field, |
ADDRESS_HOME_STREET_ADDRESS; |
case ::i18n::addressinput::RECIPIENT: |
return billing ? NAME_BILLING_FULL : NAME_FULL; |
- case ::i18n::addressinput::ORGANIZATION: |
- return COMPANY_NAME; |
} |
NOTREACHED(); |
return UNKNOWN_TYPE; |
@@ -183,8 +184,7 @@ bool FieldForType(ServerFieldType server_type, |
*field = ::i18n::addressinput::STREET_ADDRESS; |
return true; |
case COMPANY_NAME: |
- if (field) |
- *field = ::i18n::addressinput::ORGANIZATION; |
+ // Ignored. |
return true; |
case NAME_BILLING_FULL: |
case NAME_FULL: |
@@ -198,9 +198,13 @@ bool FieldForType(ServerFieldType server_type, |
bool CountryIsFullySupported(const std::string& country_code) { |
DCHECK_EQ(2U, country_code.size()); |
+ ::i18n::addressinput::Localization localization; |
+ localization.SetGetter( |
+ l10n_util::GetStringUTF8, g_browser_process->GetApplicationLocale()); |
+ std::string best_address_language; |
std::vector< ::i18n::addressinput::AddressUiComponent> components = |
::i18n::addressinput::BuildComponents( |
- country_code, g_browser_process->GetApplicationLocale(), NULL); |
+ country_code, localization, &best_address_language); |
for (size_t i = 0; i < components.size(); ++i) { |
if (components[i].field == ::i18n::addressinput::DEPENDENT_LOCALITY) |
return false; |