1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
- From: deepak1556 <[email protected]>
- Date: Sat, 24 Apr 2021 18:07:09 -0700
- 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 cc2e4302ad121d658bb43af1014b6af42a62d47a..2585728e652de91cbc9839cb1500e04f87635866 100644
- --- a/content/browser/web_contents/web_contents_impl.cc
- +++ b/content/browser/web_contents/web_contents_impl.cc
- @@ -3651,6 +3651,13 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params,
- params.main_frame_name, GetOpener(), primary_main_frame_policy,
- base::UnguessableToken::Create());
-
- + if (params.view && params.delegate_view) {
- + view_.reset(params.view);
- + render_view_host_delegate_view_ = params.delegate_view;
- + }
- +
- + if (!view_) {
- +
- std::unique_ptr<WebContentsViewDelegate> delegate =
- GetContentClient()->browser()->GetWebContentsViewDelegate(this);
-
- @@ -3661,6 +3668,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params,
- view_ = CreateWebContentsView(this, std::move(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 09099f8ba7b051d89bc43da5b8ae96222d9b0f7f..3cebb9b8fc035550523beac742cb27ce404a9e89 100644
- --- a/content/public/browser/web_contents.h
- +++ b/content/public/browser/web_contents.h
- @@ -110,10 +110,13 @@ class BrowserContext;
- class BrowserPluginGuestDelegate;
- class RenderFrameHost;
- class RenderViewHost;
- +class RenderViewHostDelegateView;
- class RenderWidgetHostView;
- +class RenderWidgetHostViewBase;
- class ScreenOrientationDelegate;
- class SiteInstance;
- class WebContentsDelegate;
- +class WebContentsView;
- class WebUI;
- struct DropData;
- struct MHTMLGenerationParams;
- @@ -259,6 +262,10 @@ class WebContents : public PageNavigator, public base::SupportsUserData {
- network::mojom::WebSandboxFlags starting_sandbox_flags =
- network::mojom::WebSandboxFlags::kNone;
-
- + // Optionally specify the view and delegate view.
- + raw_ptr<content::WebContentsView> view = nullptr;
- + raw_ptr<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 GetLastActiveTimeTicks(). If this is
- // left default initialized then the value is not passed on to the
|