Chromium Code Reviews| 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..660b473cd1193a7bfc086ea40f2d9845ec5abb13 |
| --- /dev/null |
| +++ b/components/ntp_snippets/bookmarks/bookmark_last_visit_utils.h |
| @@ -0,0 +1,41 @@ |
| +// 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 <memory> |
| +#include <vector> |
| + |
| +#include "base/macros.h" |
| +#include "base/time/time.h" |
| +#include "components/bookmarks/browser/bookmark_model.h" |
| +#include "components/bookmarks/browser/bookmark_node.h" |
| + |
| +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 bookmarked URLs. For each such URL |
|
Marc Treib
2016/07/30 14:38:09
nit: It really returns the bookmarks, not just the
Philipp Keck
2016/08/02 13:05:33
Done.
|
| +// it returns the most recently created bookmark. The result is ordered by visit |
| +// time (the most recent first). Only bookmarked URLs 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_ |