#include "components/autofill/core/browser/profile_token_quality.h"
#include <algorithm>
#include <set>
#include "base/check.h"
#include "base/check_deref.h"
#include "base/containers/circular_deque.h"
#include "base/containers/contains.h"
#include "base/feature_list.h"
#include "base/rand_util.h"
#include "base/ranges/algorithm.h"
#include "base/strings/levenshtein_distance.h"
#include "base/strings/string_util.h"
#include "base/types/cxx23_to_underlying.h"
#include "components/autofill/core/browser/address_data_manager.h"
#include "components/autofill/core/browser/data_model/autofill_profile.h"
#include "components/autofill/core/browser/field_type_utils.h"
#include "components/autofill/core/browser/field_types.h"
#include "components/autofill/core/browser/form_structure.h"
#include "components/autofill/core/browser/metrics/profile_token_quality_metrics.h"
#include "components/autofill/core/browser/personal_data_manager.h"
#include "components/autofill/core/common/autofill_features.h"
#include "components/autofill/core/common/autofill_l10n_util.h"
namespace autofill {
namespace {
ObservationType;
FieldTypeSet GetSupportedTypes(const AutofillProfile& profile) { … }
ObservationType GetObservationTypeForEditedField(
FieldType type,
std::u16string_view edited_value,
const AutofillProfile& profile,
const std::vector<const AutofillProfile*>& other_profiles,
const std::string& app_locale) { … }
}
ProfileTokenQuality::ProfileTokenQuality(AutofillProfile* profile)
: … { … }
ProfileTokenQuality::ProfileTokenQuality(const ProfileTokenQuality& other) =
default;
ProfileTokenQuality::~ProfileTokenQuality() = default;
bool ProfileTokenQuality::operator==(const ProfileTokenQuality& other) const { … }
bool ProfileTokenQuality::AddObservationsForFilledForm(
const FormStructure& form_structure,
const FormData& form_data,
const PersonalDataManager& pdm) { … }
void ProfileTokenQuality::SaveObservationsForFilledFormForAllSubmittedProfiles(
const FormStructure& form_structure,
const FormData& form_data,
PersonalDataManager& pdm) { … }
std::vector<ObservationType>
ProfileTokenQuality::GetObservationTypesForFieldType(FieldType type) const { … }
void ProfileTokenQuality::AddObservation(FieldType type,
Observation observation) { … }
size_t ProfileTokenQuality::AddSubsetOfObservations(
std::vector<std::pair<FieldType, Observation>> observations) { … }
ObservationType ProfileTokenQuality::GetObservationTypeFromField(
const AutofillField& field,
std::u16string_view current_field_value,
const std::vector<const AutofillProfile*>& other_profiles,
const std::string& app_locale) const { … }
std::vector<uint8_t> ProfileTokenQuality::SerializeObservationsForStoredType(
FieldType type) const { … }
void ProfileTokenQuality::LoadSerializedObservationsForStoredType(
FieldType type,
base::span<const uint8_t> serialized_data) { … }
void ProfileTokenQuality::CopyObservationsForStoredType(
FieldType type,
const ProfileTokenQuality& other) { … }
void ProfileTokenQuality::ResetObservationsForStoredType(FieldType type) { … }
void ProfileTokenQuality::ResetObservationsForDifferingTokens(
const AutofillProfile& other) { … }
ProfileTokenQuality::FormSignatureHash
ProfileTokenQuality::GetFormSignatureHash(FormSignature form_signature) const { … }
}