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

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: Fixed clang 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
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..a4b79d9368e9de8997e0fc0e1b28267cacff265b 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::RemoveFormElementsAccessedBefore(const Time& delete_end) {
+ GenericRequest<Time>* request =
+ new GenericRequest<Time>(this, GetNextRequestHandle(), NULL, delete_end);
+ RegisterRequest(request);
+ ScheduleTask(FROM_HERE,
+ Bind(&WebDataService::RemoveFormElementsAccessedBeforeImpl,
+ this, request));
+}
Ilya Sherman 2012/03/15 21:00:41 I like exposing this API to clients of the WDS --
GeorgeY 2012/03/17 00:36:16 There are different functions: one removes all tim
Ilya Sherman 2012/03/19 21:12:51 Ok, that makes sense. Please add a TODO to refact
+
void WebDataService::RemoveFormValueForElementName(
const string16& name, const string16& value) {
GenericRequest2<string16, string16>* request =
@@ -1258,6 +1267,31 @@ void WebDataService::RemoveFormElementsAddedBetweenImpl(
request->RequestComplete();
}
+void WebDataService::RemoveFormElementsAccessedBeforeImpl(
+ GenericRequest<Time>* request) {
+ InitializeDatabaseIfNecessary();
+ if (db_ && !request->IsCancelled(NULL)) {
+ AutofillChangeList changes;
+ if (db_->GetAutofillTable()->RemoveFormElementsAccessedBefore(
+ request->arg(), &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();
« chrome/browser/webdata/autofill_table.cc ('K') | « 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