OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_NTP_SNIPPETS_BOOKMARKS_BOOKMARK_LAST_VISIT_UTILS_H_ | 5 #ifndef COMPONENTS_NTP_SNIPPETS_BOOKMARKS_BOOKMARK_LAST_VISIT_UTILS_H_ |
6 #define COMPONENTS_NTP_SNIPPETS_BOOKMARKS_BOOKMARK_LAST_VISIT_UTILS_H_ | 6 #define COMPONENTS_NTP_SNIPPETS_BOOKMARKS_BOOKMARK_LAST_VISIT_UTILS_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 class GURL; | 10 class GURL; |
(...skipping 13 matching lines...) Expand all Loading... |
24 // to now. If there are multiple bookmarks for a given URL, it updates all of | 24 // to now. If there are multiple bookmarks for a given URL, it updates all of |
25 // them. | 25 // them. |
26 void UpdateBookmarkOnURLVisitedInMainFrame( | 26 void UpdateBookmarkOnURLVisitedInMainFrame( |
27 bookmarks::BookmarkModel* bookmark_model, | 27 bookmarks::BookmarkModel* bookmark_model, |
28 const GURL& url); | 28 const GURL& url); |
29 | 29 |
30 // Gets the last visit date for a given bookmark |node|. The visit when the | 30 // Gets the last visit date for a given bookmark |node|. The visit when the |
31 // bookmark is created also counts. If no info about last visit date is present | 31 // bookmark is created also counts. If no info about last visit date is present |
32 // and |creation_date_fallback| is true, creation date is used. | 32 // and |creation_date_fallback| is true, creation date is used. |
33 base::Time GetLastVisitDateForBookmark(const bookmarks::BookmarkNode* node, | 33 base::Time GetLastVisitDateForBookmark(const bookmarks::BookmarkNode* node, |
34 bool creation_date_fallback = true); | 34 bool creation_date_fallback); |
35 | 35 |
36 // Like GetLastVisitDateForBookmark, but it returns the unix epoch if the | 36 // Like GetLastVisitDateForBookmark, but it returns the unix epoch if the |
37 // bookmark is dismissed from NTP. | 37 // bookmark is dismissed from NTP. |
38 base::Time GetLastVisitDateForBookmarkIfNotDismissed( | 38 base::Time GetLastVisitDateForBookmarkIfNotDismissed( |
39 const bookmarks::BookmarkNode* node, | 39 const bookmarks::BookmarkNode* node, |
40 bool creation_date_fallback = true); | 40 bool creation_date_fallback); |
41 | 41 |
42 // Marks all bookmarks with the given URL as dismissed. | 42 // Marks all bookmarks with the given URL as dismissed. |
43 void MarkBookmarksDismissed(bookmarks::BookmarkModel* bookmark_model, | 43 void MarkBookmarksDismissed(bookmarks::BookmarkModel* bookmark_model, |
44 const GURL& url); | 44 const GURL& url); |
45 | 45 |
46 // Gets the dismissed flag for a given bookmark |node|. Defaults to false. | 46 // Gets the dismissed flag for a given bookmark |node|. Defaults to false. |
47 bool IsDismissedFromNTPForBookmark(const bookmarks::BookmarkNode* node); | 47 bool IsDismissedFromNTPForBookmark(const bookmarks::BookmarkNode* node); |
48 | 48 |
49 // Removes the dismissed flag from all bookmarks (only for debugging). | 49 // Removes the dismissed flag from all bookmarks (only for debugging). |
50 void MarkAllBookmarksUndismissed(bookmarks::BookmarkModel* bookmark_model); | 50 void MarkAllBookmarksUndismissed(bookmarks::BookmarkModel* bookmark_model); |
51 | 51 |
52 // Returns the list of most recently visited, non-dismissed bookmarks. | 52 // Returns the list of most recently visited, non-dismissed bookmarks. |
53 // For each bookmarked URL, it returns the most recently created bookmark. | 53 // For each bookmarked URL, it returns the most recently created bookmark. |
54 // The result is ordered by visit time (the most recent first). Only bookmarks | 54 // The result is ordered by visit time (the most recent first). Only bookmarks |
55 // visited after |min_visit_time| are considered, at most |max_count| bookmarks | 55 // visited after |min_visit_time| are considered, at most |max_count| bookmarks |
56 // are returned. If this results into less than |min_count| bookmarks, the list | 56 // are returned. If this results into less than |min_count| bookmarks, the list |
57 // is filled up with older bookmarks sorted by their last visit / creation date. | 57 // is filled up with older bookmarks sorted by their last visit / creation date. |
58 std::vector<const bookmarks::BookmarkNode*> GetRecentlyVisitedBookmarks( | 58 std::vector<const bookmarks::BookmarkNode*> GetRecentlyVisitedBookmarks( |
59 bookmarks::BookmarkModel* bookmark_model, | 59 bookmarks::BookmarkModel* bookmark_model, |
60 int min_count, | 60 int min_count, |
61 int max_count, | 61 int max_count, |
62 const base::Time& min_visit_time); | 62 const base::Time& min_visit_time, |
| 63 bool creation_date_fallback); |
63 | 64 |
64 // Returns the list of all dismissed bookmarks. Only used for debugging. | 65 // Returns the list of all dismissed bookmarks. Only used for debugging. |
65 std::vector<const bookmarks::BookmarkNode*> GetDismissedBookmarksForDebugging( | 66 std::vector<const bookmarks::BookmarkNode*> GetDismissedBookmarksForDebugging( |
66 bookmarks::BookmarkModel* bookmark_model); | 67 bookmarks::BookmarkModel* bookmark_model); |
67 | 68 |
68 } // namespace ntp_snippets | 69 } // namespace ntp_snippets |
69 | 70 |
70 #endif // COMPONENTS_NTP_SNIPPETS_BOOKMARKS_BOOKMARK_LAST_VISIT_UTILS_H_ | 71 #endif // COMPONENTS_NTP_SNIPPETS_BOOKMARKS_BOOKMARK_LAST_VISIT_UTILS_H_ |
OLD | NEW |