2015-07-16 23:40:01 +02:00
|
|
|
diff --git browser/browser_plugin/browser_plugin_guest.cc browser/browser_plugin/browser_plugin_guest.cc
|
2015-07-24 02:06:56 +02:00
|
|
|
index 092a045..baea4bb 100644
|
2015-07-16 23:40:01 +02:00
|
|
|
--- browser/browser_plugin/browser_plugin_guest.cc
|
|
|
|
+++ browser/browser_plugin/browser_plugin_guest.cc
|
2015-07-24 02:06:56 +02:00
|
|
|
@@ -23,7 +23,7 @@
|
2015-07-16 23:40:01 +02:00
|
|
|
#include "content/browser/renderer_host/render_widget_host_impl.h"
|
|
|
|
#include "content/browser/renderer_host/render_widget_host_view_base.h"
|
|
|
|
#include "content/browser/web_contents/web_contents_impl.h"
|
|
|
|
-#include "content/browser/web_contents/web_contents_view_guest.h"
|
|
|
|
+#include "content/browser/web_contents/web_contents_view.h"
|
|
|
|
#include "content/common/browser_plugin/browser_plugin_constants.h"
|
|
|
|
#include "content/common/browser_plugin/browser_plugin_messages.h"
|
|
|
|
#include "content/common/content_constants_internal.h"
|
2015-07-24 02:06:56 +02:00
|
|
|
@@ -277,21 +277,20 @@ void BrowserPluginGuest::InitInternal(
|
2015-07-16 23:40:01 +02:00
|
|
|
guest_window_rect_ = params.view_rect;
|
|
|
|
|
|
|
|
if (owner_web_contents_ != owner_web_contents) {
|
2015-07-24 02:06:56 +02:00
|
|
|
- WebContentsViewGuest* new_view = nullptr;
|
|
|
|
+ WebContentsView* new_view = nullptr;
|
|
|
|
if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
|
|
|
|
switches::kSitePerProcess)) {
|
|
|
|
- new_view =
|
|
|
|
- static_cast<WebContentsViewGuest*>(GetWebContents()->GetView());
|
|
|
|
+ new_view = GetWebContents()->GetView();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (owner_web_contents_ && new_view)
|
2015-07-16 23:40:01 +02:00
|
|
|
- new_view->OnGuestDetached(owner_web_contents_->GetView());
|
2015-07-24 02:06:56 +02:00
|
|
|
+ delegate_->OnGuestDetached(new_view, owner_web_contents_->GetView());
|
2015-07-16 23:40:01 +02:00
|
|
|
|
|
|
|
// Once a BrowserPluginGuest has an embedder WebContents, it's considered to
|
|
|
|
// be attached.
|
|
|
|
owner_web_contents_ = owner_web_contents;
|
2015-07-24 02:06:56 +02:00
|
|
|
if (new_view)
|
|
|
|
- new_view->OnGuestAttached(owner_web_contents_->GetView());
|
|
|
|
+ delegate_->OnGuestAttached(new_view, owner_web_contents_->GetView());
|
2015-07-16 23:40:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
RendererPreferences* renderer_prefs =
|
2015-07-24 02:06:56 +02:00
|
|
|
@@ -733,12 +732,9 @@ void BrowserPluginGuest::OnWillAttachComplete(
|
2015-07-16 23:40:01 +02:00
|
|
|
// This will trigger a callback to RenderViewReady after a round-trip IPC.
|
|
|
|
static_cast<RenderViewHostImpl*>(
|
|
|
|
GetWebContents()->GetRenderViewHost())->Init();
|
|
|
|
- WebContentsViewGuest* web_contents_view =
|
|
|
|
- static_cast<WebContentsViewGuest*>(GetWebContents()->GetView());
|
|
|
|
- if (!web_contents()->GetRenderViewHost()->GetView()) {
|
|
|
|
- web_contents_view->CreateViewForWidget(
|
|
|
|
- web_contents()->GetRenderViewHost(), true);
|
|
|
|
- }
|
|
|
|
+ if (!web_contents()->GetRenderViewHost()->GetView())
|
|
|
|
+ delegate_->CreateViewForWidget(GetWebContents()->GetView(),
|
|
|
|
+ web_contents()->GetRenderViewHost());
|
|
|
|
}
|
|
|
|
|
|
|
|
InitInternal(params, embedder_web_contents);
|
|
|
|
diff --git public/browser/browser_plugin_guest_delegate.cc public/browser/browser_plugin_guest_delegate.cc
|
|
|
|
index fd7dec4..49d4f99 100644
|
|
|
|
--- public/browser/browser_plugin_guest_delegate.cc
|
|
|
|
+++ public/browser/browser_plugin_guest_delegate.cc
|
|
|
|
@@ -4,6 +4,8 @@
|
|
|
|
|
|
|
|
#include "content/public/browser/browser_plugin_guest_delegate.h"
|
|
|
|
|
|
|
|
+#include "content/browser/web_contents/web_contents_view_guest.h"
|
|
|
|
+
|
|
|
|
namespace content {
|
|
|
|
|
|
|
|
bool BrowserPluginGuestDelegate::CanRunInDetachedState() const {
|
|
|
|
@@ -30,4 +32,23 @@ bool BrowserPluginGuestDelegate::StopFinding(StopFindAction action) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
+void BrowserPluginGuestDelegate::OnGuestAttached(
|
|
|
|
+ content::WebContentsView* guest_view,
|
|
|
|
+ content::WebContentsView* parent_view) {
|
|
|
|
+ static_cast<WebContentsViewGuest*>(guest_view)->OnGuestAttached(parent_view);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void BrowserPluginGuestDelegate::OnGuestDetached(
|
|
|
|
+ content::WebContentsView* guest_view,
|
|
|
|
+ content::WebContentsView* parent_view) {
|
|
|
|
+ static_cast<WebContentsViewGuest*>(guest_view)->OnGuestAttached(parent_view);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void BrowserPluginGuestDelegate::CreateViewForWidget(
|
|
|
|
+ content::WebContentsView* guest_view,
|
|
|
|
+ content::RenderWidgetHost* render_widget_host) {
|
|
|
|
+ static_cast<WebContentsViewGuest*>(guest_view)->CreateViewForWidget(
|
|
|
|
+ render_widget_host, true);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
} // namespace content
|
|
|
|
diff --git public/browser/browser_plugin_guest_delegate.h public/browser/browser_plugin_guest_delegate.h
|
|
|
|
index 000e3b6..ced8765 100644
|
|
|
|
--- public/browser/browser_plugin_guest_delegate.h
|
|
|
|
+++ public/browser/browser_plugin_guest_delegate.h
|
|
|
|
@@ -21,6 +21,8 @@ class Size;
|
|
|
|
namespace content {
|
|
|
|
|
|
|
|
class GuestHost;
|
|
|
|
+class RenderWidgetHost;
|
|
|
|
+class WebContentsView;
|
|
|
|
|
|
|
|
// Objects implement this interface to get notified about changes in the guest
|
|
|
|
// WebContents and to provide necessary functionality.
|
|
|
|
@@ -86,6 +88,17 @@ class CONTENT_EXPORT BrowserPluginGuestDelegate {
|
|
|
|
// Provides the delegate with an interface with which to communicate with the
|
|
|
|
// content module.
|
|
|
|
virtual void SetGuestHost(GuestHost* guest_host) {}
|
|
|
|
+
|
|
|
|
+ // Called when a guest is attached or detached.
|
|
|
|
+ virtual void OnGuestAttached(content::WebContentsView* guest_view,
|
|
|
|
+ content::WebContentsView* parent_view);
|
|
|
|
+ virtual void OnGuestDetached(content::WebContentsView* guest_view,
|
|
|
|
+ content::WebContentsView* parent_view);
|
|
|
|
+
|
|
|
|
+ // Called to create the view for the widget.
|
|
|
|
+ virtual void CreateViewForWidget(
|
|
|
|
+ content::WebContentsView* guest_view,
|
|
|
|
+ content::RenderWidgetHost* render_widget_host);
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace content
|