Chromium Code Reviews| 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..01d37fbb3f3d175315bec509d3e1305227968411 |
| --- /dev/null |
| +++ b/chrome/browser/ntp_snippets/bookmark_last_visit_updater.h |
| @@ -0,0 +1,49 @@ |
| +// 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 |
| + : 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>; |
|
Marc Treib
2016/08/02 13:37:11
nit: empty line before. I also think the friend de
Philipp Keck
2016/08/02 14:06:51
Done.
|
| + |
| + // 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_ |