WebViewEdge: Allow edge webview2 installation during runtime

Check if edge webview runtime is available in the call to
wxWebView::IsBackendAvailable() instead of only doing it during
process initialization. This allows an application to install
the Edge WebView2 Runtime during runtime and use the edge webview
afterwards without restarting the process.
This commit is contained in:
Tobias Taschner
2020-11-05 09:47:58 +01:00
parent 2d9c08e0cc
commit 46d123b953
6 changed files with 37 additions and 25 deletions

View File

@@ -88,7 +88,10 @@ void wxWebView::RegisterFactory(const wxString& backend,
bool wxWebView::IsBackendAvailable(const wxString& backend)
{
wxStringWebViewFactoryMap::iterator iter = FindFactory(backend);
return iter != m_factoryMap.end();
if (iter != m_factoryMap.end())
return iter->second->IsAvailable();
else
return false;
}
// static
@@ -111,8 +114,7 @@ void wxWebView::InitFactoryMap()
#endif
#if wxUSE_WEBVIEW_EDGE
if (wxWebViewEdge::IsAvailable() &&
m_factoryMap.find(wxWebViewBackendEdge) == m_factoryMap.end())
if (m_factoryMap.find(wxWebViewBackendEdge) == m_factoryMap.end())
RegisterFactory(wxWebViewBackendEdge, wxSharedPtr<wxWebViewFactory>
(new wxWebViewFactoryEdge));
#endif