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

Unified Diff: chrome/browser/ntp_snippets/bookmark_last_visit_updater.h

Issue 2184263005: Add a tab helper to record the last visit date for each bookmark. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments #2 Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ntp_snippets/bookmark_last_visit_updater.h
diff --git a/chrome/browser/ntp_snippets/bookmark_last_visit_updater.h b/chrome/browser/ntp_snippets/bookmark_last_visit_updater.h
new file mode 100644
index 0000000000000000000000000000000000000000..ae2c6a34d41c5305d3b84915852bd7dc31e025d9
--- /dev/null
+++ b/chrome/browser/ntp_snippets/bookmark_last_visit_updater.h
@@ -0,0 +1,50 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_NTP_SNIPPETS_BOOKMARK_LAST_VISIT_UPDATER_H_
+#define CHROME_BROWSER_NTP_SNIPPETS_BOOKMARK_LAST_VISIT_UPDATER_H_
+
+#include <memory>
+
+#include "base/macros.h"
+#include "content/public/browser/web_contents_observer.h"
+#include "content/public/browser/web_contents_user_data.h"
+
+namespace bookmarks {
+class BookmarkModel;
+} // namespace bookmarks
+
+namespace content {
+class NavigationHandle;
+class WebContents;
+} // namespace content
+
+// A bridge class between platform-specific content::WebContentsObserver and the
+// generic function ntp_snippets::UpdateBookmarkOnURLVisitedInMainFrame().
+class BookmarkLastVisitUpdater
sky 2016/08/01 15:15:47 Generally we name these classes with TabHelper at
tschumann 2016/08/01 16:57:26 :-) In the initial rounds of the review, we just h
Philipp Keck 2016/08/02 13:05:33 Acknowledged. Leaving as is for the moment, since
+ : public content::WebContentsObserver,
+ public content::WebContentsUserData<BookmarkLastVisitUpdater> {
+ public:
+ ~BookmarkLastVisitUpdater() override;
+
+ static void CreateForWebContentsWithBookmarkModel(
+ content::WebContents* web_contents,
+ bookmarks::BookmarkModel* bookmark_model);
+
+ private:
+ explicit BookmarkLastVisitUpdater(
+ content::WebContents* web_contents,
+ bookmarks::BookmarkModel* bookmark_model);
+ friend class content::WebContentsUserData<BookmarkLastVisitUpdater>;
+
+ // Overridden from content::WebContentsObserver:
+ void DidStartNavigation(
+ content::NavigationHandle* navigation_handle) override;
+
+ bookmarks::BookmarkModel* bookmark_model_;
+
+ DISALLOW_COPY_AND_ASSIGN(BookmarkLastVisitUpdater);
+};
+
+#endif // CHROME_BROWSER_NTP_SNIPPETS_BOOKMARK_LAST_VISIT_UPDATER_H_

Powered by Google App Engine
This is Rietveld 408576698