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

Unified Diff: components/history/core/browser/history_backend.cc

Issue 2338133006: [NTP] Fix article suggestion clicks contributing to Most Visited tiles (Closed)
Patch Set: Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: components/history/core/browser/history_backend.cc
diff --git a/components/history/core/browser/history_backend.cc b/components/history/core/browser/history_backend.cc
index d92049f71f0fd19e42b304c6586d0cde80fb4702..b27507e1350a41869560d9b8955048804099eadc 100644
--- a/components/history/core/browser/history_backend.cc
+++ b/components/history/core/browser/history_backend.cc
@@ -71,6 +71,10 @@ namespace history {
namespace {
+// Referrer used for clicks on article suggestions on the NTP.
+const char kChromeSearchContentSuggestionsReferrer[] =
Marc Treib 2016/09/15 14:31:22 Why "Search"?
mastiz 2016/09/15 14:37:56 Made this consistent with similar definitions in u
Marc Treib 2016/09/15 14:50:55 The local NTP is actually served at the chrome-sea
mastiz 2016/09/15 15:06:16 Done.
+ "https://www.googleapis.com/auth/chrome-content-suggestions";
+
void RunUnlessCanceled(
const base::Closure& closure,
const base::CancelableTaskTracker::IsCanceledCallback& is_canceled) {
@@ -315,6 +319,7 @@ SegmentID HistoryBackend::GetLastSegmentID(VisitID from_visit) {
}
SegmentID HistoryBackend::UpdateSegments(const GURL& url,
+ const GURL& referrer,
VisitID from_visit,
VisitID visit_id,
ui::PageTransition transition_type,
@@ -343,8 +348,9 @@ SegmentID HistoryBackend::UpdateSegments(const GURL& url,
// http://crbug.com/96860 is fixed.
if ((ui::PageTransitionCoreTypeIs(transition_type,
ui::PAGE_TRANSITION_TYPED) ||
- ui::PageTransitionCoreTypeIs(transition_type,
- ui::PAGE_TRANSITION_AUTO_BOOKMARK)) &&
+ (ui::PageTransitionCoreTypeIs(transition_type,
+ ui::PAGE_TRANSITION_AUTO_BOOKMARK) &&
+ referrer != GURL(kChromeSearchContentSuggestionsReferrer))) &&
Bernhard Bauer 2016/09/15 15:10:52 Per https://codereview.chromium.org/2342453003/#ms
mastiz 2016/09/15 15:31:57 The rationale doesn't apply here: we're not trying
Bernhard Bauer 2016/09/15 16:13:07 I would argue there's still a difference between d
(transition_type & ui::PAGE_TRANSITION_FORWARD_BACK) == 0) {
// If so, create or get the segment.
std::string segment_name = db_->ComputeSegmentName(url);
@@ -523,8 +529,8 @@ void HistoryBackend::AddPage(const HistoryAddPageArgs& request) {
// result in changing most visited, so we don't update segments (most
// visited db).
if (!is_keyword_generated) {
- UpdateSegments(request.url, from_visit_id, last_ids.second, t,
- request.time);
+ UpdateSegments(request.url, request.referrer, from_visit_id,
+ last_ids.second, t, request.time);
// Update the referrer's duration.
UpdateVisitDuration(from_visit_id, request.time);
@@ -593,8 +599,8 @@ void HistoryBackend::AddPage(const HistoryAddPageArgs& request) {
last_ids.second, t, request.visit_source);
if (t & ui::PAGE_TRANSITION_CHAIN_START) {
// Update the segment for this visit.
- UpdateSegments(redirects[redirect_index], from_visit_id,
- last_ids.second, t, request.time);
+ UpdateSegments(redirects[redirect_index], request.referrer,
+ from_visit_id, last_ids.second, t, request.time);
// Update the visit_details for this visit.
UpdateVisitDuration(from_visit_id, request.time);

Powered by Google App Engine
This is Rietveld 408576698