Add wxWebViewConfigurationImplChromium scaffolding

It is perfectly useless for now, but provides place to add more things
in the upcoming commits.
This commit is contained in:
Vadim Zeitlin 2024-01-05 02:55:09 +01:00
parent e800cb3119
commit 416e241e6a
2 changed files with 41 additions and 0 deletions

View file

@ -30,6 +30,8 @@ class WXDLLIMPEXP_WEBVIEW wxWebViewChromium : public wxWebView
public:
wxWebViewChromium() { Init(); }
explicit wxWebViewChromium(const wxWebViewConfiguration& config);
wxWebViewChromium(wxWindow* parent,
wxWindowID id,
const wxString& url = wxWebViewDefaultURLStr,

View file

@ -23,6 +23,7 @@
#ifdef __WXMSW__
#include "wx/msw/private.h"
#endif
#include "wx/private/webview.h"
#ifdef __WXGTK__
#include <gtk/gtk.h>
@ -248,12 +249,34 @@ void AppImplData::DoMessageLoopWork()
CefDoMessageLoopWork();
}
// ----------------------------------------------------------------------------
// Chromium-specific configuration data
// ----------------------------------------------------------------------------
class wxWebViewConfigurationImplChromium : public wxWebViewConfigurationImpl
{
public:
static wxWebViewConfiguration MakeConfig()
{
return wxWebViewConfiguration(wxWebViewBackendChromium,
new wxWebViewConfigurationImplChromium);
}
};
// ----------------------------------------------------------------------------
// ImplData contains data for a single wxWebViewChromium instance
// ----------------------------------------------------------------------------
struct ImplData
{
explicit ImplData(const wxWebViewConfiguration& config =
wxWebViewConfigurationImplChromium::MakeConfig())
: m_config{config}
{
}
wxWebViewConfiguration m_config;
#ifdef __WXGTK__
// Due to delayed creation of the browser in wxGTK we need to remember the
// URL passed to Create() as we can't use it there directly.
@ -606,6 +629,11 @@ void wxWebViewChromium::Init()
m_implData = new ImplData{};
}
wxWebViewChromium::wxWebViewChromium(const wxWebViewConfiguration& config)
{
m_implData = new ImplData{config};
}
bool wxWebViewChromium::Create(wxWindow* parent,
wxWindowID id,
const wxString& url,
@ -1822,6 +1850,12 @@ class WXDLLIMPEXP_WEBVIEW wxWebViewFactoryChromium : public wxWebViewFactory
{
public:
virtual wxWebView* Create() override { return new wxWebViewChromium; }
virtual wxWebView* CreateWithConfig(const wxWebViewConfiguration& config) override
{
return new wxWebViewChromium(config);
}
virtual wxWebView* Create(wxWindow* parent,
wxWindowID id,
const wxString& url = wxWebViewDefaultURLStr,
@ -1853,6 +1887,11 @@ public:
CEF_VERSION
};
}
virtual wxWebViewConfiguration CreateConfiguration() override
{
return wxWebViewConfigurationImplChromium::MakeConfig();
}
};
class wxWebViewChromiumModule : public wxModule