2018-10-24 18:24:11 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2020-04-13 23:39:26 +00:00
|
|
|
From: deepak1556 <hop2deep@gmail.com>
|
2021-04-27 21:27:34 +00:00
|
|
|
Date: Sat, 24 Apr 2021 18:07:09 -0700
|
2018-09-21 00:30:26 +00:00
|
|
|
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
|
2023-08-04 08:47:29 +00:00
|
|
|
index a32f963654763cc0c706f752eca96e8cf5d0be54..998357b01a55def3d9c1e37d09f52d61b5ecd6f2 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
|
2023-07-31 17:47:32 +00:00
|
|
|
@@ -3314,6 +3314,13 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params,
|
2022-11-17 19:59:23 +00:00
|
|
|
params.main_frame_name, GetOpener(), primary_main_frame_policy,
|
|
|
|
base::UnguessableToken::Create());
|
2018-09-14 05:02:16 +00:00
|
|
|
|
|
|
|
+ if (params.view && params.delegate_view) {
|
|
|
|
+ view_.reset(params.view);
|
|
|
|
+ render_view_host_delegate_view_ = params.delegate_view;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!view_) {
|
2022-01-10 22:31:39 +00:00
|
|
|
+
|
2022-05-17 16:48:40 +00:00
|
|
|
std::unique_ptr<WebContentsViewDelegate> delegate =
|
2018-09-14 05:02:16 +00:00
|
|
|
GetContentClient()->browser()->GetWebContentsViewDelegate(this);
|
|
|
|
|
2023-07-31 17:47:32 +00:00
|
|
|
@@ -3324,6 +3331,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params,
|
2022-05-17 16:48:40 +00:00
|
|
|
view_ = CreateWebContentsView(this, std::move(delegate),
|
|
|
|
&render_view_host_delegate_view_);
|
2018-09-14 05:02:16 +00:00
|
|
|
}
|
2021-02-09 20:16:21 +00:00
|
|
|
+ } // !view_
|
2018-09-14 05:02:16 +00:00
|
|
|
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
|
2023-08-04 08:47:29 +00:00
|
|
|
index f80a1a82e14a0c9f6c43897e649b60a87f5f5aa6..a58eb20fdd278fac7f89862a4817cbf57c6a0381 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/content/public/browser/web_contents.h
|
|
|
|
+++ b/content/public/browser/web_contents.h
|
2023-07-20 07:36:59 +00:00
|
|
|
@@ -98,10 +98,13 @@ class BrowserContext;
|
2020-05-26 20:06:26 +00:00
|
|
|
class BrowserPluginGuestDelegate;
|
2018-09-14 05:02:16 +00:00
|
|
|
class RenderFrameHost;
|
|
|
|
class RenderViewHost;
|
|
|
|
+class RenderViewHostDelegateView;
|
|
|
|
class RenderWidgetHostView;
|
|
|
|
+class RenderWidgetHostViewBase;
|
2021-05-19 23:15:47 +00:00
|
|
|
class ScreenOrientationDelegate;
|
|
|
|
class SiteInstance;
|
2018-09-14 05:02:16 +00:00
|
|
|
class WebContentsDelegate;
|
|
|
|
+class WebContentsView;
|
2020-03-03 21:35:05 +00:00
|
|
|
class WebUI;
|
2018-09-14 05:02:16 +00:00
|
|
|
struct DropData;
|
2021-02-09 20:16:21 +00:00
|
|
|
struct MHTMLGenerationParams;
|
2023-07-20 07:36:59 +00:00
|
|
|
@@ -244,6 +247,10 @@ class WebContents : public PageNavigator,
|
2022-01-10 22:31:39 +00:00
|
|
|
network::mojom::WebSandboxFlags starting_sandbox_flags =
|
|
|
|
network::mojom::WebSandboxFlags::kNone;
|
2018-09-14 05:02:16 +00:00
|
|
|
|
|
|
|
+ // Optionally specify the view and delegate view.
|
2023-05-11 20:07:39 +00:00
|
|
|
+ raw_ptr<content::WebContentsView> view = nullptr;
|
|
|
|
+ raw_ptr<content::RenderViewHostDelegateView> delegate_view = nullptr;
|
2018-09-14 05:02:16 +00:00
|
|
|
+
|
2020-04-13 23:39:26 +00:00
|
|
|
// 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
|