Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(243)

Unified Diff: chrome/browser/autofill/personal_data_manager.cc

Issue 9585020: Cull autofill entries older than 60 days. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comment Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/sync/profile_sync_service_autofill_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autofill/personal_data_manager.cc
diff --git a/chrome/browser/autofill/personal_data_manager.cc b/chrome/browser/autofill/personal_data_manager.cc
index f291cf9f3a31ae70980284da0875bf289bc44fa5..7ab1285b12b8687d93255789426392c5223da976 100644
--- a/chrome/browser/autofill/personal_data_manager.cc
+++ b/chrome/browser/autofill/personal_data_manager.cc
@@ -23,6 +23,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/sync/profile_sync_service_factory.h"
+#include "chrome/browser/webdata/autofill_entry.h"
#include "chrome/browser/webdata/web_data_service.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/pref_names.h"
@@ -161,6 +162,19 @@ void PersonalDataManager::OnWebDataServiceRequestDone(
AutofillProfile::AdjustInferredLabels(&profile_pointers);
FOR_EACH_OBSERVER(PersonalDataManagerObserver, observers_,
OnPersonalDataChanged());
+
+ // As all Autofill data is ready, the Autocomplete data is ready as well.
+ // If sync is not set, cull older entries of the autocomplete. Otherwise,
+ // the entries will be culled when sync is connected.
+ ProfileSyncService* sync_service =
+ ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile_);
+ if (sync_service && (!sync_service->HasSyncSetupCompleted() ||
+ !profile_->GetPrefs()->GetBoolean(prefs::kSyncAutofill))) {
+ WebDataService* wds =
+ profile_->GetWebDataService(Profile::EXPLICIT_ACCESS);
+ if (wds)
+ wds->RemoveExpiredFormElements();
+ }
}
}
« no previous file with comments | « no previous file | chrome/browser/sync/profile_sync_service_autofill_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698