Commit 14789b67 authored by Filip Gorski's avatar Filip Gorski Committed by Commit Bot

[EoC] Set appropriate referrer URL for links opened from assistive sheet

Bug: 836851
Change-Id: I6d83b276596cb41770161f40283e6638463cf67d
Reviewed-on: https://chromium-review.googlesource.com/1028377
Commit-Queue: Filip Gorski <fgorski@chromium.org>
Reviewed-by: default avatarTheresa <twellington@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553824}
parent bbd7a3cd
...@@ -45,6 +45,8 @@ import org.chromium.ui.widget.Toast; ...@@ -45,6 +45,8 @@ import org.chromium.ui.widget.Toast;
public class SuggestionsNavigationDelegateImpl implements SuggestionsNavigationDelegate { public class SuggestionsNavigationDelegateImpl implements SuggestionsNavigationDelegate {
private static final String CHROME_CONTENT_SUGGESTIONS_REFERRER = private static final String CHROME_CONTENT_SUGGESTIONS_REFERRER =
"https://www.googleapis.com/auth/chrome-content-suggestions"; "https://www.googleapis.com/auth/chrome-content-suggestions";
private static final String CHROME_CONTEXTUAL_SUGGESTIONS_REFERRER =
"https://goto.google.com/explore-on-content-viewer";
private static final String NEW_TAB_URL_HELP = private static final String NEW_TAB_URL_HELP =
"https://support.google.com/chrome/?p=new_tab"; "https://support.google.com/chrome/?p=new_tab";
...@@ -157,6 +159,13 @@ public class SuggestionsNavigationDelegateImpl implements SuggestionsNavigationD ...@@ -157,6 +159,13 @@ public class SuggestionsNavigationDelegateImpl implements SuggestionsNavigationD
WebReferrerPolicy.ALWAYS)); WebReferrerPolicy.ALWAYS));
} }
// Set appropriate referrer for contextual suggestions to distinguish them from navigation
// from a page.
if (article.mCategory == KnownCategories.CONTEXTUAL) {
loadUrlParams.setReferrer(
new Referrer(CHROME_CONTEXTUAL_SUGGESTIONS_REFERRER, WebReferrerPolicy.ALWAYS));
}
Tab loadingTab = openUrl(windowOpenDisposition, loadUrlParams); Tab loadingTab = openUrl(windowOpenDisposition, loadUrlParams);
if (loadingTab != null) SuggestionsMetrics.recordVisit(loadingTab, article); if (loadingTab != null) SuggestionsMetrics.recordVisit(loadingTab, article);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment