///////////////////////////////////////////////////////////////////////////// // Name: webview_chromium_impl.h // Purpose: Documentation for wxWebViewChromium implementation helpers // Author: Vadim Zeitlin // Created: 2024-02-17 // Copyright: (c) 2024 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// /** Helper class to simplify creating custom CefClient subclasses. Please note that the application including this header must set up the compiler options to include the CEF directory as one of the include paths, as this header -- unlike wx/webview_chromium.h -- includes CEF headers. Here is a simple example of using this class to customize processing the messages received from the other CEF processes: @code #include struct CustomClient : wxDelegatingCefClient { using wxDelegatingCefClient::wxDelegatingCefClient; static CefClient* Create(CefClient* client, void* WXUNUSED(data) { return new CustomClient(client); } bool OnProcessMessageReceived(CefRefPtr browser, CefRefPtr frame, CefProcessId source_process, CefRefPtr message) override { // Handle the message here. return true; // or false if not handled } }; void MyFunction() { wxWebViewConfiguration config = wxWebView::NewConfiguration(wxWebViewBackendChromium); auto configChrome = static_cast(config.GetNativeConfiguration()); configChrome->m_clientCreate = &CustomClient::Create; auto webview = new wxWebViewChromium(config); if ( !webview->Create(this, wxID_ANY, url) ) { // Handle error. } } @endcode @since 3.3.0 @category{webview} */ class wxDelegatingCefClient : CefClient { };