if(IsEqualGUID(&IID_IUnknown, riid)) {
TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
*ppv = WEBBROWSER(This);
- }else if(IsEqualGUID (&IID_IDispatch, riid)) {
+ }else if(IsEqualGUID(&IID_IDispatch, riid)) {
TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
*ppv = WEBBROWSER(This);
}else if(IsEqualGUID(&IID_IWebBrowser, riid)) {
}else if(IsEqualGUID (&IID_IPersistStreamInit, riid)) {
TRACE("(%p)->(IID_IPersistStreamInit %p)\n", This, ppv);
*ppv = PERSTRINIT(This);
- }else if(IsEqualGUID (&IID_IProvideClassInfo, riid)) {
+ }else if(IsEqualGUID(&IID_IProvideClassInfo, riid)) {
TRACE("(%p)->(IID_IProvideClassInfo %p)\n", This, ppv);
*ppv = CLASSINFO(This);
- }else if(IsEqualGUID (&IID_IProvideClassInfo2, riid)) {
+ }else if(IsEqualGUID(&IID_IProvideClassInfo2, riid)) {
TRACE("(%p)->(IID_IProvideClassInfo2 %p)\n", This, ppv);
*ppv = CLASSINFO(This);
- }else if(IsEqualGUID (&IID_IQuickActivate, riid)) {
- TRACE("(%p)->(IID_IQuickActivate %p)\n", This, ppv);
- *ppv = QUICKACT(This);
- }else if(IsEqualGUID (&IID_IConnectionPointContainer, riid)) {
+ }else if(IsEqualGUID(&IID_IConnectionPointContainer, riid)) {
TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This, ppv);
*ppv = CONPTCONT(This);
+ }else if(IsEqualGUID(&IID_IViewObject, riid)) {
+ TRACE("(%p)->(IID_IViewObject %p)\n", This, ppv);
+ *ppv = VIEWOBJ(This);
+ }else if(IsEqualGUID(&IID_IViewObject2, riid)) {
+ TRACE("(%p)->(IID_IViewObject2 %p)\n", This, ppv);
+ *ppv = VIEWOBJ2(This);
+ }else if(IsEqualGUID(&IID_IOleInPlaceActiveObject, riid)) {
+ TRACE("(%p)->(IID_IOleInPlaceActiveObject %p)\n", This, ppv);
+ *ppv = ACTIVEOBJ(This);
+ }else if(IsEqualGUID(&IID_IOleCommandTarget, riid)) {
+ TRACE("(%p)->(IID_IOleCommandTarget %p)\n", This, ppv);
+ *ppv = WBOLECMD(This);
+ }else if(IsEqualGUID(&IID_IHlinkFrame, riid)) {
+ TRACE("(%p)->(IID_IHlinkFrame %p)\n", This, ppv);
+ *ppv = HLINKFRAME(This);
}
if(*ppv) {
TRACE("(%p) ref=%ld\n", This, ref);
if(!ref) {
+ if(This->document)
+ IUnknown_Release(This->document);
+
+ WebBrowser_OleObject_Destroy(This);
+ WebBrowser_Events_Destroy(This);
+ WebBrowser_ClientSite_Destroy(This);
+
+ SysFreeString(This->url);
HeapFree(GetProcessHeap(), 0, This);
SHDOCVW_UnlockModule();
}
static HRESULT WINAPI WebBrowser_get_Document(IWebBrowser2 *iface, IDispatch **ppDisp)
{
WebBrowser *This = WEBBROWSER_THIS(iface);
- FIXME("(%p)->(%p)\n", This, ppDisp);
- return E_NOTIMPL;
+
+ TRACE("(%p)->(%p)\n", This, ppDisp);
+
+ *ppDisp = NULL;
+ if(This->document)
+ IUnknown_QueryInterface(This->document, &IID_IDispatch, (void**)ppDisp);
+
+ return S_OK;
}
static HRESULT WINAPI WebBrowser_get_TopLevelContainer(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
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;
+ PBYTE post_data = NULL;
+ ULONG post_data_len = 0;
+ LPWSTR headers = NULL;
+ HRESULT hres;
+
+ TRACE("(%p)->(%p %p %p %p %p)\n", This, URL, Flags, TargetFrameName, PostData, Headers);
+
+ if(!This->client)
+ return E_FAIL;
+
+ if((Flags && V_VT(Flags) != VT_EMPTY)
+ || (TargetFrameName && V_VT(TargetFrameName) != VT_EMPTY))
+ FIXME("Unsupported arguments\n");
+
+
+ if(!URL)
+ return S_OK;
+
+ if(V_VT(URL) != VT_BSTR)
+ return E_INVALIDARG;
+
+ if(PostData && V_VT(PostData) != VT_EMPTY) {
+ if(V_VT(PostData) != (VT_ARRAY | VT_UI1)
+ || V_ARRAY(PostData)->cDims != 1) {
+ WARN("Invalid PostData\n");
+ return E_INVALIDARG;
+ }
+
+ SafeArrayAccessData(V_ARRAY(PostData), (void**)&post_data);
+ post_data_len = V_ARRAY(PostData)->rgsabound[0].cElements;
+ }
+
+ if(Headers && V_VT(Headers) != VT_EMPTY) {
+ if(V_VT(Headers) != VT_BSTR)
+ return E_INVALIDARG;
+
+ headers = V_BSTR(Headers);
+ FIXME("Headers: %s\n", debugstr_w(headers));
+ }
+
+ if(!This->doc_view_hwnd)
+ create_doc_view_hwnd(This);
+
+ hres = navigate_url(This, V_BSTR(URL), post_data, post_data_len, headers);
+
+ if(post_data)
+ SafeArrayUnaccessData(V_ARRAY(PostData));
+
+ return hres;
}
static HRESULT WINAPI WebBrowser_QueryStatusWB(IWebBrowser2 *iface, OLECMDID cmdID, OLECMDF *pcmdf)
ret->lpWebBrowser2Vtbl = &WebBrowser2Vtbl;
ret->ref = 0;
+ ret->document = NULL;
+ ret->url = 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);
+ WebBrowser_DocHost_Init(ret);
+ WebBrowser_Frame_Init(ret);
+ WebBrowser_HlinkFrame_Init(ret);
hres = IWebBrowser_QueryInterface(WEBBROWSER(ret), riid, ppv);
if(SUCCEEDED(hres)) {