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

Unified Diff: chrome/browser/history/expire_history_backend.cc

Issue 8910024: Add ExpireHistoryBackend::DeleteURLs method (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 9 years 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/history/expire_history_backend.h ('k') | chrome/browser/history/history_backend.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « chrome/browser/history/expire_history_backend.h ('k') | chrome/browser/history/history_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698