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

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

Issue 2303713002: Implement ClearHistory for all ntp_snippets providers (Closed)
Patch Set: 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..05a7fa2f3350ff0b8a25d98c6fe815f0e65b3930 100644
--- a/components/ntp_snippets/bookmarks/bookmark_last_visit_utils.cc
+++ b/components/ntp_snippets/bookmarks/bookmark_last_visit_utils.cc
@@ -232,4 +232,21 @@ 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);
+ DCHECK(!bookmarks_for_url.empty());
Marc Treib 2016/09/01 14:11:20 No need to check for this - it shouldn't happen, b
vitaliii 2016/09/01 14:45:15 Done.
+
+ for (const BookmarkNode* bookmark : bookmarks_for_url) {
+ bookmark_model->DeleteNodeMetaInfo(bookmark, kBookmarkLastVisitDateKey);
+ }
+ }
+}
+
} // namespace ntp_snippets

Powered by Google App Engine
This is Rietveld 408576698