Use shared pointers to hold wxWebHandlers throughout.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/SOC2011_WEBVIEW@68605 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
fea281f428
commit
3baf235f60
@ -122,8 +122,8 @@ public:
|
||||
virtual void RunScript(const wxString& javascript);
|
||||
|
||||
//Virtual Filesystem Support
|
||||
virtual void RegisterHandler(wxWebHandler* handler);
|
||||
virtual wxVector<wxWebHandler*> GetHandlers() { return m_handlerList; }
|
||||
virtual void RegisterHandler(wxSharedPtr<wxWebHandler> handler);
|
||||
virtual wxVector<wxSharedPtr<wxWebHandler> > GetHandlers() { return m_handlerList; }
|
||||
|
||||
/** FIXME: hack to work around signals being received too early */
|
||||
bool m_ready;
|
||||
@ -136,8 +136,7 @@ public:
|
||||
* user)
|
||||
*/
|
||||
bool m_busy;
|
||||
|
||||
bool m_guard;
|
||||
|
||||
wxString m_vfsurl;
|
||||
|
||||
//We use this flag to stop recursion when we load a page from the navigation
|
||||
@ -156,7 +155,7 @@ private:
|
||||
GtkWidget *web_view;
|
||||
gint m_historyLimit;
|
||||
|
||||
wxVector<wxWebHandler*> m_handlerList;
|
||||
wxVector<wxSharedPtr<wxWebHandler> > m_handlerList;
|
||||
|
||||
wxDECLARE_DYNAMIC_CLASS(wxWebViewWebKit);
|
||||
};
|
||||
|
@ -110,7 +110,7 @@ public:
|
||||
virtual void RunScript(const wxString& javascript);
|
||||
|
||||
//Virtual Filesystem Support
|
||||
virtual void RegisterHandler(wxWebHandler* handler);
|
||||
virtual void RegisterHandler(wxSharedPtr<wxWebHandler> handler);
|
||||
|
||||
// ---- IE-specific methods
|
||||
|
||||
@ -169,10 +169,10 @@ protected:
|
||||
VOID * fileP;
|
||||
|
||||
wxFSFile* m_file;
|
||||
wxWebHandler* m_handler;
|
||||
wxSharedPtr<wxWebHandler> m_handler;
|
||||
|
||||
public:
|
||||
VirtualProtocol(wxWebHandler *handler);
|
||||
VirtualProtocol(wxSharedPtr<wxWebHandler> handler);
|
||||
~VirtualProtocol();
|
||||
|
||||
//IUnknown
|
||||
@ -211,7 +211,7 @@ class ClassFactory : public IClassFactory
|
||||
private:
|
||||
ULONG m_refCount;
|
||||
public:
|
||||
ClassFactory(wxWebHandler* handler) : m_handler(handler) {}
|
||||
ClassFactory(wxSharedPtr<wxWebHandler> handler) : m_handler(handler) {}
|
||||
//IUnknown
|
||||
ULONG STDMETHODCALLTYPE AddRef();
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject);
|
||||
@ -222,7 +222,7 @@ public:
|
||||
REFIID riid, void** ppvObject);
|
||||
HRESULT STDMETHODCALLTYPE LockServer(BOOL fLock);
|
||||
private:
|
||||
wxWebHandler* m_handler;
|
||||
wxSharedPtr<wxWebHandler> m_handler;
|
||||
};
|
||||
|
||||
#endif // wxUSE_WEBVIEW_IE && defined(__WXMSW__)
|
||||
|
@ -114,7 +114,7 @@ public:
|
||||
void RunScript(const wxString& javascript);
|
||||
|
||||
//Virtual Filesystem Support
|
||||
virtual void RegisterHandler(wxWebHandler* WXUNUSED(handler)) {};
|
||||
virtual void RegisterHandler(wxSharedPtr<wxWebHandler> WXUNUSED(handler)) {};
|
||||
|
||||
// ---- methods not from the parent (common) interface
|
||||
bool CanGetPageSource();
|
||||
|
@ -339,7 +339,7 @@ public:
|
||||
virtual void Redo() = 0;
|
||||
|
||||
//Virtual Filesystem Support
|
||||
virtual void RegisterHandler(wxWebHandler* handler) = 0;
|
||||
virtual void RegisterHandler(wxSharedPtr<wxWebHandler> handler) = 0;
|
||||
|
||||
wxDECLARE_ABSTRACT_CLASS(wxWebView);
|
||||
};
|
||||
|
@ -335,9 +335,9 @@ public:
|
||||
|
||||
/**
|
||||
Registers a custom scheme handler.
|
||||
@param handler A pointer to a heap allocated wxWebHandler.
|
||||
@param handler A shared pointer to a wxWebHandler.
|
||||
*/
|
||||
virtual void RegisterHandler(wxWebHandler* handler) = 0;
|
||||
virtual void RegisterHandler(wxSharedPtr<wxWebHandler> handler) = 0;
|
||||
|
||||
/**
|
||||
Reload the currently displayed URL.
|
||||
|
@ -195,7 +195,7 @@ WebFrame::WebFrame() : wxFrame(NULL, wxID_ANY, "wxWebView Sample")
|
||||
topsizer->Add(m_browser, wxSizerFlags().Expand().Proportion(1));
|
||||
|
||||
//We register the test:// protocol for testing purposes
|
||||
m_browser->RegisterHandler(new wxWebFileHandler());
|
||||
m_browser->RegisterHandler(wxSharedPtr<wxWebHandler>(new wxWebFileHandler()));
|
||||
|
||||
SetSizer(topsizer);
|
||||
|
||||
|
@ -103,10 +103,10 @@ wxgtk_webview_webkit_navigation(WebKitWebView *,
|
||||
else
|
||||
{
|
||||
wxString wxuri = uri;
|
||||
wxWebHandler *handler = NULL;
|
||||
wxVector<wxWebHandler*> hanlders = webKitCtrl->GetHandlers();
|
||||
wxSharedPtr<wxWebHandler> handler;
|
||||
wxVector<wxSharedPtr<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();
|
||||
for(wxVector<wxSharedPtr<wxWebHandler> >::iterator it = hanlders.begin();
|
||||
it != hanlders.end(); ++it)
|
||||
{
|
||||
if(wxuri.substr(0, (*it)->GetName().length()) == (*it)->GetName())
|
||||
@ -328,11 +328,11 @@ wxgtk_webview_webkit_resource_req(WebKitWebView *,
|
||||
{
|
||||
wxString uri = webkit_network_request_get_uri(request);
|
||||
|
||||
wxWebHandler *handler = NULL;
|
||||
wxVector<wxWebHandler*> hanlders = webKitCtrl->GetHandlers();
|
||||
wxSharedPtr<wxWebHandler> handler;
|
||||
wxVector<wxSharedPtr<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();
|
||||
for(wxVector<wxSharedPtr<wxWebHandler> >::iterator it = hanlders.begin();
|
||||
it != hanlders.end(); ++it)
|
||||
{
|
||||
if(uri.substr(0, (*it)->GetName().length()) == (*it)->GetName())
|
||||
@ -913,7 +913,7 @@ void wxWebViewWebKit::RunScript(const wxString& javascript)
|
||||
javascript.mb_str(wxConvUTF8));
|
||||
}
|
||||
|
||||
void wxWebViewWebKit::RegisterHandler(wxWebHandler* handler)
|
||||
void wxWebViewWebKit::RegisterHandler(wxSharedPtr<wxWebHandler> handler)
|
||||
{
|
||||
m_handlerList.push_back(handler);
|
||||
}
|
||||
|
@ -665,7 +665,7 @@ void wxWebViewIE::RunScript(const wxString& javascript)
|
||||
document->Release();
|
||||
}
|
||||
|
||||
void wxWebViewIE::RegisterHandler(wxWebHandler* handler)
|
||||
void wxWebViewIE::RegisterHandler(wxSharedPtr<wxWebHandler> handler)
|
||||
{
|
||||
ClassFactory* cf = new ClassFactory(handler);
|
||||
IInternetSession* session;
|
||||
@ -959,7 +959,7 @@ void wxWebViewIE::onActiveXEvent(wxActiveXEvent& evt)
|
||||
evt.Skip();
|
||||
}
|
||||
|
||||
VirtualProtocol::VirtualProtocol(wxWebHandler *handler)
|
||||
VirtualProtocol::VirtualProtocol(wxSharedPtr<wxWebHandler> handler)
|
||||
{
|
||||
m_refCount = 0;
|
||||
m_file = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user