Allow distinguishing user- from script-opened wxWebView windows

Add wxWebViewEvent::GetNavigationAction() returning a value that can be
either wxWEBVIEW_NAV_ACTION_USER for the links opened by the user, or
wxWEBVIEW_NAV_ACTION_OTHER for the other ones (e.g. opened from
JavaScript code on the page).

Closes #15402.
This commit is contained in:
Steven Lamerton
2018-08-19 22:27:34 +02:00
committed by Vadim Zeitlin
parent 91aa6ba36e
commit b61123cd7d
7 changed files with 84 additions and 13 deletions

View File

@@ -828,7 +828,14 @@ void WebFrame::OnDocumentLoaded(wxWebViewEvent& evt)
*/
void WebFrame::OnNewWindow(wxWebViewEvent& evt)
{
wxLogMessage("%s", "New window; url='" + evt.GetURL() + "'");
wxString flag = " (other)";
if(evt.GetNavigationAction() == wxWEBVIEW_NAV_ACTION_USER)
{
flag = " (user)";
}
wxLogMessage("%s", "New window; url='" + evt.GetURL() + "'" + flag);
//If we handle new window events then just load them in this window as we
//are a single window browser