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

Unified Diff: chrome/browser/ntp_snippets/ntp_bookmark_helper.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: 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/ntp_bookmark_helper.h
diff --git a/chrome/browser/ntp_snippets/ntp_bookmark_helper.h b/chrome/browser/ntp_snippets/ntp_bookmark_helper.h
new file mode 100644
index 0000000000000000000000000000000000000000..79704966dafe50699ea42112baaeedc69e9a72ce
--- /dev/null
+++ b/chrome/browser/ntp_snippets/ntp_bookmark_helper.h
@@ -0,0 +1,59 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
Marc Treib 2016/07/29 09:54:56 What year is it?! Also no "(c)"
jkrcal 2016/07/29 12:42:41 Done.
+// 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_NTP_BOOKMARK_HELPER_H_
+#define CHROME_BROWSER_NTP_SNIPPETS_NTP_BOOKMARK_HELPER_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;
Marc Treib 2016/07/29 09:54:56 nit: class WebContents
jkrcal 2016/07/29 12:42:41 Done. Out of curiosity: Do I need to redeclare it
Marc Treib 2016/07/29 14:36:42 Generally the rule is to include/forward-declare e
jkrcal 2016/07/29 15:34:06 Thanks.
+} // namespace content
+
+using bookmarks::BookmarkModel;
Marc Treib 2016/07/29 09:54:56 No using in headers please
jkrcal 2016/07/29 12:42:41 Done.
+
+namespace ntp_snippets {
Marc Treib 2016/07/29 09:54:56 This shouldn't be in the ntp_snippets namespace; t
jkrcal 2016/07/29 12:42:41 Done.
+
+class BookmarkNavigationObserver;
+
+// A bridge class between platform-specific content::WebContentsObserver and the
+// abstract interface ntp_snippets::BookmarkNavigationObserver.
+class NTPBookmarkHelper
tschumann 2016/07/29 10:18:43 nit: I have an issue with any class or library hav
jkrcal 2016/07/29 12:42:41 Done.
+ : public content::WebContentsObserver,
+ public content::WebContentsUserData<NTPBookmarkHelper> {
+ public:
+ ~NTPBookmarkHelper() override;
+
+ static void CreateForWebContentsWithBookmarkModel(
Marc Treib 2016/07/29 09:54:56 Is this a common pattern? What if there already is
blundell 2016/07/29 09:59:23 drive-by: Yes, this is the common pattern here. We
jkrcal 2016/07/29 12:42:41 Acknowledged.
+ content::WebContents* web_contents,
+ BookmarkModel* bookmark_model);
+
+ private:
+ explicit NTPBookmarkHelper(
+ content::WebContents* web_contents,
+ BookmarkModel* bookmark_model);
+ friend class content::WebContentsUserData<NTPBookmarkHelper>;
+
+ // Overridden from content::WebContentsObserver:
+ void DidStartNavigation(
+ content::NavigationHandle* navigation_handle) override;
+
+ BookmarkModel* bookmark_model_;
+ std::unique_ptr<ntp_snippets::BookmarkNavigationObserver>
+ navigation_observer_;
+
+ DISALLOW_COPY_AND_ASSIGN(NTPBookmarkHelper);
+};
+
+} // namespace ntp_snippets
+
+#endif // CHROME_BROWSER_NTP_SNIPPETS_NTP_BOOKMARK_HELPER_H_
« no previous file with comments | « no previous file | chrome/browser/ntp_snippets/ntp_bookmark_helper.cc » ('j') | chrome/browser/ntp_snippets/ntp_bookmark_helper.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698