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

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

Issue 2200113002: [New CL] Add a tab helper to record the last visit date for each bookmark (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unnecessary explicit 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
new file mode 100644
index 0000000000000000000000000000000000000000..f5d9172679891d24d3984edf4b6e39b34f7a9da0
--- /dev/null
+++ b/components/ntp_snippets/bookmarks/bookmark_last_visit_utils.h
@@ -0,0 +1,45 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_NTP_SNIPPETS_BOOKMARKS_BOOKMARK_LAST_VISIT_UTILS_H_
+#define COMPONENTS_NTP_SNIPPETS_BOOKMARKS_BOOKMARK_LAST_VISIT_UTILS_H_
+
+#include <vector>
+
+class GURL;
+
+namespace base {
+class Time;
+} // namespace base
+
+namespace bookmarks {
+class BookmarkModel;
+class BookmarkNode;
+} // namespace bookmarks
+
+namespace ntp_snippets {
+
+// If there is a bookmark for |url|, this function updates its last visit date
+// to now. If there are multiple bookmarks for a given URL, it updates all of
+// them.
+void UpdateBookmarkOnURLVisitedInMainFrame(
+ bookmarks::BookmarkModel* bookmark_model,
+ const GURL& url);
+
+// Gets the last visit date for a given bookmark |node|. If the bookmark lacks
+// this info, it returns it creation date.
+base::Time GetLastVisitDateForBookmark(const bookmarks::BookmarkNode* node);
+
+// Returns the list of most recently visited 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.
+std::vector<const bookmarks::BookmarkNode*> GetRecentlyVisitedBookmarks(
+ bookmarks::BookmarkModel* bookmark_model,
+ int max_count,
+ const base::Time& min_visit_time);
+
+} // namespace ntp_snippets
+
+#endif // COMPONENTS_NTP_SNIPPETS_BOOKMARKS_BOOKMARK_LAST_VISIT_UTILS_H_
« no previous file with comments | « components/ntp_snippets/bookmarks/DEPS ('k') | components/ntp_snippets/bookmarks/bookmark_last_visit_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698