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

Unified Diff: chrome/browser/chrome_content_browser_client.cc

Issue 2499313002: Don't split off NTP subframes with TDI. (Closed)
Patch Set: updates Created 4 years, 1 month 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 274354ae57b659010e0dd2897f50aa308e4e9316..23fc3624b050b19bf5f3af1a3fd8f7aec63bbb71 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -1217,6 +1217,25 @@ bool ChromeContentBrowserClient::ShouldAllowOpenURL(
return true;
}
+namespace {
+
+// Returns whether a SiteInstance holds a NTP. TODO(mastiz): This
+// really really really needs to be moved to a shared place where all the code
+// that needs to know this can access it. See http://crbug.com/624410.
+bool IsNTPSiteInstance(SiteInstance* site_instance) {
+ // While using SiteInstance::GetSiteURL() is unreliable and the wrong thing to
+ // use for making security decisions 99.44% of the time, for detecting the NTP
+ // it is reliable and the correct way. Again, see http://crbug.com/624410.
+ return site_instance &&
+ site_instance->GetSiteURL().SchemeIs(chrome::kChromeSearchScheme) &&
+ (site_instance->GetSiteURL().host_piece() ==
+ chrome::kChromeSearchRemoteNtpHost ||
+ site_instance->GetSiteURL().host_piece() ==
+ chrome::kChromeSearchLocalNtpHost);
+}
+
+} // namespace
+
void ChromeContentBrowserClient::OverrideNavigationParams(
SiteInstance* site_instance,
ui::PageTransition* transition,
@@ -1227,12 +1246,7 @@ void ChromeContentBrowserClient::OverrideNavigationParams(
DCHECK(referrer);
// TODO(crbug.com/624410): Factor the predicate to identify a URL as an NTP
// to a shared library.
- if (site_instance &&
- site_instance->GetSiteURL().SchemeIs(chrome::kChromeSearchScheme) &&
- (site_instance->GetSiteURL().host_piece() ==
- chrome::kChromeSearchRemoteNtpHost ||
- site_instance->GetSiteURL().host_piece() ==
- chrome::kChromeSearchLocalNtpHost) &&
+ if (IsNTPSiteInstance(site_instance) &&
ui::PageTransitionCoreTypeIs(*transition, ui::PAGE_TRANSITION_LINK)) {
// Use AUTO_BOOKMARK for clicks on tiles of the new tab page, consistently
// with native implementations like Android's.
@@ -1247,6 +1261,13 @@ void ChromeContentBrowserClient::OverrideNavigationParams(
#endif
}
+bool ChromeContentBrowserClient::
+ ShouldFrameShareParentSiteInstanceDespiteTopDocumentIsolation(
+ const GURL& url,
+ content::SiteInstance* parent_site_instance) {
+ return IsNTPSiteInstance(parent_site_instance);
+}
+
bool ChromeContentBrowserClient::IsSuitableHost(
content::RenderProcessHost* process_host,
const GURL& site_url) {
« no previous file with comments | « chrome/browser/chrome_content_browser_client.h ('k') | content/browser/frame_host/render_frame_host_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698