virtual void RunScript(const wxString& javascript);
//Virtual Filesystem Support
- virtual void RegisterHandler(wxWebHandler* WXUNUSED(handler)) {};
+ virtual void RegisterHandler(wxWebHandler* handler);
+ virtual wxVector<wxWebHandler*> GetHandlers() { return m_handlerList; }
/** FIXME: hack to work around signals being received too early */
bool m_ready;
GtkWidget *web_view;
gint m_historyLimit;
+ wxVector<wxWebHandler*> m_handlerList;
+
wxDECLARE_DYNAMIC_CLASS(wxWebViewWebKit);
};
#include "wx/gtk/webview_webkit.h"
#include "wx/gtk/control.h"
#include "wx/gtk/private.h"
+#include "wx/filesys.h"
#include "webkit/webkit.h"
// ----------------------------------------------------------------------------
}
static gboolean
-wxgtk_webview_webkit_navigation(WebKitWebView*,
+wxgtk_webview_webkit_navigation(WebKitWebView *view,
WebKitWebFrame *frame,
WebKitNetworkRequest *request,
WebKitWebNavigationAction *,
}
else
{
+ wxString wxuri = uri;
+ wxWebHandler *handler = NULL;
+ wxVector<wxWebHandler*> hanlders = webKitCtrl->GetHandlers();
+ //We are not vetoed so see if we match one of the additional handlers
+ for(wxVector<wxWebHandler*>::iterator it = hanlders.begin();
+ it != hanlders.end(); ++it)
+ {
+ if(wxuri.substr(0, (*it)->GetName().length()) == (*it)->GetName())
+ {
+ handler = (*it);
+ }
+ }
+ //If we found a handler we can then use it to load the file directly
+ //ourselves
+ if(handler)
+ {
+ wxFSFile* file = handler->GetFile(wxuri);
+ g_signal_handlers_block_by_func(view,
+ (gpointer)wxgtk_webview_webkit_navigation,
+ webKitCtrl);
+ webKitCtrl->SetPage(*file->GetStream(), wxuri);
+ g_signal_handlers_unblock_by_func(view,
+ (gpointer)wxgtk_webview_webkit_navigation,
+ webKitCtrl);
+ }
return FALSE;
}
}
javascript.mb_str(wxConvUTF8));
}
+void wxWebViewWebKit::RegisterHandler(wxWebHandler* handler)
+{
+ m_handlerList.push_back(handler);
+}
+
// static
wxVisualAttributes
wxWebViewWebKit::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))