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 3f3d7cad9134af58a64b6fa8127542e92ed0f21c..00908da9375ea996ed33f0bb33165ee56eb30246 100644 |
--- a/content/browser/browser_plugin/browser_plugin_guest.cc |
+++ b/content/browser/browser_plugin/browser_plugin_guest.cc |
@@ -2,10 +2,13 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
+// Note that all IPC sent out from this class will be dropped on the |
+// floor b/c we don't have a BrowserPlugin anymore. |
Charlie Reis
2015/04/30 23:06:45
Class-level comments belong on the class declarati
lazyboy
2015/05/05 07:28:13
Done.
|
#include "content/browser/browser_plugin/browser_plugin_guest.h" |
#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" |
@@ -35,6 +38,7 @@ |
#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 "ui/gfx/geometry/size_conversions.h" |
@@ -103,6 +107,12 @@ BrowserPluginGuest::BrowserPluginGuest(bool has_render_view, |
} |
int BrowserPluginGuest::GetGuestProxyRoutingID() { |
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kSitePerProcess)) { |
+ // Don't create the proxy here, we'll create it later. |
Charlie Reis
2015/04/30 23:06:45
nit: Semi-colon or period. (In general, two compl
lazyboy
2015/05/05 07:28:13
Done.
|
+ return MSG_ROUTING_NONE; |
+ } |
+ |
if (guest_proxy_routing_id_ != MSG_ROUTING_NONE) |
return guest_proxy_routing_id_; |
@@ -263,14 +273,18 @@ void BrowserPluginGuest::InitInternal( |
if (owner_web_contents_ != owner_web_contents) { |
WebContentsViewGuest* new_view = |
- static_cast<WebContentsViewGuest*>(GetWebContents()->GetView()); |
- if (owner_web_contents_) |
+ base::CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kSitePerProcess) ? |
+ nullptr : |
+ static_cast<WebContentsViewGuest*>(GetWebContents()->GetView()); |
Charlie Reis
2015/04/30 23:06:45
Wrong indent? git cl format can help.
lazyboy
2015/05/05 07:28:13
Done.
|
+ if (owner_web_contents_ && new_view) |
new_view->OnGuestDetached(owner_web_contents_->GetView()); |
// Once a BrowserPluginGuest has an embedder WebContents, it's considered to |
// be attached. |
owner_web_contents_ = owner_web_contents; |
- new_view->OnGuestAttached(owner_web_contents_->GetView()); |
+ if (new_view) |
+ new_view->OnGuestAttached(owner_web_contents_->GetView()); |
} |
RendererPreferences* renderer_prefs = |
@@ -652,10 +666,13 @@ void BrowserPluginGuest::Attach( |
delegate_->WillAttach(embedder_web_contents, browser_plugin_instance_id, |
params.is_full_page_plugin); |
+ bool use_site_per_process = |
+ base::CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kSitePerProcess); |
// 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 (has_render_view_) { |
+ if (!use_site_per_process && has_render_view_) { |
// This will trigger a callback to RenderViewReady after a round-trip IPC. |
static_cast<RenderViewHostImpl*>( |
GetWebContents()->GetRenderViewHost())->Init(); |
@@ -674,14 +691,16 @@ void BrowserPluginGuest::Attach( |
delegate_->DidAttach(GetGuestProxyRoutingID()); |
- has_render_view_ = true; |
+ if (!use_site_per_process) { |
+ has_render_view_ = true; |
- // Enable input method for guest if it's enabled for the embedder. |
- if (static_cast<RenderViewHostImpl*>( |
- owner_web_contents_->GetRenderViewHost())->input_method_active()) { |
- RenderViewHostImpl* guest_rvh = static_cast<RenderViewHostImpl*>( |
- GetWebContents()->GetRenderViewHost()); |
- guest_rvh->SetInputMethodActive(true); |
+ // Enable input method for guest if it's enabled for the embedder. |
+ if (static_cast<RenderViewHostImpl*>( |
+ owner_web_contents_->GetRenderViewHost())->input_method_active()) { |
+ RenderViewHostImpl* guest_rvh = static_cast<RenderViewHostImpl*>( |
+ GetWebContents()->GetRenderViewHost()); |
+ guest_rvh->SetInputMethodActive(true); |
+ } |
} |
RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.Attached")); |