| Index: components/autofill/core/browser/personal_data_manager.h
|
| diff --git a/components/autofill/core/browser/personal_data_manager.h b/components/autofill/core/browser/personal_data_manager.h
|
| index 9fcbc74b80a253ff97d6b096a415503021e76b2e..75ba46b65b1f2ce16e0bd195ea65c82c5bbbb291 100644
|
| --- a/components/autofill/core/browser/personal_data_manager.h
|
| +++ b/components/autofill/core/browser/personal_data_manager.h
|
| @@ -253,12 +253,24 @@ class PersonalDataManager : public KeyedService,
|
| FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, FirstMiddleLast);
|
| FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, AutofillIsEnabledAtStartup);
|
| FRIEND_TEST_ALL_PREFIXES(PersonalDataManagerTest,
|
| - FindAndMergeDuplicateProfiles_ProfilesToDelete);
|
| - FRIEND_TEST_ALL_PREFIXES(PersonalDataManagerTest,
|
| - FindAndMergeDuplicateProfiles_MergedProfileValues);
|
| + DedupeProfiles_ProfilesToDelete);
|
| FRIEND_TEST_ALL_PREFIXES(PersonalDataManagerTest, ApplyProfileUseDatesFix);
|
| FRIEND_TEST_ALL_PREFIXES(PersonalDataManagerTest,
|
| ApplyProfileUseDatesFix_NotAppliedTwice);
|
| + FRIEND_TEST_ALL_PREFIXES(PersonalDataManagerTest,
|
| + ApplyDedupingRoutine_MergedProfileValues);
|
| + FRIEND_TEST_ALL_PREFIXES(PersonalDataManagerTest,
|
| + ApplyDedupingRoutine_VerifiedProfileFirst);
|
| + FRIEND_TEST_ALL_PREFIXES(PersonalDataManagerTest,
|
| + ApplyDedupingRoutine_VerifiedProfileLast);
|
| + FRIEND_TEST_ALL_PREFIXES(PersonalDataManagerTest,
|
| + ApplyDedupingRoutine_MultipleVerifiedProfiles);
|
| + FRIEND_TEST_ALL_PREFIXES(PersonalDataManagerTest,
|
| + ApplyDedupingRoutine_FeatureDisabled);
|
| + FRIEND_TEST_ALL_PREFIXES(PersonalDataManagerTest,
|
| + ApplyDedupingRoutine_OncePerVersion);
|
| + FRIEND_TEST_ALL_PREFIXES(PersonalDataManagerTest,
|
| + ApplyDedupingRoutine_MultipleDedupes);
|
| friend class autofill::AutofillInteractiveTest;
|
| friend class autofill::AutofillTest;
|
| friend class autofill::PersonalDataManagerFactory;
|
| @@ -414,36 +426,28 @@ class PersonalDataManager : public KeyedService,
|
| const base::string16& field_contents,
|
| const std::vector<CreditCard*>& cards_to_suggest) const;
|
|
|
| - // Goes through the |existing_profiles| to find similar profiles to
|
| - // |profile_to_merge|. If a similar profile is found |profile_to_merge| is
|
| - // merged into it, gets deleted and the result becomes the new
|
| - // |profile_to_merge|. The process continues until the end of
|
| - // |existing_profiles| is reached.
|
| - //
|
| - // |existing_profiles| should be sorted by frecency to ensure that the more
|
| - // relevant profiles get merged into the less relevant ones.
|
| - void FindMergeAndDeleteDuplicateProfiles(
|
| - const std::vector<AutofillProfile*>& existing_profiles,
|
| - AutofillProfile* profile_to_merge);
|
| -
|
| - // Goes through the |existing_profiles| to find similar profiles to
|
| - // |profile_to_merge|. If a similar profile is found |profile_to_merge| is
|
| - // merged into it, its GUID gets added to |profile_guids_to_delete| and the
|
| - // result becomes the new |profile_to_merge|. The process continues until the
|
| - // end of |existing_profiles| is reached.
|
| - //
|
| - // Note: This method is exposed for testability and should not be called
|
| - // directly in the code except in FindMergeAndDeleteDuplicateProfiles. Please
|
| - // use that method instead.
|
| - void FindAndMergeDuplicateProfiles(
|
| - const std::vector<AutofillProfile*>& existing_profiles,
|
| - AutofillProfile* profile_to_merge,
|
| - std::vector<std::string>* profile_guids_to_delete);
|
| -
|
| // Runs the Autofill use date fix routine if it's never been done. Returns
|
| // whether the routine was run.
|
| void ApplyProfileUseDatesFix();
|
|
|
| + // Applies the deduping routine once per major version if the feature is
|
| + // enabled. Calls DedupeProfiles with the content of |web_profiles_| as a
|
| + // parameter. Removes the profiles to delete from the database and updates the
|
| + // others. Returns true if the routine was run.
|
| + bool ApplyDedupingRoutine();
|
| +
|
| + // Goes through all the |existing_profiles| and merges all similar unverified
|
| + // profiles together. Also discards unverified profiles that are similar to a
|
| + // verified profile. All the profiles except the results of the merges will be
|
| + // added to |profile_guids_to_delete|. This routine should be run once per
|
| + // major version.
|
| + //
|
| + // This method should only be called by ApplyDedupingRoutine. It is split for
|
| + // testing purposes.
|
| + void DedupeProfiles(
|
| + std::vector<AutofillProfile*>* existing_profiles,
|
| + std::unordered_set<AutofillProfile*>* profile_guids_to_delete);
|
| +
|
| const std::string app_locale_;
|
|
|
| // The default country code for new addresses.
|
|
|