#include "components/autofill/core/browser/field_filling_payments_util.h"
#include <optional>
#include "base/ranges/algorithm.h"
#include "base/strings/strcat.h"
#include "base/strings/string_util.h"
#include "components/autofill/core/browser/autofill_field.h"
#include "components/autofill/core/browser/data_model/credit_card.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/form_filler.h"
#include "components/autofill/core/browser/form_parsing/credit_card_field_parser.h"
#include "components/autofill/core/browser/form_structure.h"
#include "components/autofill/core/browser/select_control_util.h"
#include "components/autofill/core/common/autofill_features.h"
#include "components/autofill/core/common/autofill_payments_features.h"
#include "components/autofill/core/common/credit_card_network_identifiers.h"
#include "components/autofill/core/common/form_data.h"
#include "components/autofill/core/common/form_field_data.h"
#include "components/strings/grit/components_strings.h"
#include "ui/base/l10n/l10n_util.h"
namespace autofill {
namespace {
std::u16string GetExpirationMonthSelectControlValue(
const std::u16string& value,
const std::string& app_locale,
base::span<const SelectOption> field_options,
std::string* failure_to_fill) { … }
bool LastTwoDigitsMatch(const std::u16string& year,
const std::u16string& option) { … }
std::u16string GetYearSelectControlValue(
const std::u16string& value,
base::span<const SelectOption> field_options,
std::string* failure_to_fill) { … }
std::u16string GetCreditCardTypeSelectControlValue(
const std::u16string& value,
base::span<const SelectOption> field_options,
std::string* failure_to_fill) { … }
std::u16string TruncateCardNumberIfNecessary(size_t card_number_offset,
uint64_t field_max_length,
const std::u16string& value) { … }
std::u16string GetCreditCardNumberForInput(
const CreditCard& credit_card,
size_t card_number_offset,
uint64_t field_max_length,
const std::string& app_locale,
mojom::ActionPersistence action_persistence) { … }
std::u16string GetVirtualCardNumberForPreviewInput(
const CreditCard& virtual_card,
size_t card_number_offset,
uint64_t field_max_length) { … }
std::u16string GetCreditCardVerificationCodeForInput(
const CreditCard& credit_card,
mojom::ActionPersistence action_persistence,
const std::u16string& cvc) { … }
std::u16string GetExpirationForMonthControl(const CreditCard& card) { … }
std::u16string GetExpirationYearForInput(const CreditCard& credit_card,
FieldType field_type,
uint64_t field_max_length) { … }
std::u16string GetExpirationDateForInput(const CreditCard& credit_card,
const AutofillField& field,
std::string* failure_to_fill) { … }
std::u16string GetFillingValueForCreditCardForInput(
const CreditCard& credit_card,
const std::u16string& cvc,
const std::string& app_locale,
mojom::ActionPersistence action_persistence,
const AutofillField& field,
std::string* failure_to_fill) { … }
std::u16string ReplaceDigitsWithCenterDots(std::u16string value) { … }
std::u16string GetValueForVirtualCardInputPreview(
const CreditCard& virtual_card,
const std::string& app_locale,
const AutofillField& field,
std::string* failure_to_fill) { … }
std::u16string GetFillingValueForCreditCardSelectControl(
const std::u16string& value,
const std::string& app_locale,
const AutofillField& field,
std::string* failure_to_fill) { … }
}
std::u16string GetFillingValueForCreditCard(
const CreditCard& credit_card,
const std::u16string& cvc,
const std::string& app_locale,
mojom::ActionPersistence action_persistence,
const AutofillField& field,
std::string* failure_to_fill) { … }
bool WillFillCreditCardNumberOrCvc(
base::span<const FormFieldData> fields,
base::span<const std::unique_ptr<AutofillField>> autofill_fields,
const AutofillField& trigger_autofill_field,
bool card_has_cvc) { … }
}