Chromium Code Reviews| 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|. If the bookmark lacks | 30 // Gets the last visit date for a given bookmark |node|. If the bookmark lacks |
| 31 // this info, it returns it creation date. | 31 // this info, it returns it creation date. |
| 32 base::Time GetLastVisitDateForBookmark(const bookmarks::BookmarkNode* node); | 32 base::Time GetLastVisitDateForBookmark(const bookmarks::BookmarkNode* node); |
| 33 | 33 |
| 34 // Like GetLastVisitDateForBookmark, but it returns the unix epoch if the | |
| 35 // bookmark is dismissed from NTP. | |
| 36 base::Time GetLastVisitDateForNotDismissedBookmark( | |
|
Marc Treib
2016/08/11 15:24:54
Hm, not super happy with this name, but I also can
jkrcal
2016/08/11 15:41:35
Better, thanks. Done.
| |
| 37 const bookmarks::BookmarkNode* node); | |
| 38 | |
| 34 // Marks all bookmarks with the given URL as dismissed. | 39 // Marks all bookmarks with the given URL as dismissed. |
| 35 void MarkBookmarksDismissed(bookmarks::BookmarkModel* bookmark_model, | 40 void MarkBookmarksDismissed(bookmarks::BookmarkModel* bookmark_model, |
| 36 const GURL& url); | 41 const GURL& url); |
| 37 | 42 |
| 38 // Gets the dismissed flag for a given bookmark |node|. Defaults to false. | 43 // Gets the dismissed flag for a given bookmark |node|. Defaults to false. |
| 39 bool IsDismissedFromNTPForBookmark(const bookmarks::BookmarkNode* node); | 44 bool IsDismissedFromNTPForBookmark(const bookmarks::BookmarkNode* node); |
| 40 | 45 |
| 41 // Removes the dismissed flag from all bookmarks (only for debugging). | 46 // Removes the dismissed flag from all bookmarks (only for debugging). |
| 42 void MarkAllBookmarksUndismissed(bookmarks::BookmarkModel* bookmark_model); | 47 void MarkAllBookmarksUndismissed(bookmarks::BookmarkModel* bookmark_model); |
| 43 | 48 |
| 44 // Returns the list of most recently visited, non-dismissed bookmarks. | 49 // Returns the list of most recently visited, non-dismissed bookmarks. |
| 45 // For each bookmarked URL, it returns the most recently created bookmark. | 50 // For each bookmarked URL, it returns the most recently created bookmark. |
| 46 // The result is ordered by visit time (the most recent first). Only bookmarks | 51 // The result is ordered by visit time (the most recent first). Only bookmarks |
| 47 // visited after |min_visit_time| are considered, at most |max_count| bookmarks | 52 // visited after |min_visit_time| are considered, at most |max_count| bookmarks |
| 48 // are returned. | 53 // are returned. |
| 49 std::vector<const bookmarks::BookmarkNode*> GetRecentlyVisitedBookmarks( | 54 std::vector<const bookmarks::BookmarkNode*> GetRecentlyVisitedBookmarks( |
| 50 bookmarks::BookmarkModel* bookmark_model, | 55 bookmarks::BookmarkModel* bookmark_model, |
| 51 int max_count, | 56 int max_count, |
| 52 const base::Time& min_visit_time); | 57 const base::Time& min_visit_time); |
| 53 | 58 |
| 54 // Returns the list of all dismissed bookmarks. Only used for debugging. | 59 // Returns the list of all dismissed bookmarks. Only used for debugging. |
| 55 std::vector<const bookmarks::BookmarkNode*> GetDismissedBookmarksForDebugging( | 60 std::vector<const bookmarks::BookmarkNode*> GetDismissedBookmarksForDebugging( |
| 56 bookmarks::BookmarkModel* bookmark_model); | 61 bookmarks::BookmarkModel* bookmark_model); |
| 57 | 62 |
| 58 } // namespace ntp_snippets | 63 } // namespace ntp_snippets |
| 59 | 64 |
| 60 #endif // COMPONENTS_NTP_SNIPPETS_BOOKMARKS_BOOKMARK_LAST_VISIT_UTILS_H_ | 65 #endif // COMPONENTS_NTP_SNIPPETS_BOOKMARKS_BOOKMARK_LAST_VISIT_UTILS_H_ |
| OLD | NEW |