]> git.saurik.com Git - wxWidgets.git/commitdiff
Very basic implementation of IInternetProtocolInfo, this will allow us to correctly...
authorSteve Lamerton <steve.lamerton@gmail.com>
Tue, 26 Jul 2011 16:11:38 +0000 (16:11 +0000)
committerSteve Lamerton <steve.lamerton@gmail.com>
Tue, 26 Jul 2011 16:11:38 +0000 (16:11 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/SOC2011_WEBVIEW@68432 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/msw/webview_ie.h
src/msw/webview_ie.cpp

index 935f2c6c1242bc9195384e96d2e746478ca7f1b2..b9d9bcfb262cc6b28be3aa7c30dacdc3263372af 100644 (file)
@@ -158,7 +158,7 @@ private:
 
 };
 
-class VirtualProtocol : public IInternetProtocol
+class VirtualProtocol : public IInternetProtocol, public IInternetProtocolInfo
 {
 protected:
     ULONG m_refCount;
@@ -202,6 +202,25 @@ public:
                                    ULARGE_INTEGER* WXUNUSED(plibNewPosition)) 
                                    { return E_FAIL; }
     HRESULT STDMETHODCALLTYPE UnlockRequest() { return S_OK; }
+
+    //IInternetProtocolInfo
+    HRESULT STDMETHODCALLTYPE CombineUrl(LPCWSTR pwzBaseUrl, 
+                                         LPCWSTR pwzRelativeUrl, 
+                                         DWORD dwCombineFlags, 
+                                         LPWSTR pwzResult, DWORD cchResult,
+                                         DWORD *pcchResult, DWORD dwReserved);
+    HRESULT STDMETHODCALLTYPE CompareUrl(LPCWSTR pwzUrl1, LPCWSTR pwzUrl2,
+                                         DWORD dwCompareFlags)
+                                         { return INET_E_DEFAULT_ACTION; }
+    HRESULT STDMETHODCALLTYPE ParseUrl(LPCWSTR pwzUrl, PARSEACTION ParseAction,
+                                       DWORD dwParseFlags, LPWSTR pwzResult,
+                                       DWORD cchResult, DWORD *pcchResult,
+                                       DWORD dwReserved);
+    HRESULT STDMETHODCALLTYPE QueryInfo(LPCWSTR pwzUrl, 
+                                        QUERYOPTION OueryOption, 
+                                        DWORD dwQueryFlags, LPVOID pBuffer,
+                                        DWORD cbBuffer, DWORD *pcbBuf, 
+                                        DWORD dwReserved);
 };
 
 class ClassFactory : public IClassFactory
index 4905e5de82b40748b54f2c3254ddfc5001a6fb37..761e9cc2698c3567831b9784930ceca58c59b889 100644 (file)
@@ -101,7 +101,7 @@ bool wxWebViewIE::Create(wxWindow* parent,
     IInternetSession* session;
     if(CoInternetGetSession(0, &session, 0) != S_OK)
         return false;
-    HRESULT hr = session->RegisterNameSpace(cf, CLSID_FileProtocol, L"file", 0, NULL, 0);
+    HRESULT hr = session->RegisterNameSpace(cf, CLSID_FileProtocol, L"test", 0, NULL, 0);
     if(FAILED(hr))
         return false; 
 
@@ -990,10 +990,16 @@ ULONG VirtualProtocol::AddRef()
 
 HRESULT VirtualProtocol::QueryInterface(REFIID riid, void **ppvObject)
 {
-    if ((riid == IID_IUnknown) || (riid == IID_IInternetProtocol)
-       || (riid == IID_IInternetProtocolRoot))
+    if(riid == IID_IUnknown || riid == IID_IInternetProtocol
+       || riid == IID_IInternetProtocolRoot)
     {
-        *ppvObject = this;
+        *ppvObject = (IInternetProtocol*)this;
+        AddRef();
+        return S_OK;
+    }
+    else if(riid == IID_IInternetProtocolInfo)
+    {
+        *ppvObject = (IInternetProtocolInfo*)this;
         AddRef();
         return S_OK;
     }
@@ -1032,6 +1038,7 @@ HRESULT VirtualProtocol::Start(LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink
     wxString path = wxString(szUrl).BeforeFirst(':') +  ":" + 
                     EscapeFileNameCharsInURL(wxString(szUrl).AfterFirst(':'));
     path.Replace("///", "/");
+    path.Replace("test", "file");
     m_file = m_fileSys->OpenFile(path);
 
     if(!m_file)
@@ -1039,11 +1046,11 @@ HRESULT VirtualProtocol::Start(LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink
 
     //We return the stream length for current and total size as we can always
     //read the whole file from the stream
+    wxFileOffset length = m_file->GetStream()->GetLength();
     m_protocolSink->ReportData(BSCF_FIRSTDATANOTIFICATION | 
                                BSCF_DATAFULLYAVAILABLE |
                                BSCF_LASTDATANOTIFICATION,
-                               m_file->GetStream()->GetLength(),
-                               m_file->GetStream()->GetLength());
+                               length, length);
     return S_OK; 
 }
 
@@ -1086,6 +1093,30 @@ HRESULT VirtualProtocol::Read(void *pv, ULONG cb, ULONG *pcbRead)
     }
 }
 
+HRESULT VirtualProtocol::CombineUrl(LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl,
+                                    DWORD dwCombineFlags, LPWSTR pwzResult, 
+                                    DWORD cchResult, DWORD *pcchResult, 
+                                    DWORD dwReserved)
+{
+    return INET_E_DEFAULT_ACTION;
+}
+
+HRESULT VirtualProtocol::ParseUrl(LPCWSTR pwzUrl, PARSEACTION ParseAction,
+                                  DWORD dwParseFlags, LPWSTR pwzResult,
+                                  DWORD cchResult, DWORD *pcchResult,
+                                  DWORD dwReserved)
+{
+    return INET_E_DEFAULT_ACTION;
+}
+    
+HRESULT VirtualProtocol::QueryInfo(LPCWSTR pwzUrl, QUERYOPTION OueryOption, 
+                                   DWORD dwQueryFlags, LPVOID pBuffer,
+                                   DWORD cbBuffer, DWORD *pcbBuf,  
+                                   DWORD dwReserved)
+{
+    return INET_E_DEFAULT_ACTION;
+}
+
 HRESULT ClassFactory::CreateInstance(IUnknown* pUnkOuter, REFIID riid,
                                      void ** ppvObject)
 {