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

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: 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..9ef2c23ad8bbd27dce53270d70f979d8e91c0b4b 100644
--- a/components/ntp_snippets/bookmarks/bookmark_last_visit_utils.h
+++ b/components/ntp_snippets/bookmarks/bookmark_last_visit_utils.h
@@ -28,13 +28,18 @@ 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 |use_creation_date| is true, creation
+// date of the bookmark is considered instead of its last visit date (useful for
+// the transition phase M53 -> M54 when no last visit data is available).
Marc Treib 2016/08/17 11:29:05 Hm, so even in the "fallback mode", wouldn't we st
+base::Time GetLastVisitDateForBookmark(const bookmarks::BookmarkNode* node,
+ bool use_creation_date);
// Like GetLastVisitDateForBookmark, but it returns the unix epoch if the
-// bookmark is dismissed from NTP.
+// bookmark is dismissed from NTP. If |use_creation_date| is true, creation
+// date of the bookmark is considered instead of its last visit date (useful for
+// the transition phase M53 -> M54 when no last visit data is available).
base::Time GetLastVisitDateForBookmarkIfNotDismissed(
- const bookmarks::BookmarkNode* node);
+ const bookmarks::BookmarkNode* node, bool use_creation_date);
// Marks all bookmarks with the given URL as dismissed.
void MarkBookmarksDismissed(bookmarks::BookmarkModel* bookmark_model,
@@ -46,13 +51,19 @@ bool IsDismissedFromNTPForBookmark(const bookmarks::BookmarkNode* node);
// Removes the dismissed flag from all bookmarks (only for debugging).
void MarkAllBookmarksUndismissed(bookmarks::BookmarkModel* bookmark_model);
+// Returns true if and only if there is at least one bookmark in
+// |bookmark_model| that has information about its last visit associated.
+bool IsLastVisitDataAvailable(bookmarks::BookmarkModel* bookmark_model);
+
// Returns the list of most recently visited, non-dismissed bookmarks.
// 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 |use_creation_date| is true, the creation date of a bookmark
+// is used instead of the last visit date.
std::vector<const bookmarks::BookmarkNode*> GetRecentlyVisitedBookmarks(
bookmarks::BookmarkModel* bookmark_model,
+ bool use_creation_date,
int max_count,
const base::Time& min_visit_time);

Powered by Google App Engine
This is Rietveld 408576698