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

Unified Diff: chrome/browser/webdata/web_data_service.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 | « chrome/browser/webdata/web_data_service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/webdata/web_data_service.cc
diff --git a/chrome/browser/webdata/web_data_service.cc b/chrome/browser/webdata/web_data_service.cc
index e5f76d8cf8d6ce5fb07ccc382dac24428167b191..e52e167370a636a10f89f8b547f936040c652fec 100644
--- a/chrome/browser/webdata/web_data_service.cc
+++ b/chrome/browser/webdata/web_data_service.cc
@@ -515,6 +515,15 @@ void WebDataService::RemoveFormElementsAddedBetween(const Time& delete_begin,
this, request));
}
+void WebDataService::RemoveExpiredFormElements() {
+ WebDataRequest* request =
+ new WebDataRequest(this, GetNextRequestHandle(), NULL);
+ RegisterRequest(request);
+ ScheduleTask(FROM_HERE,
+ Bind(&WebDataService::RemoveExpiredFormElementsImpl,
+ this, request));
+}
+
void WebDataService::RemoveFormValueForElementName(
const string16& name, const string16& value) {
GenericRequest2<string16, string16>* request =
@@ -1258,6 +1267,29 @@ void WebDataService::RemoveFormElementsAddedBetweenImpl(
request->RequestComplete();
}
+void WebDataService::RemoveExpiredFormElementsImpl(WebDataRequest* request) {
+ InitializeDatabaseIfNecessary();
+ if (db_ && !request->IsCancelled(NULL)) {
+ AutofillChangeList changes;
+ if (db_->GetAutofillTable()->RemoveExpiredFormElements(&changes)) {
+ if (!changes.empty()) {
+ request->SetResult(
+ new WDResult<AutofillChangeList>(AUTOFILL_CHANGES, changes));
+
+ // Post the notifications including the list of affected keys.
+ // This is sent here so that work resulting from this notification
+ // will be done on the DB thread, and not the UI thread.
+ content::NotificationService::current()->Notify(
+ chrome::NOTIFICATION_AUTOFILL_ENTRIES_CHANGED,
+ content::Source<WebDataService>(this),
+ content::Details<AutofillChangeList>(&changes));
+ }
+ ScheduleCommit();
+ }
+ }
+ request->RequestComplete();
+}
+
void WebDataService::RemoveFormValueForElementNameImpl(
GenericRequest2<string16, string16>* request) {
InitializeDatabaseIfNecessary();
« no previous file with comments | « chrome/browser/webdata/web_data_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698