OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_NTP_SNIPPETS_BOOKMARK_LAST_VISIT_UPDATER_H_ |
| 6 #define CHROME_BROWSER_NTP_SNIPPETS_BOOKMARK_LAST_VISIT_UPDATER_H_ |
| 7 |
| 8 #include <memory> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "content/public/browser/web_contents_observer.h" |
| 12 #include "content/public/browser/web_contents_user_data.h" |
| 13 |
| 14 namespace bookmarks { |
| 15 class BookmarkModel; |
| 16 } // namespace bookmarks |
| 17 |
| 18 namespace content { |
| 19 class NavigationHandle; |
| 20 class WebContents; |
| 21 } // namespace content |
| 22 |
| 23 // A bridge class between platform-specific content::WebContentsObserver and the |
| 24 // generic function ntp_snippets::UpdateBookmarkOnURLVisitedInMainFrame(). |
| 25 class BookmarkLastVisitUpdater |
| 26 : public content::WebContentsObserver, |
| 27 public content::WebContentsUserData<BookmarkLastVisitUpdater> { |
| 28 public: |
| 29 ~BookmarkLastVisitUpdater() override; |
| 30 |
| 31 static void CreateForWebContentsWithBookmarkModel( |
| 32 content::WebContents* web_contents, |
| 33 bookmarks::BookmarkModel* bookmark_model); |
| 34 |
| 35 private: |
| 36 friend class content::WebContentsUserData<BookmarkLastVisitUpdater>; |
| 37 |
| 38 BookmarkLastVisitUpdater(content::WebContents* web_contents, |
| 39 bookmarks::BookmarkModel* bookmark_model); |
| 40 |
| 41 // Overridden from content::WebContentsObserver: |
| 42 void DidStartNavigation( |
| 43 content::NavigationHandle* navigation_handle) override; |
| 44 |
| 45 bookmarks::BookmarkModel* bookmark_model_; |
| 46 |
| 47 DISALLOW_COPY_AND_ASSIGN(BookmarkLastVisitUpdater); |
| 48 }; |
| 49 |
| 50 #endif // CHROME_BROWSER_NTP_SNIPPETS_BOOKMARK_LAST_VISIT_UPDATER_H_ |
OLD | NEW |