2015-07-16 23:40:01 +02:00
|
|
|
diff --git browser/browser_plugin/browser_plugin_guest.cc browser/browser_plugin/browser_plugin_guest.cc
|
2016-01-06 20:20:54 +01:00
|
|
|
index 33262a8..5da1220 100644
|
2015-07-16 23:40:01 +02:00
|
|
|
--- browser/browser_plugin/browser_plugin_guest.cc
|
|
|
|
+++ browser/browser_plugin/browser_plugin_guest.cc
|
2016-01-06 20:20:54 +01:00
|
|
|
@@ -27,7 +27,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"
|
2016-01-06 20:20:54 +01:00
|
|
|
@@ -294,20 +294,19 @@ 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;
|
2015-08-14 16:41:08 +02:00
|
|
|
if (!BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) {
|
2015-07-24 02:06:56 +02:00
|
|
|
- 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 =
|
2016-01-06 20:20:54 +01:00
|
|
|
@@ -791,11 +790,10 @@ void BrowserPluginGuest::OnWillAttachComplete(
|
2015-12-09 17:10:16 +01:00
|
|
|
static_cast<RenderViewHostImpl*>(GetWebContents()->GetRenderViewHost())
|
|
|
|
->GetWidget()
|
|
|
|
->Init();
|
2015-07-16 23:40:01 +02:00
|
|
|
- WebContentsViewGuest* web_contents_view =
|
|
|
|
- static_cast<WebContentsViewGuest*>(GetWebContents()->GetView());
|
2015-11-10 21:18:16 +01:00
|
|
|
if (!web_contents()->GetRenderViewHost()->GetWidget()->GetView()) {
|
2015-07-16 23:40:01 +02:00
|
|
|
- web_contents_view->CreateViewForWidget(
|
2015-11-10 21:18:16 +01:00
|
|
|
- web_contents()->GetRenderViewHost()->GetWidget(), true);
|
|
|
|
+ delegate_->CreateViewForWidget(
|
|
|
|
+ GetWebContents()->GetView(),
|
|
|
|
+ web_contents()->GetRenderViewHost()->GetWidget());
|
|
|
|
}
|
2015-07-16 23:40:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
diff --git public/browser/browser_plugin_guest_delegate.cc public/browser/browser_plugin_guest_delegate.cc
|
2015-11-10 21:18:16 +01:00
|
|
|
index bfa19e4..d788495 100644
|
2015-07-16 23:40:01 +02:00
|
|
|
--- 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 {
|
2015-11-10 21:18:16 +01:00
|
|
|
@@ -32,4 +34,23 @@ bool BrowserPluginGuestDelegate::HandleStopFindingForEmbedder(
|
2015-07-16 23:40:01 +02:00
|
|
|
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
|
2015-11-10 21:18:16 +01:00
|
|
|
index 4dd1a4c..b299190 100644
|
2015-07-16 23:40:01 +02:00
|
|
|
--- 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.
|
2015-10-09 17:23:12 +02:00
|
|
|
@@ -87,6 +89,17 @@ class CONTENT_EXPORT BrowserPluginGuestDelegate {
|
2015-07-16 23:40:01 +02:00
|
|
|
// content module.
|
|
|
|
virtual void SetGuestHost(GuestHost* guest_host) {}
|
2015-10-09 17:23:12 +02:00
|
|
|
|
2015-07-16 23:40:01 +02:00
|
|
|
+ // 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);
|
2015-10-09 17:23:12 +02:00
|
|
|
+
|
|
|
|
// Sets the position of the context menu for the guest contents. The value
|
|
|
|
// reported from the guest renderer should be ignored. The reported value
|
|
|
|
// fromt he guest renderer is incorrect in situations where BrowserPlugin is
|