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

Unified Diff: chrome/browser/chrome_content_browser_client.cc

Issue 2084953003: Fix clicks on NTP tiles not contributing to Most Visited tiles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments. Created 4 years, 6 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: chrome/browser/chrome_content_browser_client.cc
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index cce6055d14114802396ae3cbd025d6e14eba2cb0..5e0239060d27315eecc46319a47921855dab3f47 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -1154,6 +1154,26 @@ bool ChromeContentBrowserClient::ShouldAllowOpenURL(
return true;
}
+void ChromeContentBrowserClient::OverrideOpenURLParams(
+ const content::SiteInstance* site_instance,
+ content::OpenURLParams* params) {
+ DCHECK(params);
+ if (site_instance &&
+ site_instance->GetSiteURL().SchemeIs(chrome::kChromeSearchScheme) &&
Charlie Reis 2016/06/28 00:52:05 There must be an existing way to check whether a t
mastiz 2016/06/28 08:20:31 Unfortunately there is no such predicate in C++ co
Marc Treib 2016/06/28 08:57:07 Let me add my +1 here. You would indeed think that
Charlie Reis 2016/06/28 17:57:35 Yes, it's unfortunate we don't have something we c
mastiz 2016/06/29 14:20:14 Added a TODO as suggested. Honestly, I don't thin
Charlie Reis 2016/06/29 19:27:00 I posted a comment to the bug, since I think this
+ (site_instance->GetSiteURL().host() ==
+ chrome::kChromeSearchRemoteNtpHost ||
+ site_instance->GetSiteURL().host() ==
+ chrome::kChromeSearchLocalNtpHost) &&
+ ui::PageTransitionCoreTypeIs(params->transition,
+ ui::PAGE_TRANSITION_LINK)) {
+ // Use AUTO_BOOKMARK for clicks on tiles of the new tab page, consistently
+ // with native implementations like Android's.
+ params->transition = ui::PAGE_TRANSITION_AUTO_BOOKMARK;
+ params->is_renderer_initiated = false;
+ params->referrer = content::Referrer();
+ }
+}
+
bool ChromeContentBrowserClient::IsSuitableHost(
content::RenderProcessHost* process_host,
const GURL& site_url) {

Powered by Google App Engine
This is Rietveld 408576698