Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(827)

Side by Side Diff: components/ntp_snippets/bookmarks/bookmark_last_visit_utils.h

Issue 2234393002: Marking last_visited date for bookmarks created from an open tab (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Marc's comments Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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;
11 11
12 namespace base { 12 namespace base {
13 class Time; 13 class Time;
14 } // namespace base 14 } // namespace base
15 15
16 namespace bookmarks { 16 namespace bookmarks {
17 class BookmarkModel; 17 class BookmarkModel;
18 class BookmarkNode; 18 class BookmarkNode;
19 } // namespace bookmarks 19 } // namespace bookmarks
20 20
21 namespace ntp_snippets { 21 namespace ntp_snippets {
22 22
23 // If there is a bookmark for |url|, this function updates its last visit date 23 // If there is a bookmark for |url|, this function updates its last visit date
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|. The visit when the
31 // this info, it returns it creation date. 31 // bookmark is created also counts.
32 base::Time GetLastVisitDateForBookmark(const bookmarks::BookmarkNode* node); 32 base::Time GetLastVisitDateForBookmark(const bookmarks::BookmarkNode* node);
33 33
34 // Marks all bookmarks with the given URL as dismissed. 34 // Marks all bookmarks with the given URL as dismissed.
35 void MarkBookmarksDismissed(bookmarks::BookmarkModel* bookmark_model, 35 void MarkBookmarksDismissed(bookmarks::BookmarkModel* bookmark_model,
36 const GURL& url); 36 const GURL& url);
37 37
38 // Gets the dismissed flag for a given bookmark |node|. Defaults to false. 38 // Gets the dismissed flag for a given bookmark |node|. Defaults to false.
39 bool IsDismissedFromNTPForBookmark(const bookmarks::BookmarkNode* node); 39 bool IsDismissedFromNTPForBookmark(const bookmarks::BookmarkNode* node);
40 40
41 // Removes the dismissed flag from all bookmarks (only for debugging). 41 // Removes the dismissed flag from all bookmarks (only for debugging).
42 void MarkAllBookmarksUndismissed(bookmarks::BookmarkModel* bookmark_model); 42 void MarkAllBookmarksUndismissed(bookmarks::BookmarkModel* bookmark_model);
43 43
44 // Returns the list of most recently visited, non-dismissed bookmarks. 44 // Returns the list of most recently visited, non-dismissed bookmarks.
45 // For each bookmarked URL, it returns the most recently created bookmark. 45 // 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 46 // 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 47 // visited after |min_visit_time| are considered, at most |max_count| bookmarks
48 // are returned. 48 // are returned.
49 std::vector<const bookmarks::BookmarkNode*> GetRecentlyVisitedBookmarks( 49 std::vector<const bookmarks::BookmarkNode*> GetRecentlyVisitedBookmarks(
50 bookmarks::BookmarkModel* bookmark_model, 50 bookmarks::BookmarkModel* bookmark_model,
51 int max_count, 51 int max_count,
52 const base::Time& min_visit_time); 52 const base::Time& min_visit_time);
53 53
54 // Returns the list of all dismissed bookmarks. Only used for debugging. 54 // Returns the list of all dismissed bookmarks. Only used for debugging.
55 std::vector<const bookmarks::BookmarkNode*> GetDismissedBookmarksForDebugging( 55 std::vector<const bookmarks::BookmarkNode*> GetDismissedBookmarksForDebugging(
56 bookmarks::BookmarkModel* bookmark_model); 56 bookmarks::BookmarkModel* bookmark_model);
57 57
58 } // namespace ntp_snippets 58 } // namespace ntp_snippets
59 59
60 #endif // COMPONENTS_NTP_SNIPPETS_BOOKMARKS_BOOKMARK_LAST_VISIT_UTILS_H_ 60 #endif // COMPONENTS_NTP_SNIPPETS_BOOKMARKS_BOOKMARK_LAST_VISIT_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698