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

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

Issue 2303713002: Implement ClearHistory for all ntp_snippets providers (Closed)
Patch Set: Marc's nits. Created 4 years, 3 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
Index: components/ntp_snippets/bookmarks/bookmark_last_visit_utils.cc
diff --git a/components/ntp_snippets/bookmarks/bookmark_last_visit_utils.cc b/components/ntp_snippets/bookmarks/bookmark_last_visit_utils.cc
index ed94a9bb493cd793af6e5e79b0368e0174dfd657..692f21f9215ab0df8266d27897c7fab6baf8f3a6 100644
--- a/components/ntp_snippets/bookmarks/bookmark_last_visit_utils.cc
+++ b/components/ntp_snippets/bookmarks/bookmark_last_visit_utils.cc
@@ -232,4 +232,20 @@ std::vector<const BookmarkNode*> GetDismissedBookmarksForDebugging(
return result;
}
+void RemoveAllLastVisitDates(bookmarks::BookmarkModel* bookmark_model) {
+ // Get all the bookmark URLs.
+ std::vector<BookmarkModel::URLAndTitle> bookmark_urls;
+ bookmark_model->GetBookmarks(&bookmark_urls);
+
+ for (const BookmarkModel::URLAndTitle& url_and_title : bookmark_urls) {
+ // Get all bookmarks for the given URL.
+ std::vector<const BookmarkNode*> bookmarks_for_url;
+ bookmark_model->GetNodesByURL(url_and_title.url, &bookmarks_for_url);
+
+ for (const BookmarkNode* bookmark : bookmarks_for_url) {
+ bookmark_model->DeleteNodeMetaInfo(bookmark, kBookmarkLastVisitDateKey);
+ }
+ }
+}
+
} // namespace ntp_snippets

Powered by Google App Engine
This is Rietveld 408576698