Move ClientHandler to wxCEF namespace

Use "wxCEF" prefix for this class to avoid any conflicts by using
non-wx-prefixed name.

Also replace wxWebViewChromiumImplData with wxCEF::ImplData as this is
shorter and more consistent with ClientHandler.

Finally stop using anonymous namespace for wxBrowserProcessHandler and
wxCefApp, as we can now put them into the same wxCEF namespace.
This commit is contained in:
Vadim Zeitlin 2023-09-03 22:01:38 +02:00
parent e5e727747b
commit 013940da8f
2 changed files with 20 additions and 12 deletions

View file

@ -17,7 +17,13 @@
extern WXDLLIMPEXP_DATA_WEBVIEW_CHROMIUM(const char) wxWebViewBackendChromium[];
class wxWebViewChromium;
// Private namespace containing classes used only in the implementation.
namespace wxCEF
{
class ClientHandler;
struct ImplData;
}
class WXDLLIMPEXP_WEBVIEW_CHROMIUM wxWebViewChromium : public wxWebView
{
@ -146,12 +152,12 @@ private:
// The text of the current page
wxString m_pageText;
// Private data used by ClientHandler.
struct wxWebViewChromiumImplData* m_implData = nullptr;
// Private data used by wxCEFClientHandler.
struct wxCEF::ImplData* m_implData = nullptr;
// We also friend ClientHandler so it can access m_implData.
friend class ClientHandler;
ClientHandler* m_clientHandler;
// We also friend wxCEFClientHandler so it can access m_implData.
friend class wxCEF::ClientHandler;
wxCEF::ClientHandler* m_clientHandler;
friend class wxWebViewChromiumModule;
static bool ms_cefInitialized;

View file

@ -69,11 +69,14 @@ bool wxWebViewChromium::ms_cefInitialized = false;
wxIMPLEMENT_DYNAMIC_CLASS(wxWebViewChromium, wxWebView);
namespace wxCEF
{
// ----------------------------------------------------------------------------
// wxWebViewChromiumImplData
// ImplData
// ----------------------------------------------------------------------------
struct wxWebViewChromiumImplData
struct ImplData
{
#ifdef __WXGTK__
// Due to delayed creation of the browser in wxGTK we need to remember the
@ -268,9 +271,6 @@ private:
IMPLEMENT_REFCOUNTING(wxStringVisitor);
};
namespace
{
class wxBrowserProcessHandler : public CefBrowserProcessHandler
{
public:
@ -348,7 +348,9 @@ private:
IMPLEMENT_REFCOUNTING(wxCefApp);
};
} // anonymous namespace
} // namespace wxCEF
using namespace wxCEF;
bool wxWebViewChromium::Create(wxWindow* parent,
wxWindowID id,
@ -383,7 +385,7 @@ bool wxWebViewChromium::Create(wxWindow* parent,
m_historyPosition = -1;
m_zoomLevel = wxWEBVIEW_ZOOM_MEDIUM;
m_implData = new wxWebViewChromiumImplData{};
m_implData = new ImplData{};
m_clientHandler = new ClientHandler{*this};
m_clientHandler->AddRef();