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 20 matching lines...) Expand all Loading... |
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|. If no info about last visit date is | 37 // only if |consider_visits_from_desktop|. If no info about last visit date is |
38 // present and |creation_date_fallback| is true, the date when the bookmarks is | 38 // present and |creation_date_fallback| is true, the date when the bookmarks is |
39 // created is used as the alst visit date (most likely, it is the date when the | 39 // created is used as the alst visit date (most likely, it is the date when the |
40 // bookmark was synced to this device). | 40 // bookmark was synced to this device). |
41 bool GetLastVisitDateForNTPBookmark(const bookmarks::BookmarkNode* node, | 41 bool GetLastVisitDateForNTPBookmark(const bookmarks::BookmarkNode& node, |
42 bool creation_date_fallback, | 42 bool creation_date_fallback, |
43 bool consider_visits_from_desktop, | 43 bool consider_visits_from_desktop, |
44 base::Time* out); | 44 base::Time* out); |
45 | 45 |
46 // Marks all bookmarks with the given URL as dismissed. | 46 // Marks all bookmarks with the given URL as dismissed. |
47 void MarkBookmarksDismissed(bookmarks::BookmarkModel* bookmark_model, | 47 void MarkBookmarksDismissed(bookmarks::BookmarkModel* bookmark_model, |
48 const GURL& url); | 48 const GURL& url); |
49 | 49 |
50 // Gets the dismissed flag for a given bookmark |node|. Defaults to false. | 50 // Gets the dismissed flag for a given bookmark |node|. Defaults to false. |
51 bool IsDismissedFromNTPForBookmark(const bookmarks::BookmarkNode* node); | 51 bool IsDismissedFromNTPForBookmark(const bookmarks::BookmarkNode& node); |
52 | 52 |
53 // Removes the dismissed flag from all bookmarks (only for debugging). | 53 // Removes the dismissed flag from all bookmarks (only for debugging). |
54 void MarkAllBookmarksUndismissed(bookmarks::BookmarkModel* bookmark_model); | 54 void MarkAllBookmarksUndismissed(bookmarks::BookmarkModel* bookmark_model); |
55 | 55 |
56 // Returns the list of most recently visited, non-dismissed bookmarks. | 56 // Returns the list of most recently visited, non-dismissed bookmarks. |
57 // For each bookmarked URL, it returns the most recently created bookmark. | 57 // For each bookmarked URL, it returns the most recently created bookmark. |
58 // The result is ordered by visit time (the most recent first). Only bookmarks | 58 // The result is ordered by visit time (the most recent first). Only bookmarks |
59 // visited after |min_visit_time| are considered, at most |max_count| bookmarks | 59 // visited after |min_visit_time| are considered, at most |max_count| bookmarks |
60 // are returned. If this results into less than |min_count| bookmarks, the list | 60 // are returned. If this results into less than |min_count| bookmarks, the list |
61 // is filled up with older bookmarks sorted by their last visit / creation date. | 61 // is filled up with older bookmarks sorted by their last visit / creation date. |
(...skipping 11 matching lines...) Expand all Loading... |
73 // Returns the list of all dismissed bookmarks. Only used for debugging. | 73 // Returns the list of all dismissed bookmarks. Only used for debugging. |
74 std::vector<const bookmarks::BookmarkNode*> GetDismissedBookmarksForDebugging( | 74 std::vector<const bookmarks::BookmarkNode*> GetDismissedBookmarksForDebugging( |
75 bookmarks::BookmarkModel* bookmark_model); | 75 bookmarks::BookmarkModel* bookmark_model); |
76 | 76 |
77 // Removes last visited date metadata for all bookmarks. | 77 // Removes last visited date metadata for all bookmarks. |
78 void RemoveAllLastVisitDates(bookmarks::BookmarkModel* bookmark_model); | 78 void RemoveAllLastVisitDates(bookmarks::BookmarkModel* bookmark_model); |
79 | 79 |
80 } // namespace ntp_snippets | 80 } // namespace ntp_snippets |
81 | 81 |
82 #endif // COMPONENTS_NTP_SNIPPETS_BOOKMARKS_BOOKMARK_LAST_VISIT_UTILS_H_ | 82 #endif // COMPONENTS_NTP_SNIPPETS_BOOKMARKS_BOOKMARK_LAST_VISIT_UTILS_H_ |
OLD | NEW |