#include "components/autofill/core/browser/address_data_cleaner.h"
#include "base/containers/to_vector.h"
#include "base/notreached.h"
#include "base/ranges/algorithm.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/data_model/autofill_profile_comparator.h"
#include "components/autofill/core/browser/field_types.h"
#include "components/autofill/core/browser/metrics/address_data_cleaner_metrics.h"
#include "components/autofill/core/browser/metrics/autofill_metrics_utils.h"
#include "components/autofill/core/browser/personal_data_manager.h"
#include "components/autofill/core/browser/profile_token_quality.h"
#include "components/autofill/core/common/autofill_clock.h"
#include "components/autofill/core/common/autofill_constants.h"
#include "components/autofill/core/common/autofill_features.h"
#include "components/autofill/core/common/autofill_prefs.h"
#include "components/prefs/pref_service.h"
#include "components/sync/base/user_selectable_type.h"
#include "components/sync/service/sync_service.h"
#include "components/sync/service/sync_user_settings.h"
namespace autofill {
namespace {
DifferingProfileWithTypeSet;
bool ShouldWaitForSync(syncer::SyncService* sync_service) { … }
bool IsSilentlyRemovableQuasiDuplicate(
const AutofillProfile& profile,
const std::vector<AutofillProfile>& other_profiles,
const AutofillProfileComparator& comparator) { … }
void DeduplicateProfiles(const AutofillProfileComparator& comparator,
std::vector<AutofillProfile> profiles,
AddressDataManager& adm) { … }
template <typename T, typename Proj>
std::vector<T> CalculateMinimalIncompatibleTypeSetsImpl(
const AutofillProfile& profile,
base::span<const AutofillProfile* const> other_profiles,
const AutofillProfileComparator& comparator,
Proj proj) { … }
}
AddressDataCleaner::AddressDataCleaner(
AddressDataManager& address_data_manager,
syncer::SyncService* sync_service,
PrefService& pref_service,
AlternativeStateNameMapUpdater* alternative_state_name_map_updater)
: … { … }
AddressDataCleaner::~AddressDataCleaner() = default;
void AddressDataCleaner::MaybeCleanupAddressData() { … }
std::vector<FieldTypeSet>
AddressDataCleaner::CalculateMinimalIncompatibleTypeSets(
const AutofillProfile& profile,
base::span<const AutofillProfile> other_profiles,
const AutofillProfileComparator& comparator) { … }
std::vector<FieldTypeSet>
AddressDataCleaner::CalculateMinimalIncompatibleTypeSets(
const AutofillProfile& profile,
base::span<const AutofillProfile* const> existing_profiles,
const AutofillProfileComparator& comparator) { … }
std::vector<DifferingProfileWithTypeSet>
AddressDataCleaner::CalculateMinimalIncompatibleProfileWithTypeSets(
const AutofillProfile& profile,
base::span<const AutofillProfile* const> existing_profiles,
const AutofillProfileComparator& comparator) { … }
bool AddressDataCleaner::IsTokenLowQualityForDeduplicationPurposes(
const AutofillProfile& profile,
FieldType type) { … }
std::pair<size_t, size_t>
AddressDataCleaner::CountObservationsByQualityForDeduplicationPurposes(
base::span<const ProfileTokenQuality::ObservationType> observations) { … }
void AddressDataCleaner::ApplyDeduplicationRoutine() { … }
void AddressDataCleaner::DeleteDisusedAddresses() { … }
void AddressDataCleaner::OnAddressDataChanged() { … }
void AddressDataCleaner::OnStateChanged(syncer::SyncService* sync_service) { … }
}