diff options
author | dhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-17 20:01:41 +0000 |
---|---|---|
committer | dhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-17 20:01:41 +0000 |
commit | ca9bdebe7afa9c642e13820d74b3b203b6c4cbba (patch) | |
tree | 3e320210760812769f274b0c23cb54aea04ff859 /chrome/browser/autofill/personal_data_manager.h | |
parent | 4051732d27f9bba0d85d71c8cfb0049dce2fd906 (diff) | |
download | chromium_src-ca9bdebe7afa9c642e13820d74b3b203b6c4cbba.zip chromium_src-ca9bdebe7afa9c642e13820d74b3b203b6c4cbba.tar.gz chromium_src-ca9bdebe7afa9c642e13820d74b3b203b6c4cbba.tar.bz2 |
Autofill database migration to clean up bogus profiles.
Adds a |WebDatabase| migration to clean up old profiles. The profiles are merged in much the same way as when aggregated using form submission. Profiles that are identical to another, subsets of another, or contain invalid or incomplete email, state, zip, or address get filtered out.
Additionally, the filtered profiles are remembered in a "trash can" mechanism to later reflect these changes in Sync, so that they don't reappear unintentionally.
BUG=65625
TEST=PersonalDataManagerTest.*:AutoFillMergeTest.DataDrivenMergeProfiles:WebDatabaseMigrationTest.*:WebDatabaseTest.*
Review URL: http://codereview.chromium.org/6676031
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78589 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autofill/personal_data_manager.h')
-rw-r--r-- | chrome/browser/autofill/personal_data_manager.h | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/chrome/browser/autofill/personal_data_manager.h b/chrome/browser/autofill/personal_data_manager.h index bd64ec8..b82be51 100644 --- a/chrome/browser/autofill/personal_data_manager.h +++ b/chrome/browser/autofill/personal_data_manager.h @@ -17,6 +17,7 @@ #include "chrome/browser/autofill/autofill_profile.h" #include "chrome/browser/autofill/credit_card.h" #include "chrome/browser/autofill/field_types.h" +#include "chrome/browser/sync/profile_sync_service_observer.h" #include "chrome/browser/webdata/web_data_service.h" class AutofillManager; @@ -29,6 +30,7 @@ class Profile; // AutoFill. class PersonalDataManager : public WebDataServiceConsumer, + public ProfileSyncServiceObserver, public base::RefCountedThreadSafe<PersonalDataManager> { public: // An interface the PersonalDataManager uses to notify its clients (observers) @@ -58,6 +60,9 @@ class PersonalDataManager // Removes |observer| as the observer of this PersonalDataManager. virtual void RemoveObserver(PersonalDataManager::Observer* observer); + // ProfileSyncServiceObserver: + virtual void OnStateChanged(); + // TODO(isherman): Update this comment // If AutoFill is able to determine the field types of a significant number of // field types that contain information in the FormStructures a profile will @@ -144,6 +149,17 @@ class PersonalDataManager // Kicks off asynchronous loading of profiles and credit cards. void Init(Profile* profile); + // Checks suitability of |profile| for adding to the user's set of profiles. + static bool IsValidLearnableProfile(const AutofillProfile& profile); + + // Merges |profile| into one of the |existing_profiles| if possible; otherwise + // appends |profile| to the end of that list. Fills |merged_profiles| with the + // result. + static bool MergeProfile( + const AutofillProfile& profile, + const std::vector<AutofillProfile*>& existing_profiles, + std::vector<AutofillProfile>* merged_profiles); + protected: // Make sure that only Profile and certain tests can create an instance of // PersonalDataManager. @@ -188,12 +204,8 @@ class PersonalDataManager // Saves |imported_profile| to the WebDB if it exists. virtual void SaveImportedProfile(const AutofillProfile& imported_profile); - // Merges |profile| into one of the |existing_profiles| if possible; otherwise - // appends |profile| to the end of that list. Fills |merged_profiles| with the - // result. - bool MergeProfile(const AutofillProfile& profile, - const std::vector<AutofillProfile*>& existing_profiles, - std::vector<AutofillProfile>* merged_profiles); + // Notifies Sync about data migration if necessary. + void EmptyMigrationTrash(); // The first time this is called, logs an UMA metrics for the number of // profiles the user has. On subsequent calls, does nothing. |