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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chrome_content_browser_client.h" 5 #include "chrome/browser/chrome_content_browser_client.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after
1210 url.SchemeIs(content::kChromeUIScheme) && 1210 url.SchemeIs(content::kChromeUIScheme) &&
1211 url.host_piece() != chrome::kChromeUIChromeSigninHost) { 1211 url.host_piece() != chrome::kChromeUIChromeSigninHost) {
1212 VLOG(1) << "Blocked navigation to " << url.spec() << " from " 1212 VLOG(1) << "Blocked navigation to " << url.spec() << " from "
1213 << chrome::kChromeUIChromeSigninURL; 1213 << chrome::kChromeUIChromeSigninURL;
1214 return false; 1214 return false;
1215 } 1215 }
1216 1216
1217 return true; 1217 return true;
1218 } 1218 }
1219 1219
1220 namespace {
1221
1222 // Returns whether a SiteInstance holds a NTP. TODO(mastiz): This
1223 // really really really needs to be moved to a shared place where all the code
1224 // that needs to know this can access it. See http://crbug.com/624410.
1225 bool IsNTPSiteInstance(SiteInstance* site_instance) {
1226 // While using SiteInstance::GetSiteURL() is unreliable and the wrong thing to
1227 // use for making security decisions 99.44% of the time, for detecting the NTP
1228 // it is reliable and the correct way. Again, see http://crbug.com/624410.
1229 return site_instance &&
1230 site_instance->GetSiteURL().SchemeIs(chrome::kChromeSearchScheme) &&
1231 (site_instance->GetSiteURL().host_piece() ==
1232 chrome::kChromeSearchRemoteNtpHost ||
1233 site_instance->GetSiteURL().host_piece() ==
1234 chrome::kChromeSearchLocalNtpHost);
1235 }
1236
1237 } // namespace
1238
1220 void ChromeContentBrowserClient::OverrideNavigationParams( 1239 void ChromeContentBrowserClient::OverrideNavigationParams(
1221 SiteInstance* site_instance, 1240 SiteInstance* site_instance,
1222 ui::PageTransition* transition, 1241 ui::PageTransition* transition,
1223 bool* is_renderer_initiated, 1242 bool* is_renderer_initiated,
1224 content::Referrer* referrer) { 1243 content::Referrer* referrer) {
1225 DCHECK(transition); 1244 DCHECK(transition);
1226 DCHECK(is_renderer_initiated); 1245 DCHECK(is_renderer_initiated);
1227 DCHECK(referrer); 1246 DCHECK(referrer);
1228 // TODO(crbug.com/624410): Factor the predicate to identify a URL as an NTP 1247 // TODO(crbug.com/624410): Factor the predicate to identify a URL as an NTP
1229 // to a shared library. 1248 // to a shared library.
1230 if (site_instance && 1249 if (IsNTPSiteInstance(site_instance) &&
1231 site_instance->GetSiteURL().SchemeIs(chrome::kChromeSearchScheme) &&
1232 (site_instance->GetSiteURL().host_piece() ==
1233 chrome::kChromeSearchRemoteNtpHost ||
1234 site_instance->GetSiteURL().host_piece() ==
1235 chrome::kChromeSearchLocalNtpHost) &&
1236 ui::PageTransitionCoreTypeIs(*transition, ui::PAGE_TRANSITION_LINK)) { 1250 ui::PageTransitionCoreTypeIs(*transition, ui::PAGE_TRANSITION_LINK)) {
1237 // Use AUTO_BOOKMARK for clicks on tiles of the new tab page, consistently 1251 // Use AUTO_BOOKMARK for clicks on tiles of the new tab page, consistently
1238 // with native implementations like Android's. 1252 // with native implementations like Android's.
1239 *transition = ui::PAGE_TRANSITION_AUTO_BOOKMARK; 1253 *transition = ui::PAGE_TRANSITION_AUTO_BOOKMARK;
1240 *is_renderer_initiated = false; 1254 *is_renderer_initiated = false;
1241 *referrer = content::Referrer(); 1255 *referrer = content::Referrer();
1242 } 1256 }
1243 1257
1244 #if BUILDFLAG(ENABLE_EXTENSIONS) 1258 #if BUILDFLAG(ENABLE_EXTENSIONS)
1245 ChromeContentBrowserClientExtensionsPart::OverrideNavigationParams( 1259 ChromeContentBrowserClientExtensionsPart::OverrideNavigationParams(
1246 site_instance, transition, is_renderer_initiated, referrer); 1260 site_instance, transition, is_renderer_initiated, referrer);
1247 #endif 1261 #endif
1248 } 1262 }
1249 1263
1264 bool ChromeContentBrowserClient::
1265 ShouldFrameShareParentSiteInstanceDespiteTopDocumentIsolation(
1266 const GURL& url,
1267 content::SiteInstance* parent_site_instance) {
1268 return IsNTPSiteInstance(parent_site_instance);
1269 }
1270
1250 bool ChromeContentBrowserClient::IsSuitableHost( 1271 bool ChromeContentBrowserClient::IsSuitableHost(
1251 content::RenderProcessHost* process_host, 1272 content::RenderProcessHost* process_host,
1252 const GURL& site_url) { 1273 const GURL& site_url) {
1253 Profile* profile = 1274 Profile* profile =
1254 Profile::FromBrowserContext(process_host->GetBrowserContext()); 1275 Profile::FromBrowserContext(process_host->GetBrowserContext());
1255 // This may be NULL during tests. In that case, just assume any site can 1276 // This may be NULL during tests. In that case, just assume any site can
1256 // share any host. 1277 // share any host.
1257 if (!profile) 1278 if (!profile)
1258 return true; 1279 return true;
1259 1280
(...skipping 1979 matching lines...) Expand 10 before | Expand all | Expand 10 after
3239 kWebRtcDevSwitchNames, 3260 kWebRtcDevSwitchNames,
3240 arraysize(kWebRtcDevSwitchNames)); 3261 arraysize(kWebRtcDevSwitchNames));
3241 } 3262 }
3242 } 3263 }
3243 #endif // defined(ENABLE_WEBRTC) 3264 #endif // defined(ENABLE_WEBRTC)
3244 3265
3245 std::unique_ptr<content::MemoryCoordinatorDelegate> 3266 std::unique_ptr<content::MemoryCoordinatorDelegate>
3246 ChromeContentBrowserClient::GetMemoryCoordinatorDelegate() { 3267 ChromeContentBrowserClient::GetMemoryCoordinatorDelegate() {
3247 return memory::ChromeMemoryCoordinatorDelegate::Create(); 3268 return memory::ChromeMemoryCoordinatorDelegate::Create();
3248 } 3269 }
OLDNEW
« 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