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 17 matching lines...) Expand all Loading... |
28 bookmarks::BookmarkModel* bookmark_model, | 28 bookmarks::BookmarkModel* bookmark_model, |
29 const GURL& url, | 29 const GURL& url, |
30 bool is_mobile_platform); | 30 bool is_mobile_platform); |
31 | 31 |
32 // Reads the last visit date for a given bookmark |node|. On success, |out| is | 32 // Reads the last visit date for a given bookmark |node|. On success, |out| is |
33 // set to the extracted time and 'true' is returned. Otherwise returns false | 33 // set to the extracted time and 'true' is returned. Otherwise returns false |
34 // which also includes the case that the bookmark was dismissed from the NTP. | 34 // which also includes the case that the bookmark was dismissed from the NTP. |
35 // As visits, we primarily understand visits on Android (the visit when the | 35 // As visits, we primarily understand visits on Android (the visit when the |
36 // bookmark is created also counts). Visits on desktop platforms are considered | 36 // bookmark is created also counts). Visits on desktop platforms are considered |
37 // only if |consider_visits_from_desktop|. | 37 // only if |consider_visits_from_desktop|. |
38 bool GetLastVisitDateForNTPBookmark(const bookmarks::BookmarkNode* node, | 38 bool GetLastVisitDateForNTPBookmark(const bookmarks::BookmarkNode& node, |
39 bool consider_visits_from_desktop, | 39 bool consider_visits_from_desktop, |
40 base::Time* out); | 40 base::Time* out); |
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. | 56 // are returned. |
57 // If |consider_visits_from_desktop|, also visits to bookmarks on synced desktop | 57 // If |consider_visits_from_desktop|, also visits to bookmarks on synced desktop |
58 // platforms are considered (and not only on this and other synced Android | 58 // platforms are considered (and not only on this and other synced Android |
59 // devices). | 59 // devices). |
60 std::vector<const bookmarks::BookmarkNode*> GetRecentlyVisitedBookmarks( | 60 std::vector<const bookmarks::BookmarkNode*> GetRecentlyVisitedBookmarks( |
61 bookmarks::BookmarkModel* bookmark_model, | 61 bookmarks::BookmarkModel* bookmark_model, |
62 int max_count, | 62 int max_count, |
63 const base::Time& min_visit_time, | 63 const base::Time& min_visit_time, |
64 bool consider_visits_from_desktop); | 64 bool consider_visits_from_desktop); |
65 | 65 |
66 // Returns the list of all dismissed bookmarks. Only used for debugging. | 66 // Returns the list of all dismissed bookmarks. Only used for debugging. |
67 std::vector<const bookmarks::BookmarkNode*> GetDismissedBookmarksForDebugging( | 67 std::vector<const bookmarks::BookmarkNode*> GetDismissedBookmarksForDebugging( |
68 bookmarks::BookmarkModel* bookmark_model); | 68 bookmarks::BookmarkModel* bookmark_model); |
69 | 69 |
70 // Removes last visited date metadata for all bookmarks. | 70 // Removes last visited date metadata for all bookmarks. |
71 void RemoveAllLastVisitDates(bookmarks::BookmarkModel* bookmark_model); | 71 void RemoveAllLastVisitDates(bookmarks::BookmarkModel* bookmark_model); |
72 | 72 |
73 } // namespace ntp_snippets | 73 } // namespace ntp_snippets |
74 | 74 |
75 #endif // COMPONENTS_NTP_SNIPPETS_BOOKMARKS_BOOKMARK_LAST_VISIT_UTILS_H_ | 75 #endif // COMPONENTS_NTP_SNIPPETS_BOOKMARKS_BOOKMARK_LAST_VISIT_UTILS_H_ |
OLD | NEW |