OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_NTP_SNIPPETS_BOOKMARK_LAST_VISIT_UPDATER_H_ | 5 #ifndef CHROME_BROWSER_NTP_SNIPPETS_BOOKMARK_LAST_VISIT_UPDATER_H_ |
6 #define CHROME_BROWSER_NTP_SNIPPETS_BOOKMARK_LAST_VISIT_UPDATER_H_ | 6 #define CHROME_BROWSER_NTP_SNIPPETS_BOOKMARK_LAST_VISIT_UPDATER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 // A bridge class between platform-specific content::WebContentsObserver and the | 26 // A bridge class between platform-specific content::WebContentsObserver and the |
27 // generic function ntp_snippets::UpdateBookmarkOnURLVisitedInMainFrame(). | 27 // generic function ntp_snippets::UpdateBookmarkOnURLVisitedInMainFrame(). |
28 class BookmarkLastVisitUpdater | 28 class BookmarkLastVisitUpdater |
29 : public content::WebContentsObserver, | 29 : public content::WebContentsObserver, |
30 public content::WebContentsUserData<BookmarkLastVisitUpdater>, | 30 public content::WebContentsUserData<BookmarkLastVisitUpdater>, |
31 public bookmarks::BookmarkModelObserver { | 31 public bookmarks::BookmarkModelObserver { |
32 public: | 32 public: |
33 ~BookmarkLastVisitUpdater() override; | 33 ~BookmarkLastVisitUpdater() override; |
34 | 34 |
35 static void CreateForWebContentsWithBookmarkModel( | 35 static void MaybeCreateForWebContentsWithBookmarkModel( |
36 content::WebContents* web_contents, | 36 content::WebContents* web_contents, |
37 bookmarks::BookmarkModel* bookmark_model); | 37 bookmarks::BookmarkModel* bookmark_model); |
38 | 38 |
39 private: | 39 private: |
40 friend class content::WebContentsUserData<BookmarkLastVisitUpdater>; | 40 friend class content::WebContentsUserData<BookmarkLastVisitUpdater>; |
41 | 41 |
42 BookmarkLastVisitUpdater(content::WebContents* web_contents, | 42 BookmarkLastVisitUpdater(content::WebContents* web_contents, |
43 bookmarks::BookmarkModel* bookmark_model); | 43 bookmarks::BookmarkModel* bookmark_model); |
44 | 44 |
45 // Overridden from BookmarkModelObserver: | 45 // Overridden from BookmarkModelObserver: |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 79 |
80 void NewURLVisited(content::NavigationHandle* navigation_handle); | 80 void NewURLVisited(content::NavigationHandle* navigation_handle); |
81 | 81 |
82 bookmarks::BookmarkModel* bookmark_model_; | 82 bookmarks::BookmarkModel* bookmark_model_; |
83 content::WebContents* web_contents_; | 83 content::WebContents* web_contents_; |
84 | 84 |
85 DISALLOW_COPY_AND_ASSIGN(BookmarkLastVisitUpdater); | 85 DISALLOW_COPY_AND_ASSIGN(BookmarkLastVisitUpdater); |
86 }; | 86 }; |
87 | 87 |
88 #endif // CHROME_BROWSER_NTP_SNIPPETS_BOOKMARK_LAST_VISIT_UPDATER_H_ | 88 #endif // CHROME_BROWSER_NTP_SNIPPETS_BOOKMARK_LAST_VISIT_UPDATER_H_ |
OLD | NEW |