]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/webview_ie.cpp
Fix warnings for the OSX WebKit backend.
[wxWidgets.git] / src / msw / webview_ie.cpp
index a3ddf371552a3495710d0a70d3b521fa8820d469..276e35296482534da63660b96b7912540f76353b 100644 (file)
@@ -3,7 +3,7 @@
 // Purpose:     wxMSW wxWebViewIE class implementation for web view component
 // Author:      Marianne Gagnon
 // Id:          $Id$
-// Copyright:   (c) 2010 Marianne Gagnon, Steven Lamerton
+// Copyright:   (c) 2010 Marianne Gagnon, 2011 Steven Lamerton
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
@@ -27,6 +27,8 @@
 #include "wx/msw/missing.h"
 #include "wx/filesys.h"
 
+wxIMPLEMENT_DYNAMIC_CLASS(wxWebViewIE, wxWebView);
+
 //We link to urlmon as it is required for CoInternetGetSession
 #pragma comment(lib, "urlmon")
 
@@ -663,7 +665,7 @@ void wxWebViewIE::RunScript(const wxString& javascript)
     document->Release();
 }
 
-void wxWebViewIE::RegisterProtocol(wxWebProtocolHandler* handler)
+void wxWebViewIE::RegisterHandler(wxWebHandler* handler)
 {
     ClassFactory* cf = new ClassFactory(handler);
     IInternetSession* session;
@@ -672,7 +674,7 @@ void wxWebViewIE::RegisterProtocol(wxWebProtocolHandler* handler)
         wxFAIL_MSG("Could not retrive internet session");
     }
 
-    HRESULT hr = session->RegisterNameSpace(cf, CLSID_FileProtocol, handler->GetProtocol(), 0, NULL, 0);
+    HRESULT hr = session->RegisterNameSpace(cf, CLSID_FileProtocol, handler->GetName(), 0, NULL, 0);
     if(FAILED(hr))
     {
         wxFAIL_MSG("Could not register protocol");
@@ -803,6 +805,13 @@ void wxWebViewIE::onActiveXEvent(wxActiveXEvent& evt)
 
         case DISPID_TITLECHANGE:
         {
+            wxString title = evt[0].GetString();
+
+            wxWebNavigationEvent event(wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED,
+                                       GetId(), GetCurrentURL(), wxEmptyString, true);
+            event.SetString(title);
+            event.SetEventObject(this);
+            HandleWindowEvent(event);
             break;
         }
 
@@ -950,7 +959,7 @@ void wxWebViewIE::onActiveXEvent(wxActiveXEvent& evt)
     evt.Skip();
 }
 
-VirtualProtocol::VirtualProtocol(wxWebProtocolHandler *handler)
+VirtualProtocol::VirtualProtocol(wxWebHandler *handler)
 {
     m_refCount = 0;
     m_file = NULL;
@@ -1070,28 +1079,45 @@ HRESULT VirtualProtocol::Read(void *pv, ULONG cb, ULONG *pcbRead)
 }
 
 HRESULT VirtualProtocol::CombineUrl(LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl,
-                                    DWORD dwCombineFlags, LPWSTR pwzResult, 
+                                    DWORD WXUNUSED(dwCombineFlags), 
+                                    LPWSTR pwzResult, 
                                     DWORD cchResult, DWORD *pcchResult, 
-                                    DWORD dwReserved)
+                                    DWORD WXUNUSED(dwReserved))
 {
-    return INET_E_DEFAULT_ACTION;
+
+    wxString newuri = m_handler->CombineURIs(pwzBaseUrl, pwzRelativeUrl);
+    //Check the buffer we are given can hold the new url
+    if(wxStrlen(newuri) > cchResult)
+        return S_FALSE;
+
+    wxStrcpy(pwzResult, newuri.c_str());
+    *pcchResult = wxStrlen(newuri);
+    return S_OK;
 }
 
-HRESULT VirtualProtocol::ParseUrl(LPCWSTR pwzUrl, PARSEACTION ParseAction,
-                                  DWORD dwParseFlags, LPWSTR pwzResult,
+HRESULT VirtualProtocol::ParseUrl(LPCWSTR pwzUrl, 
+                                  PARSEACTION WXUNUSED(ParseAction),
+                                  DWORD WXUNUSED(dwParseFlags), 
+                                  LPWSTR pwzResult,
                                   DWORD cchResult, DWORD *pcchResult,
-                                  DWORD dwReserved)
+                                  DWORD WXUNUSED(dwReserved))
 {
-    //return INET_E_DEFAULT_ACTION;
-    wcscpy(pwzResult, pwzUrl);
-    *pcchResult = wcslen(pwzResult);
+    //Check the buffer we are given can hold the new url
+    if(wxStrlen(pwzUrl) > cchResult)
+        return S_FALSE;
+
+    wxStrcpy(pwzResult, pwzUrl);
+    *pcchResult = wxStrlen(pwzResult);
     return S_OK;
 }
     
-HRESULT VirtualProtocol::QueryInfo(LPCWSTR pwzUrl, QUERYOPTION OueryOption, 
-                                   DWORD dwQueryFlags, LPVOID pBuffer,
-                                   DWORD cbBuffer, DWORD *pcbBuf,  
-                                   DWORD dwReserved)
+HRESULT VirtualProtocol::QueryInfo(LPCWSTR WXUNUSED(pwzUrl), 
+                                   QUERYOPTION WXUNUSED(OueryOption), 
+                                   DWORD WXUNUSED(dwQueryFlags), 
+                                   LPVOID WXUNUSED(pBuffer),
+                                   DWORD WXUNUSED(cbBuffer), 
+                                   DWORD* WXUNUSED(pcbBuf),  
+                                   DWORD WXUNUSED(dwReserved))
 {
     return INET_E_DEFAULT_ACTION;
 }