Chromium Code Reviews| 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(); |