#include "components/autofill/core/browser/field_filling_address_util.h"
#include <optional>
#include "base/ranges/algorithm.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "components/autofill/core/browser/address_normalizer.h"
#include "components/autofill/core/browser/autofill_data_util.h"
#include "components/autofill/core/browser/data_model/autofill_profile.h"
#include "components/autofill/core/browser/data_model/data_model_utils.h"
#include "components/autofill/core/browser/field_type_utils.h"
#include "components/autofill/core/browser/field_types.h"
#include "components/autofill/core/browser/geo/country_names.h"
#include "components/autofill/core/browser/geo/state_names.h"
#include "components/autofill/core/browser/select_control_util.h"
#include "components/autofill/core/common/autofill_features.h"
#include "components/autofill/core/common/autofill_util.h"
#include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_data.h"
#include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_formatter.h"
#include "third_party/re2/src/re2/re2.h"
namespace autofill {
namespace {
bool NormalizeAdminAreaForCountryCode(std::u16string& admin_area,
const std::string& country_code,
AddressNormalizer& address_normalizer) { … }
std::u16string GetNormalizedStateSelectControlValue(
std::u16string value,
base::span<const SelectOption> field_options,
const std::string& country_code,
AddressNormalizer& address_normalizer,
std::string* failure_to_fill) { … }
std::u16string GetStateSelectControlValue(
const std::u16string& value,
base::span<const SelectOption> field_options,
const std::string& country_code,
AddressNormalizer* address_normalizer,
std::string* failure_to_fill) { … }
std::u16string GetCountrySelectControlValue(
const std::u16string& value,
base::span<const SelectOption> field_options,
std::string* failure_to_fill = nullptr) { … }
std::u16string GetStreetAddressForInput(
const std::u16string& address_value,
const std::string& address_language_code,
FormControlType form_control_type) { … }
std::u16string GetStateTextForInput(const std::u16string& state_value,
const std::string& country_code,
uint64_t field_max_length,
std::string* failure_to_fill) { … }
std::u16string GetPhoneCountryCodeSelectControlValue(
const std::u16string& phone_country_code,
base::span<const SelectOption> field_options,
const std::string& country_code,
std::string* failure_to_fill) { … }
std::u16string GetValueForProfileForInput(const AutofillProfile& profile,
const std::string& app_locale,
const AutofillType& field_type,
const FormFieldData& field_data,
std::string* failure_to_fill) { … }
std::u16string GetValueForProfileSelectControl(
const AutofillProfile& profile,
const std::u16string& value,
const std::string& app_locale,
base::span<const SelectOption> field_options,
FieldType field_type,
AddressNormalizer* address_normalizer,
std::string* failure_to_fill) { … }
}
std::pair<std::u16string, FieldType> GetFillingValueAndTypeForProfile(
const AutofillProfile& profile,
const std::string& app_locale,
const AutofillType& field_type,
const FormFieldData& field_data,
AddressNormalizer* address_normalizer,
std::string* failure_to_fill) { … }
std::u16string GetPhoneNumberValueForInput(
uint64_t field_max_length,
const std::u16string& number,
const std::u16string& city_and_number) { … }
}