electron/patches/chromium/web_contents.patch
John Kleinschmidt 9f5e3f6685 Update patches
2021-03-16 10:01:00 -04:00

62 lines
2.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: deepak1556 <hop2deep@gmail.com>
Date: Wed, 27 Jan 2021 15:11:19 -0800
Subject: web_contents.patch
This allows overriding the RenderViewHostDelegateView of a WebContents, which
is needed for OSR.
Originally landed in https://github.com/electron/libchromiumcontent/pull/226.
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 3311b6110666851b3946ebf8071f210752425695..b5750a26185df8deed608e5d1bda8479d4a54aac 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -2764,6 +2764,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
frame_tree_.Init(site_instance.get(), params.renderer_initiated_creation,
params.main_frame_name, params.is_prerendering);
+ if (params.view && params.delegate_view) {
+ view_.reset(params.view);
+ render_view_host_delegate_view_ = params.delegate_view;
+ }
+
+ if (!view_) {
WebContentsViewDelegate* delegate =
GetContentClient()->browser()->GetWebContentsViewDelegate(this);
@@ -2774,6 +2780,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
view_.reset(CreateWebContentsView(this, delegate,
&render_view_host_delegate_view_));
}
+ } // !view_
CHECK(render_view_host_delegate_view_);
CHECK(view_.get());
diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h
index b48367e41a8d4f0fa73dd33103e5eb796d8880a9..d6833aeaa09af7d0ec6937db7a1cca051aebe43e 100644
--- a/content/public/browser/web_contents.h
+++ b/content/public/browser/web_contents.h
@@ -87,8 +87,11 @@ class BrowserContext;
class BrowserPluginGuestDelegate;
class RenderFrameHost;
class RenderViewHost;
+class RenderViewHostDelegateView;
class RenderWidgetHostView;
+class RenderWidgetHostViewBase;
class WebContentsDelegate;
+class WebContentsView;
class WebUI;
struct DropData;
struct MHTMLGenerationParams;
@@ -228,6 +231,10 @@ class WebContents : public PageNavigator,
// Sandboxing flags set on the new WebContents.
network::mojom::WebSandboxFlags starting_sandbox_flags;
+ // Optionally specify the view and delegate view.
+ content::WebContentsView* view = nullptr;
+ content::RenderViewHostDelegateView* delegate_view = nullptr;
+
// Value used to set the last time the WebContents was made active, this is
// the value that'll be returned by GetLastActiveTime(). If this is left
// default initialized then the value is not passed on to the WebContents