Beginning implementation of Navigate2.

This commit is contained in:
Jacek Caban 2005-11-15 12:03:25 +00:00 committed by Alexandre Julliard
parent 705aec5a6f
commit 96e1574832
4 changed files with 203 additions and 2 deletions

View File

@ -11,6 +11,7 @@ EXTRALIBS = -luuid
C_SRCS = \
classinfo.c \
client.c \
events.c \
factory.c \
misc.c \

122
dlls/shdocvw/client.c Normal file
View File

@ -0,0 +1,122 @@
/*
* Copyright 2005 Jacek Caban for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "wine/debug.h"
#include "shdocvw.h"
WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
#define CLIENTSITE_THIS(iface) DEFINE_THIS(WebBrowser, OleClientSite, iface)
static HRESULT WINAPI ClientSite_QueryInterface(IOleClientSite *iface, REFIID riid, void **ppv)
{
WebBrowser *This = CLIENTSITE_THIS(iface);
*ppv = NULL;
if(IsEqualGUID(&IID_IUnknown, riid)) {
TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
*ppv = CLIENTSITE(This);
}else if(IsEqualGUID(&IID_IOleClientSite, riid)) {
TRACE("(%p)->(IID_IOleClientSite %p)\n", This, ppv);
*ppv = CLIENTSITE(This);
}
if(*ppv) {
IWebBrowser2_AddRef(WEBBROWSER(This));
return S_OK;
}
WARN("Unsupported intrface %s\n", debugstr_guid(riid));
return E_NOINTERFACE;
}
static ULONG WINAPI ClientSite_AddRef(IOleClientSite *iface)
{
WebBrowser *This = CLIENTSITE_THIS(iface);
return IWebBrowser2_AddRef(WEBBROWSER(This));
}
static ULONG WINAPI ClientSite_Release(IOleClientSite *iface)
{
WebBrowser *This = CLIENTSITE_THIS(iface);
return IWebBrowser2_Release(WEBBROWSER(This));
}
static HRESULT WINAPI ClientSite_SaveObject(IOleClientSite *iface)
{
WebBrowser *This = CLIENTSITE_THIS(iface);
FIXME("(%p)\n", This);
return E_NOTIMPL;
}
static HRESULT WINAPI ClientSite_GetMoniker(IOleClientSite *iface, DWORD dwAssign,
DWORD dwWhichMoniker, IMoniker **ppmk)
{
WebBrowser *This = CLIENTSITE_THIS(iface);
FIXME("(%p)->(%ld %ld %p)\n", This, dwAssign, dwWhichMoniker, ppmk);
return E_NOTIMPL;
}
static HRESULT WINAPI ClientSite_GetContainer(IOleClientSite *iface, IOleContainer **ppContainer)
{
WebBrowser *This = CLIENTSITE_THIS(iface);
FIXME("(%p)->(%p)\n", This, ppContainer);
return E_NOTIMPL;
}
static HRESULT WINAPI ClientSite_ShowObject(IOleClientSite *iface)
{
WebBrowser *This = CLIENTSITE_THIS(iface);
FIXME("(%p)\n", This);
return E_NOTIMPL;
}
static HRESULT WINAPI ClientSite_OnShowWindow(IOleClientSite *iface, BOOL fShow)
{
WebBrowser *This = CLIENTSITE_THIS(iface);
FIXME("(%p)->(%x)\n", This, fShow);
return E_NOTIMPL;
}
static HRESULT WINAPI ClientSite_RequestNewObjectLayout(IOleClientSite *iface)
{
WebBrowser *This = CLIENTSITE_THIS(iface);
FIXME("(%p)\n", This);
return E_NOTIMPL;
}
#undef CLIENTSITE_THIS
static const IOleClientSiteVtbl OleClientSiteVtbl = {
ClientSite_QueryInterface,
ClientSite_AddRef,
ClientSite_Release,
ClientSite_SaveObject,
ClientSite_GetMoniker,
ClientSite_GetContainer,
ClientSite_ShowObject,
ClientSite_OnShowWindow,
ClientSite_RequestNewObjectLayout
};
void WebBrowser_ClientSite_Init(WebBrowser *This)
{
This->lpOleClientSiteVtbl = &OleClientSiteVtbl;
}

View File

@ -58,6 +58,8 @@ extern HRESULT SHDOCVW_GetShellInstanceObjectClassObject(REFCLSID rclsid,
* WebBrowser declaration for SHDOCVW.DLL
*/
typedef struct {
/* Interfaces available via WebBrowser object */
const IWebBrowser2Vtbl *lpWebBrowser2Vtbl;
const IOleObjectVtbl *lpOleObjectVtbl;
const IOleInPlaceObjectVtbl *lpOleInPlaceObjectVtbl;
@ -69,8 +71,14 @@ typedef struct {
const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
const IViewObject2Vtbl *lpViewObjectVtbl;
/* Interfaces available for embeded document */
const IOleClientSiteVtbl *lpOleClientSiteVtbl;
LONG ref;
IUnknown *document;
IOleClientSite *client;
} WebBrowser;
@ -87,6 +95,8 @@ typedef struct {
#define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObjectVtbl);
#define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObjectVtbl);
#define CLIENTSITE(x) ((IOleClientSite*) &(x)->lpOleClientSiteVtbl)
void WebBrowser_OleObject_Init(WebBrowser*);
void WebBrowser_ViewObject_Init(WebBrowser*);
void WebBrowser_Persist_Init(WebBrowser*);
@ -94,6 +104,8 @@ void WebBrowser_ClassInfo_Init(WebBrowser*);
void WebBrowser_Misc_Init(WebBrowser*);
void WebBrowser_Events_Init(WebBrowser*);
void WebBrowser_ClientSite_Init(WebBrowser*);
HRESULT WebBrowser_Create(IUnknown*,REFIID,void**);
/**********************************************************************

View File

@ -21,6 +21,8 @@
#include "wine/debug.h"
#include "shdocvw.h"
#include "mshtml.h"
WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
@ -119,6 +121,12 @@ static ULONG WINAPI WebBrowser_Release(IWebBrowser2 *iface)
TRACE("(%p) ref=%ld\n", This, ref);
if(!ref) {
if(This->client)
IOleClientSite_Release(This->client);
if(This->document)
IUnknown_Release(This->document);
HeapFree(GetProcessHeap(), 0, This);
SHDOCVW_UnlockModule();
}
@ -486,8 +494,63 @@ static HRESULT WINAPI WebBrowser_Navigate2(IWebBrowser2 *iface, VARIANT *URL, VA
VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
{
WebBrowser *This = WEBBROWSER_THIS(iface);
FIXME("(%p)->(%p %p %p %p %p)\n", This, URL, Flags, TargetFrameName, PostData, Headers);
return E_NOTIMPL;
IPersistMoniker *persist;
IOleObject *oleobj;
IMoniker *mon;
HRESULT hres;
TRACE("(%p)->(%p %p %p %p %p)\n", This, URL, Flags, TargetFrameName, PostData, Headers);
if(!This->client)
return E_FAIL;
if(V_VT(Flags) != VT_EMPTY || V_VT(TargetFrameName) != VT_EMPTY
|| V_VT(PostData) != VT_EMPTY || V_VT(Headers) != VT_EMPTY)
FIXME("Unsupported arguments\n");
if(V_VT(URL) != VT_BSTR)
FIXME("V_VT(URL) != VT_BSTR\n");
/*
* FIXME:
* We should use URLMoniker's BindToObject instead creating HTMLDocument here.
* This should be fixed when mshtml.dll and urlmon.dll will be good enough.
*/
if(!This->document) {
hres = CoCreateInstance(&CLSID_HTMLDocument, NULL,
CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
&IID_IUnknown, (void**)&This->document);
if(FAILED(hres))
return hres;
}
hres = IUnknown_QueryInterface(This->document, &IID_IPersistMoniker, (void**)&persist);
if(FAILED(hres))
return hres;
hres = CreateURLMoniker(NULL, V_BSTR(URL), &mon);
if(FAILED(hres)) {
IPersistMoniker_Release(persist);
return hres;
}
hres = IPersistMoniker_Load(persist, FALSE, mon, NULL /* FIXME */, 0);
IMoniker_Release(mon);
IPersistMoniker_Release(persist);
if(FAILED(hres)) {
WARN("Load failed: %08lx\n", hres);
return hres;
}
hres = IUnknown_QueryInterface(This->document, &IID_IOleObject, (void**)&oleobj);
if(FAILED(hres))
return hres;
hres = IOleObject_SetClientSite(oleobj, CLIENTSITE(This));
IOleObject_Release(oleobj);
return hres;
}
static HRESULT WINAPI WebBrowser_QueryStatusWB(IWebBrowser2 *iface, OLECMDID cmdID, OLECMDF *pcmdf)
@ -711,12 +774,15 @@ HRESULT WebBrowser_Create(IUnknown *pOuter, REFIID riid, void **ppv)
ret->lpWebBrowser2Vtbl = &WebBrowser2Vtbl;
ret->ref = 0;
ret->document = NULL;
WebBrowser_OleObject_Init(ret);
WebBrowser_ViewObject_Init(ret);
WebBrowser_Persist_Init(ret);
WebBrowser_ClassInfo_Init(ret);
WebBrowser_Misc_Init(ret);
WebBrowser_Events_Init(ret);
WebBrowser_ClientSite_Init(ret);
hres = IWebBrowser_QueryInterface(WEBBROWSER(ret), riid, ppv);
if(SUCCEEDED(hres)) {