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

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

Issue 2256643002: Add a fallback to creation date for Recent bookmarks on NTP (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Marc's comments Created 4 years, 4 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.h
diff --git a/components/ntp_snippets/bookmarks/bookmark_last_visit_utils.h b/components/ntp_snippets/bookmarks/bookmark_last_visit_utils.h
index 01fd935e791f3880452f99c9f89f2811e87d2b0a..18f544298ce3a7a282a10f7bdcf4b3f1bf73b2cf 100644
--- a/components/ntp_snippets/bookmarks/bookmark_last_visit_utils.h
+++ b/components/ntp_snippets/bookmarks/bookmark_last_visit_utils.h
@@ -28,13 +28,16 @@ void UpdateBookmarkOnURLVisitedInMainFrame(
const GURL& url);
// Gets the last visit date for a given bookmark |node|. The visit when the
-// bookmark is created also counts.
-base::Time GetLastVisitDateForBookmark(const bookmarks::BookmarkNode* node);
+// bookmark is created also counts. If no info about last visit date is present
+// and |creation_date_fallback| is true, creation date is used.
+base::Time GetLastVisitDateForBookmark(const bookmarks::BookmarkNode* node,
+ bool creation_date_fallback = true);
Marc Treib 2016/08/18 09:31:44 nit: Default parameters are kinda discouraged, I'd
Philipp Keck 2016/08/19 11:20:54 Done.
// Like GetLastVisitDateForBookmark, but it returns the unix epoch if the
// bookmark is dismissed from NTP.
base::Time GetLastVisitDateForBookmarkIfNotDismissed(
- const bookmarks::BookmarkNode* node);
+ const bookmarks::BookmarkNode* node,
+ bool creation_date_fallback = true);
// Marks all bookmarks with the given URL as dismissed.
void MarkBookmarksDismissed(bookmarks::BookmarkModel* bookmark_model,
@@ -50,9 +53,11 @@ void MarkAllBookmarksUndismissed(bookmarks::BookmarkModel* bookmark_model);
// For each bookmarked URL, it returns the most recently created bookmark.
// The result is ordered by visit time (the most recent first). Only bookmarks
// visited after |min_visit_time| are considered, at most |max_count| bookmarks
-// are returned.
+// are returned. If this results into less than |min_count| bookmarks, the list
+// is filled up with older bookmarks sorted by their last visit / creation date.
std::vector<const bookmarks::BookmarkNode*> GetRecentlyVisitedBookmarks(
bookmarks::BookmarkModel* bookmark_model,
+ int min_count,
int max_count,
const base::Time& min_visit_time);

Powered by Google App Engine
This is Rietveld 408576698