Chromium Code Reviews| Index: chrome/browser/history/expire_history_backend.cc |
| diff --git a/chrome/browser/history/expire_history_backend.cc b/chrome/browser/history/expire_history_backend.cc |
| index 0f2ea68ed4d1451cd6064d557404d0a4b8eba3f6..75096a92c4c65fbcd4225f559c7303ec56e43694 100644 |
| --- a/chrome/browser/history/expire_history_backend.cc |
| +++ b/chrome/browser/history/expire_history_backend.cc |
| @@ -197,37 +197,45 @@ void ExpireHistoryBackend::SetDatabases(HistoryDatabase* main_db, |
| } |
| void ExpireHistoryBackend::DeleteURL(const GURL& url) { |
| + DeleteURLs(std::vector<GURL>(1, url)); |
| +} |
| + |
| +void ExpireHistoryBackend::DeleteURLs(const std::vector<GURL>& urls) { |
| if (!main_db_) |
| return; |
| - URLRow url_row; |
| - if (!main_db_->GetRowForURL(url, &url_row)) |
| - return; // Nothing to delete. |
| - |
| - // Collect all the visits and delete them. Note that we don't give up if |
| - // there are no visits, since the URL could still have an entry that we should |
| - // delete. |
| - // TODO(brettw): bug 1171148: We should also delete from the archived DB. |
| - VisitVector visits; |
| - main_db_->GetVisitsForURL(url_row.id(), &visits); |
| - |
| DeleteDependencies dependencies; |
| - DeleteVisitRelatedInfo(visits, &dependencies); |
| - |
| - // We skip ExpireURLsForVisits (since we are deleting from the URL, and not |
| - // starting with visits in a given time range). We therefore need to call the |
| - // deletion and favicon update functions manually. |
| - |
| - BookmarkService* bookmark_service = GetBookmarkService(); |
| - bool is_bookmarked = |
| - (bookmark_service && bookmark_service->IsBookmarked(url)); |
| + for (std::vector<GURL>::const_iterator url = urls.begin(); url != urls.end(); |
| + ++url) { |
| + URLRow url_row; |
| + if (!main_db_->GetRowForURL(*url, &url_row)) |
| + return; // Nothing to delete. |
|
sky
2011/12/16 22:00:11
This should be continue now.
|
| + |
| + // Collect all the visits and delete them. Note that we don't give |
| + // up if there are no visits, since the URL could still have an |
| + // entry that we should delete. TODO(brettw): bug 1171148: We |
| + // should also delete from the archived DB. |
| + VisitVector visits; |
| + main_db_->GetVisitsForURL(url_row.id(), &visits); |
| + |
| + DeleteVisitRelatedInfo(visits, &dependencies); |
| + |
| + // We skip ExpireURLsForVisits (since we are deleting from the |
| + // URL, and not starting with visits in a given time range). We |
| + // therefore need to call the deletion and favicon update |
| + // functions manually. |
| + |
| + BookmarkService* bookmark_service = GetBookmarkService(); |
| + bool is_bookmarked = |
| + (bookmark_service && bookmark_service->IsBookmarked(*url)); |
| - DeleteOneURL(url_row, is_bookmarked, &dependencies); |
| - if (!is_bookmarked) |
| - DeleteFaviconsIfPossible(dependencies.affected_favicons); |
| + DeleteOneURL(url_row, is_bookmarked, &dependencies); |
| + if (!is_bookmarked) |
| + DeleteFaviconsIfPossible(dependencies.affected_favicons); |
|
sky
2011/12/16 22:00:11
This is wrong now. In particular if the previous u
|
| - if (text_db_) |
| - text_db_->OptimizeChangedDatabases(dependencies.text_db_changes); |
| + if (text_db_) |
|
sky
2011/12/16 22:00:11
This should be outside the loop.
|
| + text_db_->OptimizeChangedDatabases(dependencies.text_db_changes); |
| + } |
| BroadcastDeleteNotifications(&dependencies); |
| } |