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

Side by Side Diff: chrome/browser/ntp_snippets/bookmark_last_visit_updater.cc

Issue 2200113002: [New CL] 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: Remove unnecessary explicit Created 4 years, 4 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 unified diff | Download patch
OLDNEW
(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 #include "chrome/browser/ntp_snippets/bookmark_last_visit_updater.h"
6
7 #include "components/ntp_snippets/bookmarks/bookmark_last_visit_utils.h"
8 #include "content/public/browser/navigation_handle.h"
9
10 DEFINE_WEB_CONTENTS_USER_DATA_KEY(BookmarkLastVisitUpdater);
11
12 BookmarkLastVisitUpdater::~BookmarkLastVisitUpdater() {}
13
14 // static
15 void BookmarkLastVisitUpdater::CreateForWebContentsWithBookmarkModel(
16 content::WebContents* web_contents,
17 bookmarks::BookmarkModel* bookmark_model) {
18 web_contents->SetUserData(UserDataKey(), new BookmarkLastVisitUpdater(
19 web_contents, bookmark_model));
20 }
21
22 BookmarkLastVisitUpdater::BookmarkLastVisitUpdater(
23 content::WebContents* web_contents,
24 bookmarks::BookmarkModel* bookmark_model)
25 : content::WebContentsObserver(web_contents),
26 bookmark_model_(bookmark_model) {}
27
28 void BookmarkLastVisitUpdater::DidStartNavigation(
29 content::NavigationHandle* navigation_handle) {
30 if (!navigation_handle->IsInMainFrame() || navigation_handle->IsErrorPage())
31 return;
32 ntp_snippets::UpdateBookmarkOnURLVisitedInMainFrame(
33 bookmark_model_, navigation_handle->GetURL());
34 }
OLDNEW
« no previous file with comments | « chrome/browser/ntp_snippets/bookmark_last_visit_updater.h ('k') | chrome/browser/ui/tab_helpers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698