2 * Implementation of IWebBrowser interface for WebBrowser control
4 * Copyright 2001 John R. Sheets (for CodeWeavers)
5 * Copyright 2005 Jacek Caban
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "wine/debug.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
28 /**********************************************************************
29 * Implement the IWebBrowser interface
32 #define WEBBROWSER_THIS(iface) DEFINE_THIS(WebBrowser, WebBrowser2, iface)
34 static HRESULT WINAPI WebBrowser_QueryInterface(IWebBrowser2 *iface, REFIID riid, LPVOID *ppv)
36 WebBrowser *This = WEBBROWSER_THIS(iface);
42 if(IsEqualGUID(&IID_IUnknown, riid)) {
43 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
44 *ppv = WEBBROWSER(This);
45 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
46 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
47 *ppv = WEBBROWSER(This);
48 }else if(IsEqualGUID(&IID_IWebBrowser, riid)) {
49 TRACE("(%p)->(IID_IWebBrowser %p)\n", This, ppv);
50 *ppv = WEBBROWSER(This);
51 }else if(IsEqualGUID(&IID_IWebBrowserApp, riid)) {
52 TRACE("(%p)->(IID_IWebBrowserApp %p)\n", This, ppv);
53 *ppv = WEBBROWSER(This);
54 }else if(IsEqualGUID(&IID_IWebBrowser2, riid)) {
55 TRACE("(%p)->(IID_IWebBrowser2 %p)\n", This, ppv);
56 *ppv = WEBBROWSER(This);
57 }else if(IsEqualGUID(&IID_IOleObject, riid)) {
58 TRACE("(%p)->(IID_IOleObject %p)\n", This, ppv);
60 }else if(IsEqualGUID(&IID_IOleWindow, riid)) {
61 TRACE("(%p)->(IID_IOleWindow %p)\n", This, ppv);
62 *ppv = INPLACEOBJ(This);
63 }else if(IsEqualGUID (&IID_IOleInPlaceObject, riid)) {
64 TRACE("(%p)->(IID_IOleInPlaceObject %p)\n", This, ppv);
65 *ppv = INPLACEOBJ(This);
66 }else if(IsEqualGUID(&IID_IOleControl, riid)) {
67 TRACE("(%p)->(IID_IOleControl %p)\n", This, ppv);
69 }else if(IsEqualGUID(&IID_IPersist, riid)) {
70 TRACE("(%p)->(IID_IPersist %p)\n", This, ppv);
71 *ppv = PERSTORAGE(This);
72 }else if(IsEqualGUID(&IID_IPersistStorage, riid)) {
73 TRACE("(%p)->(IID_IPersistStorage %p)\n", This, ppv);
74 *ppv = PERSTORAGE(This);
75 }else if(IsEqualGUID(&IID_IPersistMemory, riid)) {
76 TRACE("(%p)->(IID_IPersistStorage %p)\n", This, ppv);
77 *ppv = PERMEMORY(This);
78 }else if(IsEqualGUID (&IID_IPersistStreamInit, riid)) {
79 TRACE("(%p)->(IID_IPersistStreamInit %p)\n", This, ppv);
80 *ppv = PERSTRINIT(This);
81 }else if(IsEqualGUID(&IID_IProvideClassInfo, riid)) {
82 TRACE("(%p)->(IID_IProvideClassInfo %p)\n", This, ppv);
83 *ppv = CLASSINFO(This);
84 }else if(IsEqualGUID(&IID_IProvideClassInfo2, riid)) {
85 TRACE("(%p)->(IID_IProvideClassInfo2 %p)\n", This, ppv);
86 *ppv = CLASSINFO(This);
87 }else if(IsEqualGUID(&IID_IConnectionPointContainer, riid)) {
88 TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This, ppv);
89 *ppv = CONPTCONT(&This->doc_host.cps);
90 }else if(IsEqualGUID(&IID_IViewObject, riid)) {
91 TRACE("(%p)->(IID_IViewObject %p)\n", This, ppv);
93 }else if(IsEqualGUID(&IID_IViewObject2, riid)) {
94 TRACE("(%p)->(IID_IViewObject2 %p)\n", This, ppv);
95 *ppv = VIEWOBJ2(This);
96 }else if(IsEqualGUID(&IID_IOleInPlaceActiveObject, riid)) {
97 TRACE("(%p)->(IID_IOleInPlaceActiveObject %p)\n", This, ppv);
98 *ppv = ACTIVEOBJ(This);
99 }else if(IsEqualGUID(&IID_IOleCommandTarget, riid)) {
100 TRACE("(%p)->(IID_IOleCommandTarget %p)\n", This, ppv);
102 }else if(IsEqualGUID(&IID_IHlinkFrame, riid)) {
103 TRACE("(%p)->(IID_IHlinkFrame %p)\n", This, ppv);
104 *ppv = HLINKFRAME(This);
105 }else if(IsEqualGUID(&IID_IQuickActivate, riid)) {
106 TRACE("(%p)->(IID_IQuickActivate %p) returning NULL\n", This, ppv);
107 return E_NOINTERFACE;
108 }else if(IsEqualGUID(&IID_IRunnableObject, riid)) {
109 TRACE("(%p)->(IID_IRunnableObject %p) returning NULL\n", This, ppv);
110 return E_NOINTERFACE;
111 }else if(IsEqualGUID(&IID_IPerPropertyBrowsing, riid)) {
112 TRACE("(%p)->(IID_IPerPropertyBrowsing %p) returning NULL\n", This, ppv);
113 return E_NOINTERFACE;
114 }else if(IsEqualGUID(&IID_IOleCache, riid)) {
115 TRACE("(%p)->(IID_IOleCache %p) returning NULL\n", This, ppv);
116 return E_NOINTERFACE;
120 IUnknown_AddRef((IUnknown*)*ppv);
124 FIXME("(%p)->(%s %p) interface not supported\n", This, debugstr_guid(riid), ppv);
125 return E_NOINTERFACE;
128 static ULONG WINAPI WebBrowser_AddRef(IWebBrowser2 *iface)
130 WebBrowser *This = WEBBROWSER_THIS(iface);
131 LONG ref = InterlockedIncrement(&This->ref);
132 TRACE("(%p) ref=%d\n", This, ref);
136 static ULONG WINAPI WebBrowser_Release(IWebBrowser2 *iface)
138 WebBrowser *This = WEBBROWSER_THIS(iface);
139 LONG ref = InterlockedDecrement(&This->ref);
141 TRACE("(%p) ref=%d\n", This, ref);
144 if(This->doc_host.document)
145 IUnknown_Release(This->doc_host.document);
147 DocHost_Release(&This->doc_host);
149 WebBrowser_OleObject_Destroy(This);
152 SHDOCVW_UnlockModule();
158 /* IDispatch methods */
159 static HRESULT WINAPI WebBrowser_GetTypeInfoCount(IWebBrowser2 *iface, UINT *pctinfo)
161 WebBrowser *This = WEBBROWSER_THIS(iface);
162 FIXME("(%p)->(%p)\n", This, pctinfo);
166 static HRESULT WINAPI WebBrowser_GetTypeInfo(IWebBrowser2 *iface, UINT iTInfo, LCID lcid,
169 WebBrowser *This = WEBBROWSER_THIS(iface);
170 FIXME("(%p)->(%d %d %p)\n", This, iTInfo, lcid, ppTInfo);
174 static HRESULT WINAPI WebBrowser_GetIDsOfNames(IWebBrowser2 *iface, REFIID riid,
175 LPOLESTR *rgszNames, UINT cNames,
176 LCID lcid, DISPID *rgDispId)
178 WebBrowser *This = WEBBROWSER_THIS(iface);
179 FIXME("(%p)->(%s %p %d %d %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
184 static HRESULT WINAPI WebBrowser_Invoke(IWebBrowser2 *iface, DISPID dispIdMember,
185 REFIID riid, LCID lcid, WORD wFlags,
186 DISPPARAMS *pDispParams, VARIANT *pVarResult,
187 EXCEPINFO *pExepInfo, UINT *puArgErr)
189 WebBrowser *This = WEBBROWSER_THIS(iface);
193 TRACE("(%p)->(%d %s %d %08x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
194 lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
196 hres = get_typeinfo(&typeinfo);
200 return ITypeInfo_Invoke(typeinfo, WEBBROWSER2(This), dispIdMember, wFlags, pDispParams,
201 pVarResult, pExepInfo, puArgErr);
204 /* IWebBrowser methods */
205 static HRESULT WINAPI WebBrowser_GoBack(IWebBrowser2 *iface)
207 WebBrowser *This = WEBBROWSER_THIS(iface);
208 FIXME("(%p)\n", This);
212 static HRESULT WINAPI WebBrowser_GoForward(IWebBrowser2 *iface)
214 WebBrowser *This = WEBBROWSER_THIS(iface);
215 FIXME("(%p)\n", This);
219 static HRESULT WINAPI WebBrowser_GoHome(IWebBrowser2 *iface)
221 WebBrowser *This = WEBBROWSER_THIS(iface);
222 TRACE("(%p)\n", This);
223 return go_home(&This->doc_host);
226 static HRESULT WINAPI WebBrowser_GoSearch(IWebBrowser2 *iface)
228 WebBrowser *This = WEBBROWSER_THIS(iface);
229 FIXME("(%p)\n", This);
233 static HRESULT WINAPI WebBrowser_Navigate(IWebBrowser2 *iface, BSTR szUrl,
234 VARIANT *Flags, VARIANT *TargetFrameName,
235 VARIANT *PostData, VARIANT *Headers)
237 WebBrowser *This = WEBBROWSER_THIS(iface);
239 TRACE("(%p)->(%s %p %p %p %p)\n", This, debugstr_w(szUrl), Flags, TargetFrameName,
242 return navigate_url(&This->doc_host, szUrl, Flags, TargetFrameName, PostData, Headers);
245 static HRESULT WINAPI WebBrowser_Refresh(IWebBrowser2 *iface)
247 WebBrowser *This = WEBBROWSER_THIS(iface);
248 FIXME("(%p)\n", This);
252 static HRESULT WINAPI WebBrowser_Refresh2(IWebBrowser2 *iface, VARIANT *Level)
254 WebBrowser *This = WEBBROWSER_THIS(iface);
255 FIXME("(%p)->(%p)\n", This, Level);
259 static HRESULT WINAPI WebBrowser_Stop(IWebBrowser2 *iface)
261 WebBrowser *This = WEBBROWSER_THIS(iface);
262 FIXME("(%p)\n", This);
266 static HRESULT WINAPI WebBrowser_get_Application(IWebBrowser2 *iface, IDispatch **ppDisp)
268 WebBrowser *This = WEBBROWSER_THIS(iface);
270 TRACE("(%p)->(%p)\n", This, ppDisp);
275 *ppDisp = (IDispatch*)WEBBROWSER2(This);
276 IDispatch_AddRef(*ppDisp);
280 static HRESULT WINAPI WebBrowser_get_Parent(IWebBrowser2 *iface, IDispatch **ppDisp)
282 WebBrowser *This = WEBBROWSER_THIS(iface);
283 FIXME("(%p)->(%p)\n", This, ppDisp);
287 static HRESULT WINAPI WebBrowser_get_Container(IWebBrowser2 *iface, IDispatch **ppDisp)
289 WebBrowser *This = WEBBROWSER_THIS(iface);
290 FIXME("(%p)->(%p)\n", This, ppDisp);
294 static HRESULT WINAPI WebBrowser_get_Document(IWebBrowser2 *iface, IDispatch **ppDisp)
296 WebBrowser *This = WEBBROWSER_THIS(iface);
298 TRACE("(%p)->(%p)\n", This, ppDisp);
301 if(This->doc_host.document)
302 IUnknown_QueryInterface(This->doc_host.document, &IID_IDispatch, (void**)ppDisp);
307 static HRESULT WINAPI WebBrowser_get_TopLevelContainer(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
309 WebBrowser *This = WEBBROWSER_THIS(iface);
310 FIXME("(%p)->(%p)\n", This, pBool);
314 static HRESULT WINAPI WebBrowser_get_Type(IWebBrowser2 *iface, BSTR *Type)
316 WebBrowser *This = WEBBROWSER_THIS(iface);
317 FIXME("(%p)->(%p)\n", This, Type);
321 static HRESULT WINAPI WebBrowser_get_Left(IWebBrowser2 *iface, long *pl)
323 WebBrowser *This = WEBBROWSER_THIS(iface);
325 TRACE("(%p)->(%p)\n", This, pl);
327 *pl = This->pos_rect.left;
331 static HRESULT WINAPI WebBrowser_put_Left(IWebBrowser2 *iface, long Left)
333 WebBrowser *This = WEBBROWSER_THIS(iface);
336 TRACE("(%p)->(%ld)\n", This, Left);
341 memcpy(&rect, &This->pos_rect, sizeof(RECT));
344 /* We don't really change the window position here.
345 * We just notify the embedder that he should do so. */
346 return IOleInPlaceSite_OnPosRectChange(This->inplace, &rect);
349 static HRESULT WINAPI WebBrowser_get_Top(IWebBrowser2 *iface, long *pl)
351 WebBrowser *This = WEBBROWSER_THIS(iface);
353 TRACE("(%p)->(%p)\n", This, pl);
355 *pl = This->pos_rect.top;
359 static HRESULT WINAPI WebBrowser_put_Top(IWebBrowser2 *iface, long Top)
361 WebBrowser *This = WEBBROWSER_THIS(iface);
364 TRACE("(%p)->(%ld)\n", This, Top);
369 memcpy(&rect, &This->pos_rect, sizeof(RECT));
372 /* We don't really change the window position here.
373 * We just notify the embedder that he should do so. */
374 return IOleInPlaceSite_OnPosRectChange(This->inplace, &rect);
377 static HRESULT WINAPI WebBrowser_get_Width(IWebBrowser2 *iface, long *pl)
379 WebBrowser *This = WEBBROWSER_THIS(iface);
381 TRACE("(%p)->(%p)\n", This, pl);
383 *pl = This->pos_rect.right - This->pos_rect.left;
387 static HRESULT WINAPI WebBrowser_put_Width(IWebBrowser2 *iface, long Width)
389 WebBrowser *This = WEBBROWSER_THIS(iface);
392 TRACE("(%p)->(%ld)\n", This, Width);
397 memcpy(&rect, &This->pos_rect, sizeof(RECT));
398 rect.right = rect.left+Width;
400 /* We don't really change the window size here.
401 * We just notify the embedder that he should do so. */
402 return IOleInPlaceSite_OnPosRectChange(This->inplace, &rect);
405 static HRESULT WINAPI WebBrowser_get_Height(IWebBrowser2 *iface, long *pl)
407 WebBrowser *This = WEBBROWSER_THIS(iface);
409 TRACE("(%p)->(%p)\n", This, pl);
411 *pl = This->pos_rect.bottom - This->pos_rect.top;
415 static HRESULT WINAPI WebBrowser_put_Height(IWebBrowser2 *iface, long Height)
417 WebBrowser *This = WEBBROWSER_THIS(iface);
420 TRACE("(%p)->(%ld)\n", This, Height);
425 memcpy(&rect, &This->pos_rect, sizeof(RECT));
426 rect.bottom = rect.top+Height;
428 /* We don't really change the window size here.
429 * We just notify the embedder that he should do so. */
430 return IOleInPlaceSite_OnPosRectChange(This->inplace, &rect);
433 static HRESULT WINAPI WebBrowser_get_LocationName(IWebBrowser2 *iface, BSTR *LocationName)
435 WebBrowser *This = WEBBROWSER_THIS(iface);
436 FIXME("(%p)->(%p)\n", This, LocationName);
440 static HRESULT WINAPI WebBrowser_get_LocationURL(IWebBrowser2 *iface, BSTR *LocationURL)
442 WebBrowser *This = WEBBROWSER_THIS(iface);
444 FIXME("(%p)->(%p)\n", This, LocationURL);
446 if(!This->doc_host.url) {
447 static const WCHAR null_char = 0;
448 *LocationURL = SysAllocString(&null_char);
452 *LocationURL = SysAllocString(This->doc_host.url);
456 static HRESULT WINAPI WebBrowser_get_Busy(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
458 WebBrowser *This = WEBBROWSER_THIS(iface);
459 FIXME("(%p)->(%p)\n", This, pBool);
463 static HRESULT WINAPI WebBrowser_Quit(IWebBrowser2 *iface)
465 WebBrowser *This = WEBBROWSER_THIS(iface);
467 TRACE("(%p)\n", This);
469 /* It's a InternetExplorer specific method, we have nothing to do here. */
473 static HRESULT WINAPI WebBrowser_ClientToWindow(IWebBrowser2 *iface, int *pcx, int *pcy)
475 WebBrowser *This = WEBBROWSER_THIS(iface);
476 FIXME("(%p)->(%p %p)\n", This, pcx, pcy);
480 static HRESULT WINAPI WebBrowser_PutProperty(IWebBrowser2 *iface, BSTR szProperty, VARIANT vtValue)
482 WebBrowser *This = WEBBROWSER_THIS(iface);
483 FIXME("(%p)->(%s)\n", This, debugstr_w(szProperty));
487 static HRESULT WINAPI WebBrowser_GetProperty(IWebBrowser2 *iface, BSTR szProperty, VARIANT *pvtValue)
489 WebBrowser *This = WEBBROWSER_THIS(iface);
490 FIXME("(%p)->(%s %p)\n", This, debugstr_w(szProperty), pvtValue);
494 static HRESULT WINAPI WebBrowser_get_Name(IWebBrowser2 *iface, BSTR *Name)
496 WebBrowser *This = WEBBROWSER_THIS(iface);
497 FIXME("(%p)->(%p)\n", This, Name);
501 static HRESULT WINAPI WebBrowser_get_HWND(IWebBrowser2 *iface, long *pHWND)
503 WebBrowser *This = WEBBROWSER_THIS(iface);
505 TRACE("(%p)->(%p)\n", This, pHWND);
507 /* WebBrowser control never has a frame window (in opposition to InternetExplorer) */
512 static HRESULT WINAPI WebBrowser_get_FullName(IWebBrowser2 *iface, BSTR *FullName)
514 WebBrowser *This = WEBBROWSER_THIS(iface);
515 FIXME("(%p)->(%p)\n", This, FullName);
519 static HRESULT WINAPI WebBrowser_get_Path(IWebBrowser2 *iface, BSTR *Path)
521 WebBrowser *This = WEBBROWSER_THIS(iface);
522 FIXME("(%p)->(%p)\n", This, Path);
526 static HRESULT WINAPI WebBrowser_get_Visible(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
528 WebBrowser *This = WEBBROWSER_THIS(iface);
530 TRACE("(%p)->(%p)\n", This, pBool);
532 *pBool = This->visible;
536 static HRESULT WINAPI WebBrowser_put_Visible(IWebBrowser2 *iface, VARIANT_BOOL Value)
538 WebBrowser *This = WEBBROWSER_THIS(iface);
540 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
542 TRACE("(%p)->(%x)\n", This, Value);
544 This->visible = Value;
546 V_VT(&arg) = VT_BOOL;
547 V_BOOL(&arg) = Value;
548 call_sink(This->doc_host.cps.wbe2, DISPID_ONVISIBLE, &dispparams);
553 static HRESULT WINAPI WebBrowser_get_StatusBar(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
555 WebBrowser *This = WEBBROWSER_THIS(iface);
557 TRACE("(%p)->(%p)\n", This, pBool);
559 *pBool = This->status_bar;
563 static HRESULT WINAPI WebBrowser_put_StatusBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
565 WebBrowser *This = WEBBROWSER_THIS(iface);
567 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
569 TRACE("(%p)->(%x)\n", This, Value);
571 This->status_bar = Value ? VARIANT_TRUE : VARIANT_FALSE;
573 /* In opposition to InternetExplorer, all we should do here is
574 * inform the embedder about the status bar change. */
576 V_VT(&arg) = VT_BOOL;
577 V_BOOL(&arg) = Value;
578 call_sink(This->doc_host.cps.wbe2, DISPID_ONSTATUSBAR, &dispparams);
583 static HRESULT WINAPI WebBrowser_get_StatusText(IWebBrowser2 *iface, BSTR *StatusText)
585 WebBrowser *This = WEBBROWSER_THIS(iface);
586 FIXME("(%p)->(%p)\n", This, StatusText);
590 static HRESULT WINAPI WebBrowser_put_StatusText(IWebBrowser2 *iface, BSTR StatusText)
592 WebBrowser *This = WEBBROWSER_THIS(iface);
593 FIXME("(%p)->(%s)\n", This, debugstr_w(StatusText));
597 static HRESULT WINAPI WebBrowser_get_ToolBar(IWebBrowser2 *iface, int *Value)
599 WebBrowser *This = WEBBROWSER_THIS(iface);
601 TRACE("(%p)->(%p)\n", This, Value);
603 *Value = This->tool_bar;
607 static HRESULT WINAPI WebBrowser_put_ToolBar(IWebBrowser2 *iface, int Value)
609 WebBrowser *This = WEBBROWSER_THIS(iface);
611 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
613 TRACE("(%p)->(%x)\n", This, Value);
615 This->tool_bar = Value ? VARIANT_TRUE : VARIANT_FALSE;
617 /* In opposition to InternetExplorer, all we should do here is
618 * inform the embedder about the tool bar change. */
620 V_VT(&arg) = VT_BOOL;
621 V_BOOL(&arg) = Value;
622 call_sink(This->doc_host.cps.wbe2, DISPID_ONTOOLBAR, &dispparams);
627 static HRESULT WINAPI WebBrowser_get_MenuBar(IWebBrowser2 *iface, VARIANT_BOOL *Value)
629 WebBrowser *This = WEBBROWSER_THIS(iface);
631 TRACE("(%p)->(%p)\n", This, Value);
633 *Value = This->menu_bar;
637 static HRESULT WINAPI WebBrowser_put_MenuBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
639 WebBrowser *This = WEBBROWSER_THIS(iface);
641 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
643 TRACE("(%p)->(%x)\n", This, Value);
645 This->menu_bar = Value ? VARIANT_TRUE : VARIANT_FALSE;
647 /* In opposition to InternetExplorer, all we should do here is
648 * inform the embedder about the menu bar change. */
650 V_VT(&arg) = VT_BOOL;
651 V_BOOL(&arg) = Value;
652 call_sink(This->doc_host.cps.wbe2, DISPID_ONMENUBAR, &dispparams);
657 static HRESULT WINAPI WebBrowser_get_FullScreen(IWebBrowser2 *iface, VARIANT_BOOL *pbFullScreen)
659 WebBrowser *This = WEBBROWSER_THIS(iface);
661 TRACE("(%p)->(%p)\n", This, pbFullScreen);
663 *pbFullScreen = This->full_screen;
667 static HRESULT WINAPI WebBrowser_put_FullScreen(IWebBrowser2 *iface, VARIANT_BOOL bFullScreen)
669 WebBrowser *This = WEBBROWSER_THIS(iface);
671 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
673 /* In opposition to InternetExplorer, all we should do here is
674 * inform the embedder about the fullscreen change. */
676 TRACE("(%p)->(%x)\n", This, bFullScreen);
678 This->full_screen = bFullScreen ? VARIANT_TRUE : VARIANT_FALSE;
680 V_VT(&arg) = VT_BOOL;
681 V_BOOL(&arg) = bFullScreen;
682 call_sink(This->doc_host.cps.wbe2, DISPID_ONFULLSCREEN, &dispparams);
687 static HRESULT WINAPI WebBrowser_Navigate2(IWebBrowser2 *iface, VARIANT *URL, VARIANT *Flags,
688 VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
690 WebBrowser *This = WEBBROWSER_THIS(iface);
692 TRACE("(%p)->(%p %p %p %p %p)\n", This, URL, Flags, TargetFrameName, PostData, Headers);
700 if(V_VT(URL) != VT_BSTR) {
701 FIXME("Unsupported V_VT(URL) %d\n", V_VT(URL));
705 return navigate_url(&This->doc_host, V_BSTR(URL), Flags, TargetFrameName, PostData, Headers);
708 static HRESULT WINAPI WebBrowser_QueryStatusWB(IWebBrowser2 *iface, OLECMDID cmdID, OLECMDF *pcmdf)
710 WebBrowser *This = WEBBROWSER_THIS(iface);
711 FIXME("(%p)->(%d %p)\n", This, cmdID, pcmdf);
715 static HRESULT WINAPI WebBrowser_ExecWB(IWebBrowser2 *iface, OLECMDID cmdID,
716 OLECMDEXECOPT cmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
718 WebBrowser *This = WEBBROWSER_THIS(iface);
719 FIXME("(%p)->(%d %d %p %p)\n", This, cmdID, cmdexecopt, pvaIn, pvaOut);
723 static HRESULT WINAPI WebBrowser_ShowBrowserBar(IWebBrowser2 *iface, VARIANT *pvaClsid,
724 VARIANT *pvarShow, VARIANT *pvarSize)
726 WebBrowser *This = WEBBROWSER_THIS(iface);
727 FIXME("(%p)->(%p %p %p)\n", This, pvaClsid, pvarShow, pvarSize);
731 static HRESULT WINAPI WebBrowser_get_ReadyState(IWebBrowser2 *iface, READYSTATE *lpReadyState)
733 WebBrowser *This = WEBBROWSER_THIS(iface);
734 FIXME("(%p)->(%p)\n", This, lpReadyState);
738 static HRESULT WINAPI WebBrowser_get_Offline(IWebBrowser2 *iface, VARIANT_BOOL *pbOffline)
740 WebBrowser *This = WEBBROWSER_THIS(iface);
742 TRACE("(%p)->(%p)\n", This, pbOffline);
744 *pbOffline = This->doc_host.offline;
748 static HRESULT WINAPI WebBrowser_put_Offline(IWebBrowser2 *iface, VARIANT_BOOL bOffline)
750 WebBrowser *This = WEBBROWSER_THIS(iface);
752 TRACE("(%p)->(%x)\n", This, bOffline);
754 This->doc_host.offline = bOffline ? VARIANT_TRUE : VARIANT_FALSE;
758 static HRESULT WINAPI WebBrowser_get_Silent(IWebBrowser2 *iface, VARIANT_BOOL *pbSilent)
760 WebBrowser *This = WEBBROWSER_THIS(iface);
762 TRACE("(%p)->(%p)\n", This, pbSilent);
764 *pbSilent = This->doc_host.silent;
768 static HRESULT WINAPI WebBrowser_put_Silent(IWebBrowser2 *iface, VARIANT_BOOL bSilent)
770 WebBrowser *This = WEBBROWSER_THIS(iface);
772 TRACE("(%p)->(%x)\n", This, bSilent);
774 This->doc_host.silent = bSilent ? VARIANT_TRUE : VARIANT_FALSE;
778 static HRESULT WINAPI WebBrowser_get_RegisterAsBrowser(IWebBrowser2 *iface,
779 VARIANT_BOOL *pbRegister)
781 WebBrowser *This = WEBBROWSER_THIS(iface);
782 FIXME("(%p)->(%p)\n", This, pbRegister);
786 static HRESULT WINAPI WebBrowser_put_RegisterAsBrowser(IWebBrowser2 *iface,
787 VARIANT_BOOL bRegister)
789 WebBrowser *This = WEBBROWSER_THIS(iface);
790 FIXME("(%p)->(%x)\n", This, bRegister);
794 static HRESULT WINAPI WebBrowser_get_RegisterAsDropTarget(IWebBrowser2 *iface,
795 VARIANT_BOOL *pbRegister)
797 WebBrowser *This = WEBBROWSER_THIS(iface);
798 FIXME("(%p)->(%p)\n", This, pbRegister);
802 static HRESULT WINAPI WebBrowser_put_RegisterAsDropTarget(IWebBrowser2 *iface,
803 VARIANT_BOOL bRegister)
805 WebBrowser *This = WEBBROWSER_THIS(iface);
806 FIXME("(%p)->(%x)\n", This, bRegister);
810 static HRESULT WINAPI WebBrowser_get_TheaterMode(IWebBrowser2 *iface, VARIANT_BOOL *pbRegister)
812 WebBrowser *This = WEBBROWSER_THIS(iface);
813 FIXME("(%p)->(%p)\n", This, pbRegister);
817 static HRESULT WINAPI WebBrowser_put_TheaterMode(IWebBrowser2 *iface, VARIANT_BOOL bRegister)
819 WebBrowser *This = WEBBROWSER_THIS(iface);
820 FIXME("(%p)->(%x)\n", This, bRegister);
824 static HRESULT WINAPI WebBrowser_get_AddressBar(IWebBrowser2 *iface, VARIANT_BOOL *Value)
826 WebBrowser *This = WEBBROWSER_THIS(iface);
828 TRACE("(%p)->(%p)\n", This, Value);
830 *Value = This->address_bar;
834 static HRESULT WINAPI WebBrowser_put_AddressBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
836 WebBrowser *This = WEBBROWSER_THIS(iface);
838 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
840 TRACE("(%p)->(%x)\n", This, Value);
842 This->address_bar = Value ? VARIANT_TRUE : VARIANT_FALSE;
844 /* In opposition to InternetExplorer, all we should do here is
845 * inform the embedder about the address bar change. */
847 V_VT(&arg) = VT_BOOL;
848 V_BOOL(&arg) = Value;
849 call_sink(This->doc_host.cps.wbe2, DISPID_ONADDRESSBAR, &dispparams);
854 static HRESULT WINAPI WebBrowser_get_Resizable(IWebBrowser2 *iface, VARIANT_BOOL *Value)
856 WebBrowser *This = WEBBROWSER_THIS(iface);
858 TRACE("(%p)->(%p)\n", This, Value);
860 /* It's InternetExplorer object's method. We have nothing to do here. */
864 static HRESULT WINAPI WebBrowser_put_Resizable(IWebBrowser2 *iface, VARIANT_BOOL Value)
866 WebBrowser *This = WEBBROWSER_THIS(iface);
868 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
870 TRACE("(%p)->(%x)\n", This, Value);
872 /* In opposition to InternetExplorer, all we should do here is
873 * inform the embedder about the resizable change. */
875 V_VT(&arg) = VT_BOOL;
876 V_BOOL(&arg) = Value;
877 call_sink(This->doc_host.cps.wbe2, DISPID_WINDOWSETRESIZABLE, &dispparams);
882 #undef WEBBROWSER_THIS
884 static const IWebBrowser2Vtbl WebBrowser2Vtbl =
886 WebBrowser_QueryInterface,
889 WebBrowser_GetTypeInfoCount,
890 WebBrowser_GetTypeInfo,
891 WebBrowser_GetIDsOfNames,
894 WebBrowser_GoForward,
901 WebBrowser_get_Application,
902 WebBrowser_get_Parent,
903 WebBrowser_get_Container,
904 WebBrowser_get_Document,
905 WebBrowser_get_TopLevelContainer,
911 WebBrowser_get_Width,
912 WebBrowser_put_Width,
913 WebBrowser_get_Height,
914 WebBrowser_put_Height,
915 WebBrowser_get_LocationName,
916 WebBrowser_get_LocationURL,
919 WebBrowser_ClientToWindow,
920 WebBrowser_PutProperty,
921 WebBrowser_GetProperty,
924 WebBrowser_get_FullName,
926 WebBrowser_get_Visible,
927 WebBrowser_put_Visible,
928 WebBrowser_get_StatusBar,
929 WebBrowser_put_StatusBar,
930 WebBrowser_get_StatusText,
931 WebBrowser_put_StatusText,
932 WebBrowser_get_ToolBar,
933 WebBrowser_put_ToolBar,
934 WebBrowser_get_MenuBar,
935 WebBrowser_put_MenuBar,
936 WebBrowser_get_FullScreen,
937 WebBrowser_put_FullScreen,
938 WebBrowser_Navigate2,
939 WebBrowser_QueryStatusWB,
941 WebBrowser_ShowBrowserBar,
942 WebBrowser_get_ReadyState,
943 WebBrowser_get_Offline,
944 WebBrowser_put_Offline,
945 WebBrowser_get_Silent,
946 WebBrowser_put_Silent,
947 WebBrowser_get_RegisterAsBrowser,
948 WebBrowser_put_RegisterAsBrowser,
949 WebBrowser_get_RegisterAsDropTarget,
950 WebBrowser_put_RegisterAsDropTarget,
951 WebBrowser_get_TheaterMode,
952 WebBrowser_put_TheaterMode,
953 WebBrowser_get_AddressBar,
954 WebBrowser_put_AddressBar,
955 WebBrowser_get_Resizable,
956 WebBrowser_put_Resizable
959 static HRESULT WebBrowser_Create(INT version, IUnknown *pOuter, REFIID riid, void **ppv)
964 TRACE("(%p %s %p) version=%d\n", pOuter, debugstr_guid(riid), ppv, version);
966 ret = heap_alloc(sizeof(WebBrowser));
968 ret->lpWebBrowser2Vtbl = &WebBrowser2Vtbl;
970 ret->version = version;
972 DocHost_Init(&ret->doc_host, (IDispatch*)WEBBROWSER2(ret));
974 ret->visible = VARIANT_TRUE;
975 ret->menu_bar = VARIANT_TRUE;
976 ret->address_bar = VARIANT_TRUE;
977 ret->status_bar = VARIANT_TRUE;
978 ret->tool_bar = VARIANT_TRUE;
979 ret->full_screen = VARIANT_FALSE;
981 WebBrowser_OleObject_Init(ret);
982 WebBrowser_ViewObject_Init(ret);
983 WebBrowser_Persist_Init(ret);
984 WebBrowser_ClassInfo_Init(ret);
985 WebBrowser_HlinkFrame_Init(ret);
987 hres = IWebBrowser_QueryInterface(WEBBROWSER(ret), riid, ppv);
988 if(SUCCEEDED(hres)) {
989 SHDOCVW_LockModule();
998 HRESULT WebBrowserV1_Create(IUnknown *pOuter, REFIID riid, void **ppv)
1000 return WebBrowser_Create(1, pOuter, riid, ppv);
1003 HRESULT WebBrowserV2_Create(IUnknown *pOuter, REFIID riid, void **ppv)
1005 return WebBrowser_Create(2, pOuter, riid, ppv);