Index: components/ntp_snippets/bookmarks/bookmark_last_visit_date_helper.h |
diff --git a/components/ntp_snippets/bookmarks/bookmark_last_visit_date_helper.h b/components/ntp_snippets/bookmarks/bookmark_last_visit_date_helper.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4c226633467230da8b3cf604e1fd9cdab80aa407 |
--- /dev/null |
+++ b/components/ntp_snippets/bookmarks/bookmark_last_visit_date_helper.h |
@@ -0,0 +1,51 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
Marc Treib
2016/07/29 09:54:57
.
jkrcal
2016/07/29 12:42:42
Done.
|
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef COMPONENTS_NTP_SNIPPETS_BOOKMARKS_BOOKMARK_LAST_VISIT_DATE_HELPER_H_ |
+#define COMPONENTS_NTP_SNIPPETS_BOOKMARKS_BOOKMARK_LAST_VISIT_DATE_HELPER_H_ |
+ |
+#include <memory> |
+#include <vector> |
+ |
+#include "base/macros.h" |
+#include "base/time/time.h" |
+#include "components/bookmarks/browser/bookmark_model.h" |
+#include "components/bookmarks/browser/bookmark_node.h" |
+ |
+using bookmarks::BookmarkModel; |
+using bookmarks::BookmarkNode; |
Marc Treib
2016/07/29 09:54:57
No using in headers (you can put them into the .cc
jkrcal
2016/07/29 12:42:42
Done.
|
+ |
+namespace ntp_snippets { |
+ |
+class BookmarkNavigationObserver { |
Marc Treib
2016/07/29 09:54:57
Any reason for the separate observer interface? Th
jkrcal
2016/07/29 12:42:42
Agreed. Not much persuaded this adds any advantage
|
+ public: |
+ virtual void OnURLVisitedInMainFrame(BookmarkModel* bookmark_model, |
+ const GURL& url); |
Marc Treib
2016/07/29 09:54:57
If you do keep the observer, then this should be p
jkrcal
2016/07/29 12:42:42
Done.
|
+}; |
+ |
+// Per-tab class to report visits to bookmarked pages. |
+class BookmarkLastVisitDateHelper |
tschumann
2016/07/29 10:33:00
so, I'd call this class something like LastVisited
Marc Treib
2016/07/29 10:42:22
I think there's no reason for a class at all, sinc
tschumann
2016/07/29 12:38:56
right, if we don't need a class, then a function w
jkrcal
2016/07/29 12:42:42
Done. I still call the component code "_util" to m
|
+ : public BookmarkNavigationObserver { |
+ public: |
+ BookmarkLastVisitDateHelper() = default; |
+ ~BookmarkLastVisitDateHelper() = default; |
+ |
+ void OnURLVisitedInMainFrame(BookmarkModel* bookmark_model, |
Marc Treib
2016/07/29 09:54:57
The bookmark model will always be the same, right?
jkrcal
2016/07/29 12:42:42
Done global functions.
|
+ const GURL& url) override; |
+ |
+ static base::Time GetLastVisitDate(const BookmarkNode* node); |
+ |
+ static void GetRecentlyVisitedBookmarks( |
+ BookmarkModel* bookmark_model, |
+ std::vector<const BookmarkNode*>* bookmarks, |
Marc Treib
2016/07/29 09:54:57
Just return the vector? (Thanks to move semantics,
jkrcal
2016/07/29 12:42:41
Done.
|
+ int max_count, |
+ const base::Time& min_time); |
Marc Treib
2016/07/29 09:54:57
min_visit_time?
jkrcal
2016/07/29 12:42:42
Done.
|
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(BookmarkLastVisitDateHelper); |
+}; |
+ |
+} // namespace ntp_snippets |
+ |
+#endif // COMPONENTS_NTP_SNIPPETS_BOOKMARKS_BOOKMARK_LAST_VISIT_DATE_HELPER_H_ |