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

Unified Diff: components/ntp_snippets/bookmarks/bookmark_suggestions_provider.cc

Issue 2616633002: Respect time range in browsing data removal for last-visited data. (Closed)
Patch Set: rebase Created 3 years, 11 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
« no previous file with comments | « components/ntp_snippets/bookmarks/bookmark_last_visit_utils_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/ntp_snippets/bookmarks/bookmark_suggestions_provider.cc
diff --git a/components/ntp_snippets/bookmarks/bookmark_suggestions_provider.cc b/components/ntp_snippets/bookmarks/bookmark_suggestions_provider.cc
index 0c946f2818d21cfe53af54ee631ee28786c42378..1f8fdf119ba6883e9d99cbc29d0d22119bb1c8b1 100644
--- a/components/ntp_snippets/bookmarks/bookmark_suggestions_provider.cc
+++ b/components/ntp_snippets/bookmarks/bookmark_suggestions_provider.cc
@@ -149,13 +149,14 @@ void BookmarkSuggestionsProvider::ClearHistory(
base::Time begin,
base::Time end,
const base::Callback<bool(const GURL& url)>& filter) {
- // The last visit dates are not "owned" by the bookmark suggestion provider so
- // it is cleared directly from browsing_data_remover.cc.
+ // To avoid race conditions with the history-removal of the last-visited
+ // timestamps we also trigger a deletion here. The problem is that we need to
+ // update the bookmarks data here and otherwise (depending on the order in
+ // which the code runs) could pick up to-be-deleted data again.
+ if (bookmark_model_->loaded()) {
+ RemoveLastVisitedDatesBetween(begin, end, filter, bookmark_model_);
+ }
ClearDismissedSuggestionsForDebugging(provided_category_);
- // TODO(tschumann): Before re-fetching bookmarks we need to trigger a clean-up
- // of the last-visit dates -- otherwise we depend on the order in which the
- // ClearHistory events are done and might just pick-up to-be-deleted data
- // again.
FetchBookmarks();
}
« no previous file with comments | « components/ntp_snippets/bookmarks/bookmark_last_visit_utils_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698