#include "components/autofill/core/browser/form_structure_rationalization_engine.h"
#include <array>
#include "base/containers/contains.h"
#include "base/containers/flat_map.h"
#include "base/feature_list.h"
#include "base/no_destructor.h"
#include "base/notreached.h"
#include "components/autofill/core/browser/field_types.h"
#include "components/autofill/core/browser/form_parsing/form_field_parser.h"
#include "components/autofill/core/browser/form_parsing/regex_patterns.h"
#include "components/autofill/core/browser/logging/log_manager.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/form_field_data.h"
#include "components/autofill/core/common/logging/log_buffer.h"
#include "components/autofill/core/common/logging/log_macros.h"
namespace autofill::rationalization {
EnvironmentCondition::EnvironmentCondition() = default;
EnvironmentCondition::EnvironmentCondition(EnvironmentCondition&&) = default;
EnvironmentCondition::~EnvironmentCondition() = default;
EnvironmentCondition& EnvironmentCondition::operator=(EnvironmentCondition&&) =
default;
EnvironmentConditionBuilder::EnvironmentConditionBuilder() = default;
EnvironmentConditionBuilder::~EnvironmentConditionBuilder() = default;
EnvironmentConditionBuilder& EnvironmentConditionBuilder::SetCountryList(
std::vector<GeoIpCountryCode> country_list) & { … }
EnvironmentConditionBuilder&& EnvironmentConditionBuilder::SetCountryList(
std::vector<GeoIpCountryCode> country_list) && { … }
EnvironmentConditionBuilder& EnvironmentConditionBuilder::SetFeature(
const base::Feature* feature) & { … }
EnvironmentConditionBuilder&& EnvironmentConditionBuilder::SetFeature(
const base::Feature* feature) && { … }
EnvironmentCondition EnvironmentConditionBuilder::Build() && { … }
RationalizationRule::RationalizationRule() = default;
RationalizationRule::~RationalizationRule() = default;
RationalizationRuleBuilder::RationalizationRuleBuilder() = default;
RationalizationRuleBuilder::~RationalizationRuleBuilder() = default;
RationalizationRule::RationalizationRule(RationalizationRule&&) = default;
RationalizationRule& RationalizationRule::operator=(RationalizationRule&&) =
default;
RationalizationRuleBuilder& RationalizationRuleBuilder::SetRuleName(
std::string_view rule_name) & { … }
RationalizationRuleBuilder&& RationalizationRuleBuilder::SetRuleName(
std::string_view rule_name) && { … }
RationalizationRuleBuilder& RationalizationRuleBuilder::SetEnvironmentCondition(
EnvironmentCondition environment_condition) & { … }
RationalizationRuleBuilder&&
RationalizationRuleBuilder::SetEnvironmentCondition(
EnvironmentCondition environment_condition) && { … }
RationalizationRuleBuilder& RationalizationRuleBuilder::SetTriggerField(
FieldCondition trigger_field) & { … }
RationalizationRuleBuilder&& RationalizationRuleBuilder::SetTriggerField(
FieldCondition trigger_field) && { … }
RationalizationRuleBuilder& RationalizationRuleBuilder::SetOtherFieldConditions(
std::vector<FieldCondition> other_field_conditions) & { … }
RationalizationRuleBuilder&&
RationalizationRuleBuilder::SetOtherFieldConditions(
std::vector<FieldCondition> other_field_conditions) && { … }
RationalizationRuleBuilder&
RationalizationRuleBuilder::SetFieldsWithConditionsDoNotExist(
std::vector<FieldCondition> fields_with_conditions_do_not_exist) & { … }
RationalizationRuleBuilder&&
RationalizationRuleBuilder::SetFieldsWithConditionsDoNotExist(
std::vector<FieldCondition> fields_with_conditions_do_not_exist) && { … }
RationalizationRuleBuilder& RationalizationRuleBuilder::SetActions(
std::vector<SetTypeAction> actions) & { … }
RationalizationRuleBuilder&& RationalizationRuleBuilder::SetActions(
std::vector<SetTypeAction> actions) && { … }
RationalizationRule RationalizationRuleBuilder::Build() && { … }
namespace internal {
bool IsEnvironmentConditionFulfilled(ParsingContext& context,
const EnvironmentCondition& env) { … }
bool IsFieldConditionFulfilledIgnoringLocation(ParsingContext& context,
const FieldCondition& condition,
const AutofillField& field) { … }
std::optional<size_t> FindFieldMeetingCondition(
ParsingContext& context,
const std::vector<std::unique_ptr<AutofillField>>& fields,
size_t start_index,
const FieldCondition& condition) { … }
void ApplyRuleIfApplicable(
ParsingContext& context,
const RationalizationRule& rule,
const std::vector<std::unique_ptr<AutofillField>>& fields,
LogManager* log_manager) { … }
}
void ApplyRationalizationEngineRules(
ParsingContext& context,
const std::vector<std::unique_ptr<AutofillField>>& fields,
LogManager* log_manager) { … }
}