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-10-21 21:52:29 +02:00
|
|
|
index 2dc039f..66e45e2 100644
|
2015-07-16 23:40:01 +02:00
|
|
|
--- browser/browser_plugin/browser_plugin_guest.cc
|
|
|
|
+++ browser/browser_plugin/browser_plugin_guest.cc
|
2016-03-16 03:55:59 +01:00
|
|
|
@@ -28,7 +28,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-10-21 21:52:29 +02:00
|
|
|
@@ -293,20 +293,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;
|
2016-10-21 21:52:29 +02:00
|
|
|
if (!GuestMode::IsCrossProcessFrameGuest(GetWebContents())) {
|
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-10-17 20:14:44 +02:00
|
|
|
@@ -758,11 +757,10 @@ void BrowserPluginGuest::OnWillAttachComplete(
|
2015-12-09 17:10:16 +01:00
|
|
|
->GetWidget()
|
|
|
|
->Init();
|
2016-02-05 01:49:19 +01:00
|
|
|
GetWebContents()->GetMainFrame()->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
|
2016-10-21 21:52:29 +02:00
|
|
|
index 732df23..25dbc62 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 {
|
2016-10-21 21:52:29 +02:00
|
|
|
@@ -36,4 +38,23 @@ bool BrowserPluginGuestDelegate::CanUseCrossProcessFrames() {
|
|
|
|
return true;
|
2015-07-16 23:40:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
+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
|
2016-10-21 21:52:29 +02:00
|
|
|
index 0f805651..fe0385d 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
|