#include "components/autofill/core/browser/ml_model/autofill_ml_prediction_model_handler.h"
#include <algorithm>
#include <vector>
#include "base/barrier_callback.h"
#include "base/functional/bind.h"
#include "base/memory/weak_ptr.h"
#include "base/ranges/algorithm.h"
#include "components/autofill/core/browser/field_types.h"
#include "components/autofill/core/browser/form_structure.h"
#include "components/autofill/core/browser/heuristic_source.h"
#include "components/autofill/core/browser/ml_model/autofill_model_encoder.h"
#include "components/autofill/core/browser/ml_model/autofill_model_executor.h"
#include "components/optimization_guide/core/model_handler.h"
#include "components/optimization_guide/core/optimization_guide_model_provider.h"
#include "components/optimization_guide/proto/autofill_field_classification_model_metadata.pb.h"
namespace autofill {
namespace {
std::optional<optimization_guide::proto::Any> CreateModelMetadata() { … }
}
AutofillMlPredictionModelHandler::AutofillMlPredictionModelHandler(
optimization_guide::OptimizationGuideModelProvider* model_provider)
: … { … }
AutofillMlPredictionModelHandler::~AutofillMlPredictionModelHandler() = default;
void AutofillMlPredictionModelHandler::GetModelPredictionsForForm(
std::unique_ptr<FormStructure> form_structure,
base::OnceCallback<void(std::unique_ptr<FormStructure>)> callback) { … }
void AutofillMlPredictionModelHandler::GetModelPredictionsForForms(
std::vector<std::unique_ptr<FormStructure>> forms,
base::OnceCallback<void(std::vector<std::unique_ptr<FormStructure>>)>
callback) { … }
void AutofillMlPredictionModelHandler::OnModelUpdated(
optimization_guide::proto::OptimizationTarget optimization_target,
base::optional_ref<const optimization_guide::ModelInfo> model_info) { … }
void AutofillMlPredictionModelHandler::AssignMostLikelyTypes(
FormStructure& form,
const AutofillModelEncoder::ModelOutput& output) const { … }
FieldType AutofillMlPredictionModelHandler::GetMostLikelyType(
const std::vector<float>& model_output) const { … }
}