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

Unified Diff: content/browser/web_contents/web_contents_impl.cc

Issue 1208143002: Move existing kSitePerProcess checks to a policy-oracle object (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@swapped_out_cmdline_checks
Patch Set: Partial fixes to Nasko's comments. Created 5 years, 5 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: content/browser/web_contents/web_contents_impl.cc
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index d1a5260ed8d53fe55cd41c6fe4a1c3374ea967dc..64a74ca4fd83eea0e67da52d06aafc521fcfa22e 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -94,6 +94,7 @@
#include "content/public/common/page_zoom.h"
#include "content/public/common/result_codes.h"
#include "content/public/common/security_style.h"
+#include "content/public/common/site_isolation_policy.h"
#include "content/public/common/url_constants.h"
#include "content/public/common/url_utils.h"
#include "content/public/common/web_preferences.h"
@@ -1217,8 +1218,7 @@ void WebContentsImpl::DispatchBeforeUnload(bool for_cross_site_transition) {
void WebContentsImpl::AttachToOuterWebContentsFrame(
WebContents* outer_web_contents,
RenderFrameHost* outer_contents_frame) {
- CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kSitePerProcess));
+ CHECK(SiteIsolationPolicy::GuestsShouldUseCrossProcessFrames());
// Create a link to our outer WebContents.
node_.reset(new WebContentsTreeNode());
node_->ConnectToOuterWebContents(
@@ -1312,8 +1312,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
GetContentClient()->browser()->GetWebContentsViewDelegate(this);
if (browser_plugin_guest_ &&
- !base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kSitePerProcess)) {
+ !SiteIsolationPolicy::GuestsShouldUseCrossProcessFrames()) {
scoped_ptr<WebContentsView> platform_view(CreateWebContentsView(
this, delegate, &render_view_host_delegate_view_));
@@ -1614,9 +1613,7 @@ void WebContentsImpl::CreateNewWindow(
// SiteInstance in its own BrowsingInstance.
bool is_guest = BrowserPluginGuest::IsGuest(this);
- if (is_guest &&
- base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kSitePerProcess)) {
+ if (is_guest && SiteIsolationPolicy::GuestsShouldUseCrossProcessFrames()) {
// TODO(lazyboy): CreateNewWindow doesn't work for OOPIF-based <webview>
// yet.
NOTREACHED();
@@ -4001,8 +3998,7 @@ void WebContentsImpl::EnsureOpenerProxiesExist(RenderFrameHost* source_rfh) {
// then we should not create a RenderView. AttachToOuterWebContentsFrame()
// already created a RenderFrameProxyHost for that purpose.
if (GetBrowserPluginEmbedder() &&
- base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kSitePerProcess)) {
+ SiteIsolationPolicy::GuestsShouldUseCrossProcessFrames()) {
return;
}
@@ -4227,8 +4223,7 @@ bool WebContentsImpl::CreateRenderViewForRenderManager(
// frame RWHVs are unique in that they do not have their own WebContents.
bool is_guest_in_site_per_process =
!!browser_plugin_guest_.get() &&
- base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kSitePerProcess);
+ SiteIsolationPolicy::GuestsShouldUseCrossProcessFrames();
if (!for_main_frame_navigation || is_guest_in_site_per_process) {
RenderWidgetHostViewChildFrame* rwh_view_child =
new RenderWidgetHostViewChildFrame(render_view_host);

Powered by Google App Engine
This is Rietveld 408576698