diff --git a/build/cmake/samples/CMakeLists.txt b/build/cmake/samples/CMakeLists.txt index 811db5ce7c..ba6c9ca61a 100644 --- a/build/cmake/samples/CMakeLists.txt +++ b/build/cmake/samples/CMakeLists.txt @@ -152,7 +152,8 @@ wx_add_sample(typetest typetest.cpp typetest.h) wx_add_sample(uiaction DEPENDS wxUSE_UIACTIONSIMULATOR) wx_add_sample(validate validate.cpp validate.h DEPENDS wxUSE_VALIDATORS) wx_add_sample(vscroll vstest.cpp) -wx_add_sample(webview LIBRARIES wxwebview NAME webviewsample DEPENDS wxUSE_WEBVIEW) +wx_add_sample(webview LIBRARIES wxwebview DATA ../help/doc.zip:doc.zip + NAME webviewsample DEPENDS wxUSE_WEBVIEW) if(TARGET webviewsample AND wxUSE_STC) wx_exe_link_libraries(webviewsample wxstc) endif() diff --git a/include/wx/webview.h b/include/wx/webview.h index 5fb30dc352..53c78122c2 100644 --- a/include/wx/webview.h +++ b/include/wx/webview.h @@ -89,12 +89,16 @@ enum wxWebViewNavigationActionFlags class WXDLLIMPEXP_WEBVIEW wxWebViewHandler { public: - wxWebViewHandler(const wxString& scheme) : m_scheme(scheme) {} + wxWebViewHandler(const wxString& scheme) + : m_scheme(scheme), m_securityURL() {} virtual ~wxWebViewHandler() {} virtual wxString GetName() const { return m_scheme; } virtual wxFSFile* GetFile(const wxString &uri) = 0; + virtual void SetSecurityURL(const wxString& url) { m_securityURL = url; } + virtual wxString GetSecurityURL() const { return m_securityURL; } private: wxString m_scheme; + wxString m_securityURL; }; extern WXDLLIMPEXP_DATA_WEBVIEW(const char) wxWebViewNameStr[]; diff --git a/interface/wx/webview.h b/interface/wx/webview.h index b2a05d1c26..b870fbfcd2 100644 --- a/interface/wx/webview.h +++ b/interface/wx/webview.h @@ -252,6 +252,20 @@ public: @return The name of the scheme, as passed to the constructor. */ virtual wxString GetName() const; + + /** + Sets a custom security URL. Only used by wxWebViewIE. + + @since 3.1.5 + */ + virtual void SetSecurityURL(const wxString& url); + + /** + @return The custom security URL. Only used by wxWebViewIE. + + @since 3.1.5 + */ + virtual wxString GetSecurityURL() const; }; /** diff --git a/src/msw/webview_ie.cpp b/src/msw/webview_ie.cpp index 6b40fbf820..96847b1a01 100644 --- a/src/msw/webview_ie.cpp +++ b/src/msw/webview_ie.cpp @@ -1077,7 +1077,7 @@ void wxWebViewIE::RegisterHandler(wxSharedPtr handler) HRESULT res = (*pfnCoInternetGetSession)(0, &session, 0); if(FAILED(res)) { - wxFAIL_MSG("Could not retrive internet session"); + wxFAIL_MSG("Could not retrieve internet session"); } HRESULT hr = session->RegisterNameSpace(cf, CLSID_FileProtocol, @@ -1616,12 +1616,6 @@ VirtualProtocol::VirtualProtocol(wxSharedPtr handler) m_handler = handler; } -BEGIN_IID_TABLE(VirtualProtocol) - ADD_IID(Unknown) - ADD_RAW_IID(wxIID_IInternetProtocolRoot) - ADD_RAW_IID(wxIID_IInternetProtocol) -END_IID_TABLE; - STDMETHODIMP VirtualProtocol::QueryInterface(REFIID riid, void **ppv) { wxLogQueryInterface(wxT("VirtualProtocol"), riid); @@ -1768,25 +1762,23 @@ HRESULT STDMETHODCALLTYPE VirtualProtocol::ParseUrl( DWORD dwReserved) { wxUnusedVar(pwzUrl); - wxUnusedVar(ParseAction); wxUnusedVar(dwParseFlags); - wxUnusedVar(pwzResult); - wxUnusedVar(cchResult); - wxUnusedVar(pcchResult); wxUnusedVar(dwReserved); - switch (ParseAction) + const size_t secLen = m_handler->GetSecurityURL().length(); + if ( secLen > 0 ) { - case wxPARSE_SECURITY_URL: - case wxPARSE_SECURITY_DOMAIN: + switch ( ParseAction ) { - const wchar_t Result[] = L"http://localhost"; - size_t Len = wcslen(Result); - if(cchResult <= Len) - return S_FALSE; - wcscpy(pwzResult, Result); - *pcchResult = Len; - return S_OK; + case wxPARSE_SECURITY_URL: + case wxPARSE_SECURITY_DOMAIN: + { + if ( cchResult < secLen ) + return S_FALSE; + wcscpy(pwzResult, m_handler->GetSecurityURL().wc_str()); + *pcchResult = secLen; + return S_OK; + } } }