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

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

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, 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 (c) 2012 The Chromium Authors. All rights reserved.
Marc Treib 2016/07/29 09:54:56 Also here
jkrcal 2016/07/29 12:42:41 Done.
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/ntp_bookmark_helper.h"
6
7 #include "components/bookmarks/browser/bookmark_model.h"
8 #include "components/ntp_snippets/bookmarks/bookmark_last_visit_date_helper.h"
9 #include "content/public/browser/navigation_handle.h"
10
11 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ntp_snippets::NTPBookmarkHelper);
12
13 namespace ntp_snippets {
14
15 // static
16 void NTPBookmarkHelper::CreateForWebContentsWithBookmarkModel(
17 content::WebContents* web_contents,
18 BookmarkModel* bookmark_model) {
19 DCHECK(web_contents);
20 web_contents->SetUserData(
21 UserDataKey(), new NTPBookmarkHelper(web_contents, bookmark_model));
22 }
23
24 NTPBookmarkHelper::~NTPBookmarkHelper() {}
25
26 NTPBookmarkHelper::NTPBookmarkHelper(
27 content::WebContents* web_contents,
28 BookmarkModel* bookmark_model)
29 : content::WebContentsObserver(web_contents),
30 bookmark_model_(bookmark_model),
31 navigation_observer_(new BookmarkLastVisitDateHelper) {}
32
33 void NTPBookmarkHelper::DidStartNavigation(
34 content::NavigationHandle* navigation_handle) {
35 if (!navigation_handle->IsInMainFrame() || navigation_handle->IsErrorPage())
36 return;
37 navigation_observer_->OnURLVisitedInMainFrame(bookmark_model_,
38 navigation_handle->GetURL());
39 }
40
41 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698