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); |