#include "components/autofill/core/browser/form_structure_rationalizer.h"
#include "base/containers/contains.h"
#include "base/ranges/algorithm.h"
#include "components/autofill/core/browser/field_types.h"
#include "components/autofill/core/browser/form_parsing/credit_card_field_parser.h"
#include "components/autofill/core/browser/form_structure_rationalization_engine.h"
#include "components/autofill/core/browser/logging/log_manager.h"
#include "components/autofill/core/browser/rationalization_util.h"
#include "components/autofill/core/common/autofill_features.h"
#include "components/autofill/core/common/autofill_internals/log_message.h"
#include "components/autofill/core/common/autofill_internals/logging_scope.h"
#include "components/autofill/core/common/autofill_payments_features.h"
#include "components/autofill/core/common/logging/log_buffer.h"
#include "components/autofill/core/common/logging/log_macros.h"
namespace autofill {
namespace {
FieldTypeSet GetNecessaryTypesFor(FieldType type) { … }
}
class FormStructureRationalizer::SectionedFieldsIndexes { … };
FormStructureRationalizer::FormStructureRationalizer(
std::vector<std::unique_ptr<AutofillField>>* fields)
: … { … }
FormStructureRationalizer::~FormStructureRationalizer() = default;
void FormStructureRationalizer::RationalizeAutocompleteAttributes(
LogManager* log_manager) { … }
void FormStructureRationalizer::RationalizeContentEditables(
LogManager* log_manager) { … }
void FormStructureRationalizer::RationalizeCreditCardFieldPredictions(
LogManager* log_manager) { … }
void FormStructureRationalizer::RationalizeMultiOriginCreditCardFields(
const url::Origin& main_origin,
LogManager* log_manager) { … }
void FormStructureRationalizer::RationalizeCreditCardNumberOffsets(
LogManager* log_manager) { … }
void FormStructureRationalizer::RationalizeStreetAddressAndAddressLine(
LogManager* log_manager) { … }
void FormStructureRationalizer::RationalizeBetweenStreetFields(
LogManager* log_manager) { … }
void FormStructureRationalizer::RationalizePhoneNumberTrunkTypes(
LogManager* log_manager) { … }
void FormStructureRationalizer::RationalizePhoneNumbersInSection(
const Section& section) { … }
void FormStructureRationalizer::ApplyRationalizationsToFieldAndLog(
size_t field_index,
FieldType new_type,
FormSignature form_signature,
AutofillMetrics::FormInteractionsUkmLogger* form_interactions_ukm_logger) { … }
void FormStructureRationalizer::RationalizeAddressLineFields(
SectionedFieldsIndexes* sections_of_address_indexes,
FormSignature form_signature,
AutofillMetrics::FormInteractionsUkmLogger* form_interactions_ukm_logger,
LogManager* log_manager) { … }
void FormStructureRationalizer::ApplyRationalizationsToHiddenSelects(
size_t field_index,
FieldType new_type,
FormSignature form_signature,
AutofillMetrics::FormInteractionsUkmLogger* form_interactions_ukm_logger) { … }
bool FormStructureRationalizer::HeuristicsPredictionsAreApplicable(
size_t upper_index,
size_t lower_index,
FieldType first_type,
FieldType second_type) { … }
void FormStructureRationalizer::ApplyRationalizationsToFields(
size_t upper_index,
size_t lower_index,
FieldType upper_type,
FieldType lower_type,
FormSignature form_signature,
AutofillMetrics::FormInteractionsUkmLogger* form_interactions_ukm_logger) { … }
bool FormStructureRationalizer::FieldShouldBeRationalizedToCountry(
size_t upper_index) { … }
void FormStructureRationalizer::RationalizeAddressStateCountry(
SectionedFieldsIndexes* sections_of_state_indexes,
SectionedFieldsIndexes* sections_of_country_indexes,
FormSignature form_signature,
AutofillMetrics::FormInteractionsUkmLogger* form_interactions_ukm_logger,
LogManager* log_manager) { … }
void FormStructureRationalizer::RationalizeRepeatedFields(
FormSignature form_signature,
AutofillMetrics::FormInteractionsUkmLogger* form_interactions_ukm_logger,
LogManager* log_manager) { … }
void FormStructureRationalizer::RationalizeFieldTypePredictions(
const url::Origin& main_origin,
const GeoIpCountryCode& client_country,
const LanguageCode& language_code,
LogManager* log_manager) { … }
void FormStructureRationalizer::RationalizeTypeRelationships(
LogManager* log_manager) { … }
void FormStructureRationalizer::RationalizeByRationalizationEngine(
const GeoIpCountryCode& client_country,
const LanguageCode& language_code,
LogManager* log_manager) { … }
}