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

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: 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..5718c41c0ca29873405a6b39c7e851dd924dcd7c 100644
--- a/chrome/browser/history/expire_history_backend.cc
+++ b/chrome/browser/history/expire_history_backend.cc
@@ -200,34 +200,21 @@ void ExpireHistoryBackend::DeleteURL(const GURL& url) {
if (!main_db_)
sky 2011/12/14 23:16:49 Implement this in terms of DeleteURLs.
akalin 2011/12/14 23:43:08 Done.
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.
+ DeleteURLHelper(url, &dependencies);
- BookmarkService* bookmark_service = GetBookmarkService();
- bool is_bookmarked =
- (bookmark_service && bookmark_service->IsBookmarked(url));
+ BroadcastDeleteNotifications(&dependencies);
+}
- DeleteOneURL(url_row, is_bookmarked, &dependencies);
- if (!is_bookmarked)
- DeleteFaviconsIfPossible(dependencies.affected_favicons);
+void ExpireHistoryBackend::DeleteURLs(const std::vector<GURL>& urls) {
+ if (!main_db_)
+ return;
- if (text_db_)
- text_db_->OptimizeChangedDatabases(dependencies.text_db_changes);
+ DeleteDependencies dependencies;
+ for (std::vector<GURL>::const_iterator url = urls.begin(); url != urls.end();
+ ++url) {
+ DeleteURLHelper(*url, &dependencies);
+ }
BroadcastDeleteNotifications(&dependencies);
}
@@ -358,6 +345,37 @@ void ExpireHistoryBackend::BroadcastDeleteNotifications(
}
}
+void ExpireHistoryBackend::DeleteURLHelper(
+ const GURL& url, DeleteDependencies* dependencies) {
+ 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);
+
+ 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);
+
+ if (text_db_)
+ text_db_->OptimizeChangedDatabases(dependencies->text_db_changes);
+}
+
void ExpireHistoryBackend::DeleteVisitRelatedInfo(
const VisitVector& visits,
DeleteDependencies* 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