2018-10-24 18:24:11 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2018-09-21 00:30:26 +00:00
|
|
|
From: Anonymous <anonymous@electronjs.org>
|
|
|
|
Date: Thu, 20 Sep 2018 17:46:53 -0700
|
|
|
|
Subject: web_contents.patch
|
|
|
|
|
2019-12-13 17:18:45 +00:00
|
|
|
This allows overriding the RenderViewHostDelegateView of a WebContents, which
|
|
|
|
is needed for OSR.
|
|
|
|
|
|
|
|
Originally landed in https://github.com/electron/libchromiumcontent/pull/226.
|
2018-09-21 00:30:26 +00:00
|
|
|
|
2018-09-14 05:02:16 +00:00
|
|
|
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
|
2019-12-11 00:22:35 +00:00
|
|
|
index d2697ed312a79c4e417bee7d613be4e349ca5819..49883d5a30b62e298a64349eeda5cddc4f339fd6 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/content/browser/web_contents/web_contents_impl.cc
|
|
|
|
+++ b/content/browser/web_contents/web_contents_impl.cc
|
2019-12-11 00:22:35 +00:00
|
|
|
@@ -2030,6 +2030,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
|
2018-09-14 05:02:16 +00:00
|
|
|
std::string unique_name;
|
|
|
|
frame_tree_.root()->SetFrameName(params.main_frame_name, unique_name);
|
|
|
|
|
|
|
|
+ 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);
|
|
|
|
|
2019-12-11 00:22:35 +00:00
|
|
|
@@ -2040,6 +2046,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
|
|
|
|
view_.reset(CreateWebContentsView(this, delegate,
|
|
|
|
&render_view_host_delegate_view_));
|
2018-09-14 05:02:16 +00:00
|
|
|
}
|
|
|
|
+ } // !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
|
2019-12-11 00:22:35 +00:00
|
|
|
index ecee31b744ed0871a9f1052d5419075582a90baa..0ce547c74610e13f7f723da997fb0a9799c96efb 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/content/public/browser/web_contents.h
|
|
|
|
+++ b/content/public/browser/web_contents.h
|
2019-09-18 19:58:00 +00:00
|
|
|
@@ -79,9 +79,12 @@ class BrowserPluginGuestDelegate;
|
2018-09-14 05:02:16 +00:00
|
|
|
class InterstitialPage;
|
|
|
|
class RenderFrameHost;
|
|
|
|
class RenderViewHost;
|
|
|
|
+class RenderViewHostDelegateView;
|
|
|
|
class RenderWidgetHost;
|
|
|
|
class RenderWidgetHostView;
|
|
|
|
+class RenderWidgetHostViewBase;
|
|
|
|
class WebContentsDelegate;
|
|
|
|
+class WebContentsView;
|
|
|
|
struct CustomContextMenuContext;
|
|
|
|
struct DropData;
|
2018-09-14 18:03:43 +00:00
|
|
|
struct MHTMLGenerationParams;
|
2019-07-24 22:58:51 +00:00
|
|
|
@@ -214,6 +217,10 @@ class WebContents : public PageNavigator,
|
2018-09-14 18:03:43 +00:00
|
|
|
kInitializeAndWarmupRendererProcess,
|
|
|
|
} desired_renderer_state;
|
2018-09-14 05:02:16 +00:00
|
|
|
|
|
|
|
+ // Optionally specify the view and delegate view.
|
|
|
|
+ content::WebContentsView* view = nullptr;
|
|
|
|
+ content::RenderViewHostDelegateView* delegate_view = nullptr;
|
|
|
|
+
|
|
|
|
// Sandboxing flags set on the new WebContents.
|
|
|
|
blink::WebSandboxFlags starting_sandbox_flags;
|
2018-09-21 00:30:26 +00:00
|
|
|
|