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

Unified Diff: content/browser/browser_plugin/browser_plugin_guest.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/browser_plugin/browser_plugin_guest.cc
diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc
index 092a045c62714642a4b6c065a1a139e97ab3f8bd..4c4fd758275c9e6d02c6f186643bdeb4deae0c2a 100644
--- a/content/browser/browser_plugin/browser_plugin_guest.cc
+++ b/content/browser/browser_plugin/browser_plugin_guest.cc
@@ -6,7 +6,6 @@
#include <algorithm>
-#include "base/command_line.h"
#include "base/message_loop/message_loop.h"
#include "base/pickle.h"
#include "base/strings/utf_string_conversions.h"
@@ -38,8 +37,8 @@
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/user_metrics.h"
#include "content/public/browser/web_contents_observer.h"
-#include "content/public/common/content_switches.h"
#include "content/public/common/drop_data.h"
+#include "content/public/common/site_isolation_policy.h"
#include "ui/gfx/geometry/size_conversions.h"
#if defined(OS_MACOSX)
@@ -109,8 +108,7 @@ BrowserPluginGuest::BrowserPluginGuest(bool has_render_view,
}
int BrowserPluginGuest::GetGuestProxyRoutingID() {
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kSitePerProcess)) {
+ if (SiteIsolationPolicy::GuestsShouldUseCrossProcessFrames()) {
// We don't use the proxy to send postMessage in --site-per-process, since
// we use the contentWindow directly from the frame element instead.
return MSG_ROUTING_NONE;
@@ -278,8 +276,7 @@ void BrowserPluginGuest::InitInternal(
if (owner_web_contents_ != owner_web_contents) {
WebContentsViewGuest* new_view = nullptr;
- if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kSitePerProcess)) {
+ if (!SiteIsolationPolicy::GuestsShouldUseCrossProcessFrames()) {
new_view =
static_cast<WebContentsViewGuest*>(GetWebContents()->GetView());
}
@@ -639,8 +636,7 @@ bool BrowserPluginGuest::OnMessageReceived(const IPC::Message& message) {
// TODO(lazyboy): Fix this as part of http://crbug.com/330264. The required
// parts of code from this class should be extracted to a separate class for
// --site-per-process.
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kSitePerProcess)) {
+ if (SiteIsolationPolicy::GuestsShouldUseCrossProcessFrames()) {
return false;
}
@@ -724,12 +720,12 @@ void BrowserPluginGuest::Attach(
void BrowserPluginGuest::OnWillAttachComplete(
WebContentsImpl* embedder_web_contents,
const BrowserPluginHostMsg_Attach_Params& params) {
- bool use_site_per_process = base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kSitePerProcess);
+ bool use_cross_process_frames =
+ SiteIsolationPolicy::GuestsShouldUseCrossProcessFrames();
// If a RenderView has already been created for this new window, then we need
// to initialize the browser-side state now so that the RenderFrameHostManager
// does not create a new RenderView on navigation.
- if (!use_site_per_process && has_render_view_) {
+ if (!use_cross_process_frames && has_render_view_) {
// This will trigger a callback to RenderViewReady after a round-trip IPC.
static_cast<RenderViewHostImpl*>(
GetWebContents()->GetRenderViewHost())->Init();
@@ -749,7 +745,7 @@ void BrowserPluginGuest::OnWillAttachComplete(
delegate_->DidAttach(GetGuestProxyRoutingID());
- if (!use_site_per_process) {
+ if (!use_cross_process_frames) {
has_render_view_ = true;
// Enable input method for guest if it's enabled for the embedder.

Powered by Google App Engine
This is Rietveld 408576698