#include "components/autofill/core/browser/autofill_optimization_guide.h"
#include "base/containers/flat_set.h"
#include "base/ranges/algorithm.h"
#include "components/autofill/core/browser/autofill_field.h"
#include "components/autofill/core/browser/data_model/credit_card.h"
#include "components/autofill/core/browser/field_types.h"
#include "components/autofill/core/browser/form_structure.h"
#include "components/autofill/core/browser/payments/constants.h"
#include "components/autofill/core/browser/payments_data_manager.h"
#include "components/autofill/core/browser/personal_data_manager.h"
#include "components/autofill/core/common/autofill_payments_features.h"
#include "components/autofill/core/common/credit_card_network_identifiers.h"
#include "components/optimization_guide/core/optimization_guide_decider.h"
#include "components/optimization_guide/proto/hints.pb.h"
namespace autofill {
namespace {
optimization_guide::proto::OptimizationType
GetVcnMerchantOptOutOptimizationTypeForCard(const CreditCard& card) { … }
std::vector<optimization_guide::proto::OptimizationType>
GetCardBenefitsOptimizationTypesForCard(const CreditCard& card) { … }
void AddCreditCardOptimizationTypes(
const PersonalDataManager* personal_data_manager,
base::flat_set<optimization_guide::proto::OptimizationType>&
optimization_types) { … }
void AddAblationOptimizationTypes(
base::flat_set<optimization_guide::proto::OptimizationType>&
optimization_types) { … }
CreditCardCategoryBenefit::BenefitCategory
GetBenefitCategoryForOptimizationType(
const optimization_guide::proto::OptimizationType& optimization_type) { … }
}
AutofillOptimizationGuide::AutofillOptimizationGuide(
optimization_guide::OptimizationGuideDecider* decider)
: … { … }
AutofillOptimizationGuide::~AutofillOptimizationGuide() = default;
void AutofillOptimizationGuide::OnDidParseForm(
const FormStructure& form_structure,
const PersonalDataManager* personal_data_manager) { … }
CreditCardCategoryBenefit::BenefitCategory
AutofillOptimizationGuide::AttemptToGetEligibleCreditCardBenefitCategory(
std::string_view issuer_id,
const GURL& url) const { … }
bool AutofillOptimizationGuide::ShouldBlockSingleFieldSuggestions(
const GURL& url,
const AutofillField* field) const { … }
bool AutofillOptimizationGuide::ShouldBlockFormFieldSuggestion(
const GURL& url,
const CreditCard& card) const { … }
bool AutofillOptimizationGuide::IsEligibleForAblation(
const GURL& url,
optimization_guide::proto::OptimizationType type) const { … }
bool AutofillOptimizationGuide::ShouldBlockBenefitSuggestionLabelsForCardAndUrl(
const CreditCard& card,
const GURL& url) const { … }
}