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;
117 }else if(IsEqualGUID(&IID_IOleInPlaceSite, riid)) {
118 TRACE("(%p)->(IID_IOleInPlaceSite %p) returning NULL\n", This, ppv);
119 return E_NOINTERFACE;
120 }else if(IsEqualGUID(&IID_IObjectWithSite, riid)) {
121 TRACE("(%p)->(IID_IObjectWithSite %p) returning NULL\n", This, ppv);
122 return E_NOINTERFACE;
123 }else if(IsEqualGUID(&IID_IViewObjectEx, riid)) {
124 TRACE("(%p)->(IID_IViewObjectEx %p) returning NULL\n", This, ppv);
125 return E_NOINTERFACE;
129 IUnknown_AddRef((IUnknown*)*ppv);
133 FIXME("(%p)->(%s %p) interface not supported\n", This, debugstr_guid(riid), ppv);
134 return E_NOINTERFACE;
137 static ULONG WINAPI WebBrowser_AddRef(IWebBrowser2 *iface)
139 WebBrowser *This = WEBBROWSER_THIS(iface);
140 LONG ref = InterlockedIncrement(&This->ref);
141 TRACE("(%p) ref=%d\n", This, ref);
145 static ULONG WINAPI WebBrowser_Release(IWebBrowser2 *iface)
147 WebBrowser *This = WEBBROWSER_THIS(iface);
148 LONG ref = InterlockedDecrement(&This->ref);
150 TRACE("(%p) ref=%d\n", This, ref);
153 if(This->doc_host.document)
154 IUnknown_Release(This->doc_host.document);
156 DocHost_Release(&This->doc_host);
158 WebBrowser_OleObject_Destroy(This);
161 SHDOCVW_UnlockModule();
167 /* IDispatch methods */
168 static HRESULT WINAPI WebBrowser_GetTypeInfoCount(IWebBrowser2 *iface, UINT *pctinfo)
170 WebBrowser *This = WEBBROWSER_THIS(iface);
172 TRACE("(%p)->(%p)\n", This, pctinfo);
178 static HRESULT WINAPI WebBrowser_GetTypeInfo(IWebBrowser2 *iface, UINT iTInfo, LCID lcid,
181 WebBrowser *This = WEBBROWSER_THIS(iface);
185 TRACE("(%p)->(%d %d %p)\n", This, iTInfo, lcid, ppTInfo);
187 hres = get_typeinfo(&typeinfo);
191 ITypeInfo_AddRef(typeinfo);
196 static HRESULT WINAPI WebBrowser_GetIDsOfNames(IWebBrowser2 *iface, REFIID riid,
197 LPOLESTR *rgszNames, UINT cNames,
198 LCID lcid, DISPID *rgDispId)
200 WebBrowser *This = WEBBROWSER_THIS(iface);
204 TRACE("(%p)->(%s %p %d %d %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
207 hres = get_typeinfo(&typeinfo);
211 return ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
214 static HRESULT WINAPI WebBrowser_Invoke(IWebBrowser2 *iface, DISPID dispIdMember,
215 REFIID riid, LCID lcid, WORD wFlags,
216 DISPPARAMS *pDispParams, VARIANT *pVarResult,
217 EXCEPINFO *pExepInfo, UINT *puArgErr)
219 WebBrowser *This = WEBBROWSER_THIS(iface);
223 TRACE("(%p)->(%d %s %d %08x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
224 lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
226 hres = get_typeinfo(&typeinfo);
230 return ITypeInfo_Invoke(typeinfo, WEBBROWSER2(This), dispIdMember, wFlags, pDispParams,
231 pVarResult, pExepInfo, puArgErr);
234 /* IWebBrowser methods */
235 static HRESULT WINAPI WebBrowser_GoBack(IWebBrowser2 *iface)
237 WebBrowser *This = WEBBROWSER_THIS(iface);
238 FIXME("(%p)\n", This);
242 static HRESULT WINAPI WebBrowser_GoForward(IWebBrowser2 *iface)
244 WebBrowser *This = WEBBROWSER_THIS(iface);
245 FIXME("(%p)\n", This);
249 static HRESULT WINAPI WebBrowser_GoHome(IWebBrowser2 *iface)
251 WebBrowser *This = WEBBROWSER_THIS(iface);
252 TRACE("(%p)\n", This);
253 return go_home(&This->doc_host);
256 static HRESULT WINAPI WebBrowser_GoSearch(IWebBrowser2 *iface)
258 WebBrowser *This = WEBBROWSER_THIS(iface);
259 FIXME("(%p)\n", This);
263 static HRESULT WINAPI WebBrowser_Navigate(IWebBrowser2 *iface, BSTR szUrl,
264 VARIANT *Flags, VARIANT *TargetFrameName,
265 VARIANT *PostData, VARIANT *Headers)
267 WebBrowser *This = WEBBROWSER_THIS(iface);
269 TRACE("(%p)->(%s %p %p %p %p)\n", This, debugstr_w(szUrl), Flags, TargetFrameName,
272 return navigate_url(&This->doc_host, szUrl, Flags, TargetFrameName, PostData, Headers);
275 static HRESULT WINAPI WebBrowser_Refresh(IWebBrowser2 *iface)
277 WebBrowser *This = WEBBROWSER_THIS(iface);
278 FIXME("(%p)\n", This);
282 static HRESULT WINAPI WebBrowser_Refresh2(IWebBrowser2 *iface, VARIANT *Level)
284 WebBrowser *This = WEBBROWSER_THIS(iface);
285 FIXME("(%p)->(%p)\n", This, Level);
289 static HRESULT WINAPI WebBrowser_Stop(IWebBrowser2 *iface)
291 WebBrowser *This = WEBBROWSER_THIS(iface);
292 FIXME("(%p)\n", This);
296 static HRESULT WINAPI WebBrowser_get_Application(IWebBrowser2 *iface, IDispatch **ppDisp)
298 WebBrowser *This = WEBBROWSER_THIS(iface);
300 TRACE("(%p)->(%p)\n", This, ppDisp);
305 *ppDisp = (IDispatch*)WEBBROWSER2(This);
306 IDispatch_AddRef(*ppDisp);
310 static HRESULT WINAPI WebBrowser_get_Parent(IWebBrowser2 *iface, IDispatch **ppDisp)
312 WebBrowser *This = WEBBROWSER_THIS(iface);
313 FIXME("(%p)->(%p)\n", This, ppDisp);
317 static HRESULT WINAPI WebBrowser_get_Container(IWebBrowser2 *iface, IDispatch **ppDisp)
319 WebBrowser *This = WEBBROWSER_THIS(iface);
320 FIXME("(%p)->(%p)\n", This, ppDisp);
324 static HRESULT WINAPI WebBrowser_get_Document(IWebBrowser2 *iface, IDispatch **ppDisp)
326 WebBrowser *This = WEBBROWSER_THIS(iface);
328 TRACE("(%p)->(%p)\n", This, ppDisp);
331 if(This->doc_host.document)
332 IUnknown_QueryInterface(This->doc_host.document, &IID_IDispatch, (void**)ppDisp);
337 static HRESULT WINAPI WebBrowser_get_TopLevelContainer(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
339 WebBrowser *This = WEBBROWSER_THIS(iface);
340 FIXME("(%p)->(%p)\n", This, pBool);
344 static HRESULT WINAPI WebBrowser_get_Type(IWebBrowser2 *iface, BSTR *Type)
346 WebBrowser *This = WEBBROWSER_THIS(iface);
347 FIXME("(%p)->(%p)\n", This, Type);
351 static HRESULT WINAPI WebBrowser_get_Left(IWebBrowser2 *iface, long *pl)
353 WebBrowser *This = WEBBROWSER_THIS(iface);
355 TRACE("(%p)->(%p)\n", This, pl);
357 *pl = This->pos_rect.left;
361 static HRESULT WINAPI WebBrowser_put_Left(IWebBrowser2 *iface, long Left)
363 WebBrowser *This = WEBBROWSER_THIS(iface);
366 TRACE("(%p)->(%ld)\n", This, Left);
371 rect = This->pos_rect;
374 /* We don't really change the window position here.
375 * We just notify the embedder that he should do so. */
376 return IOleInPlaceSite_OnPosRectChange(This->inplace, &rect);
379 static HRESULT WINAPI WebBrowser_get_Top(IWebBrowser2 *iface, long *pl)
381 WebBrowser *This = WEBBROWSER_THIS(iface);
383 TRACE("(%p)->(%p)\n", This, pl);
385 *pl = This->pos_rect.top;
389 static HRESULT WINAPI WebBrowser_put_Top(IWebBrowser2 *iface, long Top)
391 WebBrowser *This = WEBBROWSER_THIS(iface);
394 TRACE("(%p)->(%ld)\n", This, Top);
399 rect = This->pos_rect;
402 /* We don't really change the window position here.
403 * We just notify the embedder that he should do so. */
404 return IOleInPlaceSite_OnPosRectChange(This->inplace, &rect);
407 static HRESULT WINAPI WebBrowser_get_Width(IWebBrowser2 *iface, long *pl)
409 WebBrowser *This = WEBBROWSER_THIS(iface);
411 TRACE("(%p)->(%p)\n", This, pl);
413 *pl = This->pos_rect.right - This->pos_rect.left;
417 static HRESULT WINAPI WebBrowser_put_Width(IWebBrowser2 *iface, long Width)
419 WebBrowser *This = WEBBROWSER_THIS(iface);
422 TRACE("(%p)->(%ld)\n", This, Width);
427 rect = This->pos_rect;
428 rect.right = rect.left+Width;
430 /* We don't really change the window size here.
431 * We just notify the embedder that he should do so. */
432 return IOleInPlaceSite_OnPosRectChange(This->inplace, &rect);
435 static HRESULT WINAPI WebBrowser_get_Height(IWebBrowser2 *iface, long *pl)
437 WebBrowser *This = WEBBROWSER_THIS(iface);
439 TRACE("(%p)->(%p)\n", This, pl);
441 *pl = This->pos_rect.bottom - This->pos_rect.top;
445 static HRESULT WINAPI WebBrowser_put_Height(IWebBrowser2 *iface, long Height)
447 WebBrowser *This = WEBBROWSER_THIS(iface);
450 TRACE("(%p)->(%ld)\n", This, Height);
455 rect = This->pos_rect;
456 rect.bottom = rect.top+Height;
458 /* We don't really change the window size here.
459 * We just notify the embedder that he should do so. */
460 return IOleInPlaceSite_OnPosRectChange(This->inplace, &rect);
463 static HRESULT WINAPI WebBrowser_get_LocationName(IWebBrowser2 *iface, BSTR *LocationName)
465 WebBrowser *This = WEBBROWSER_THIS(iface);
466 FIXME("(%p)->(%p)\n", This, LocationName);
470 static HRESULT WINAPI WebBrowser_get_LocationURL(IWebBrowser2 *iface, BSTR *LocationURL)
472 WebBrowser *This = WEBBROWSER_THIS(iface);
474 FIXME("(%p)->(%p)\n", This, LocationURL);
476 if(!This->doc_host.url) {
477 static const WCHAR null_char = 0;
478 *LocationURL = SysAllocString(&null_char);
482 *LocationURL = SysAllocString(This->doc_host.url);
486 static HRESULT WINAPI WebBrowser_get_Busy(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
488 WebBrowser *This = WEBBROWSER_THIS(iface);
490 TRACE("(%p)->(%p)\n", This, pBool);
492 *pBool = This->doc_host.busy;
496 static HRESULT WINAPI WebBrowser_Quit(IWebBrowser2 *iface)
498 WebBrowser *This = WEBBROWSER_THIS(iface);
500 TRACE("(%p)\n", This);
502 /* It's a InternetExplorer specific method, we have nothing to do here. */
506 static HRESULT WINAPI WebBrowser_ClientToWindow(IWebBrowser2 *iface, int *pcx, int *pcy)
508 WebBrowser *This = WEBBROWSER_THIS(iface);
509 FIXME("(%p)->(%p %p)\n", This, pcx, pcy);
513 static HRESULT WINAPI WebBrowser_PutProperty(IWebBrowser2 *iface, BSTR szProperty, VARIANT vtValue)
515 WebBrowser *This = WEBBROWSER_THIS(iface);
516 FIXME("(%p)->(%s)\n", This, debugstr_w(szProperty));
520 static HRESULT WINAPI WebBrowser_GetProperty(IWebBrowser2 *iface, BSTR szProperty, VARIANT *pvtValue)
522 WebBrowser *This = WEBBROWSER_THIS(iface);
523 FIXME("(%p)->(%s %p)\n", This, debugstr_w(szProperty), pvtValue);
527 static HRESULT WINAPI WebBrowser_get_Name(IWebBrowser2 *iface, BSTR *Name)
529 WebBrowser *This = WEBBROWSER_THIS(iface);
530 FIXME("(%p)->(%p)\n", This, Name);
534 static HRESULT WINAPI WebBrowser_get_HWND(IWebBrowser2 *iface, long *pHWND)
536 WebBrowser *This = WEBBROWSER_THIS(iface);
538 TRACE("(%p)->(%p)\n", This, pHWND);
540 /* WebBrowser control never has a frame window (in opposition to InternetExplorer) */
545 static HRESULT WINAPI WebBrowser_get_FullName(IWebBrowser2 *iface, BSTR *FullName)
547 WebBrowser *This = WEBBROWSER_THIS(iface);
548 FIXME("(%p)->(%p)\n", This, FullName);
552 static HRESULT WINAPI WebBrowser_get_Path(IWebBrowser2 *iface, BSTR *Path)
554 WebBrowser *This = WEBBROWSER_THIS(iface);
555 FIXME("(%p)->(%p)\n", This, Path);
559 static HRESULT WINAPI WebBrowser_get_Visible(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
561 WebBrowser *This = WEBBROWSER_THIS(iface);
563 TRACE("(%p)->(%p)\n", This, pBool);
565 *pBool = This->visible;
569 static HRESULT WINAPI WebBrowser_put_Visible(IWebBrowser2 *iface, VARIANT_BOOL Value)
571 WebBrowser *This = WEBBROWSER_THIS(iface);
573 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
575 TRACE("(%p)->(%x)\n", This, Value);
577 This->visible = Value;
579 V_VT(&arg) = VT_BOOL;
580 V_BOOL(&arg) = Value;
581 call_sink(This->doc_host.cps.wbe2, DISPID_ONVISIBLE, &dispparams);
586 static HRESULT WINAPI WebBrowser_get_StatusBar(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
588 WebBrowser *This = WEBBROWSER_THIS(iface);
590 TRACE("(%p)->(%p)\n", This, pBool);
592 *pBool = This->status_bar;
596 static HRESULT WINAPI WebBrowser_put_StatusBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
598 WebBrowser *This = WEBBROWSER_THIS(iface);
600 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
602 TRACE("(%p)->(%x)\n", This, Value);
604 This->status_bar = Value ? VARIANT_TRUE : VARIANT_FALSE;
606 /* In opposition to InternetExplorer, all we should do here is
607 * inform the embedder about the status bar change. */
609 V_VT(&arg) = VT_BOOL;
610 V_BOOL(&arg) = Value;
611 call_sink(This->doc_host.cps.wbe2, DISPID_ONSTATUSBAR, &dispparams);
616 static HRESULT WINAPI WebBrowser_get_StatusText(IWebBrowser2 *iface, BSTR *StatusText)
618 WebBrowser *This = WEBBROWSER_THIS(iface);
619 FIXME("(%p)->(%p)\n", This, StatusText);
623 static HRESULT WINAPI WebBrowser_put_StatusText(IWebBrowser2 *iface, BSTR StatusText)
625 WebBrowser *This = WEBBROWSER_THIS(iface);
626 FIXME("(%p)->(%s)\n", This, debugstr_w(StatusText));
630 static HRESULT WINAPI WebBrowser_get_ToolBar(IWebBrowser2 *iface, int *Value)
632 WebBrowser *This = WEBBROWSER_THIS(iface);
634 TRACE("(%p)->(%p)\n", This, Value);
636 *Value = This->tool_bar;
640 static HRESULT WINAPI WebBrowser_put_ToolBar(IWebBrowser2 *iface, int Value)
642 WebBrowser *This = WEBBROWSER_THIS(iface);
644 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
646 TRACE("(%p)->(%x)\n", This, Value);
648 This->tool_bar = Value ? VARIANT_TRUE : VARIANT_FALSE;
650 /* In opposition to InternetExplorer, all we should do here is
651 * inform the embedder about the tool bar change. */
653 V_VT(&arg) = VT_BOOL;
654 V_BOOL(&arg) = This->tool_bar;
655 call_sink(This->doc_host.cps.wbe2, DISPID_ONTOOLBAR, &dispparams);
660 static HRESULT WINAPI WebBrowser_get_MenuBar(IWebBrowser2 *iface, VARIANT_BOOL *Value)
662 WebBrowser *This = WEBBROWSER_THIS(iface);
664 TRACE("(%p)->(%p)\n", This, Value);
666 *Value = This->menu_bar;
670 static HRESULT WINAPI WebBrowser_put_MenuBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
672 WebBrowser *This = WEBBROWSER_THIS(iface);
674 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
676 TRACE("(%p)->(%x)\n", This, Value);
678 This->menu_bar = Value ? VARIANT_TRUE : VARIANT_FALSE;
680 /* In opposition to InternetExplorer, all we should do here is
681 * inform the embedder about the menu bar change. */
683 V_VT(&arg) = VT_BOOL;
684 V_BOOL(&arg) = Value;
685 call_sink(This->doc_host.cps.wbe2, DISPID_ONMENUBAR, &dispparams);
690 static HRESULT WINAPI WebBrowser_get_FullScreen(IWebBrowser2 *iface, VARIANT_BOOL *pbFullScreen)
692 WebBrowser *This = WEBBROWSER_THIS(iface);
694 TRACE("(%p)->(%p)\n", This, pbFullScreen);
696 *pbFullScreen = This->full_screen;
700 static HRESULT WINAPI WebBrowser_put_FullScreen(IWebBrowser2 *iface, VARIANT_BOOL bFullScreen)
702 WebBrowser *This = WEBBROWSER_THIS(iface);
704 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
706 /* In opposition to InternetExplorer, all we should do here is
707 * inform the embedder about the fullscreen change. */
709 TRACE("(%p)->(%x)\n", This, bFullScreen);
711 This->full_screen = bFullScreen ? VARIANT_TRUE : VARIANT_FALSE;
713 V_VT(&arg) = VT_BOOL;
714 V_BOOL(&arg) = bFullScreen;
715 call_sink(This->doc_host.cps.wbe2, DISPID_ONFULLSCREEN, &dispparams);
720 static HRESULT WINAPI WebBrowser_Navigate2(IWebBrowser2 *iface, VARIANT *URL, VARIANT *Flags,
721 VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
723 WebBrowser *This = WEBBROWSER_THIS(iface);
725 TRACE("(%p)->(%p %p %p %p %p)\n", This, URL, Flags, TargetFrameName, PostData, Headers);
733 if(V_VT(URL) != VT_BSTR) {
734 FIXME("Unsupported V_VT(URL) %d\n", V_VT(URL));
738 return navigate_url(&This->doc_host, V_BSTR(URL), Flags, TargetFrameName, PostData, Headers);
741 static HRESULT WINAPI WebBrowser_QueryStatusWB(IWebBrowser2 *iface, OLECMDID cmdID, OLECMDF *pcmdf)
743 WebBrowser *This = WEBBROWSER_THIS(iface);
744 FIXME("(%p)->(%d %p)\n", This, cmdID, pcmdf);
748 static HRESULT WINAPI WebBrowser_ExecWB(IWebBrowser2 *iface, OLECMDID cmdID,
749 OLECMDEXECOPT cmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
751 WebBrowser *This = WEBBROWSER_THIS(iface);
752 FIXME("(%p)->(%d %d %p %p)\n", This, cmdID, cmdexecopt, pvaIn, pvaOut);
756 static HRESULT WINAPI WebBrowser_ShowBrowserBar(IWebBrowser2 *iface, VARIANT *pvaClsid,
757 VARIANT *pvarShow, VARIANT *pvarSize)
759 WebBrowser *This = WEBBROWSER_THIS(iface);
760 FIXME("(%p)->(%p %p %p)\n", This, pvaClsid, pvarShow, pvarSize);
764 static HRESULT WINAPI WebBrowser_get_ReadyState(IWebBrowser2 *iface, READYSTATE *lpReadyState)
766 WebBrowser *This = WEBBROWSER_THIS(iface);
767 FIXME("(%p)->(%p)\n", This, lpReadyState);
769 *lpReadyState = READYSTATE_COMPLETE;
773 static HRESULT WINAPI WebBrowser_get_Offline(IWebBrowser2 *iface, VARIANT_BOOL *pbOffline)
775 WebBrowser *This = WEBBROWSER_THIS(iface);
777 TRACE("(%p)->(%p)\n", This, pbOffline);
779 *pbOffline = This->doc_host.offline;
783 static HRESULT WINAPI WebBrowser_put_Offline(IWebBrowser2 *iface, VARIANT_BOOL bOffline)
785 WebBrowser *This = WEBBROWSER_THIS(iface);
787 TRACE("(%p)->(%x)\n", This, bOffline);
789 This->doc_host.offline = bOffline ? VARIANT_TRUE : VARIANT_FALSE;
793 static HRESULT WINAPI WebBrowser_get_Silent(IWebBrowser2 *iface, VARIANT_BOOL *pbSilent)
795 WebBrowser *This = WEBBROWSER_THIS(iface);
797 TRACE("(%p)->(%p)\n", This, pbSilent);
799 *pbSilent = This->doc_host.silent;
803 static HRESULT WINAPI WebBrowser_put_Silent(IWebBrowser2 *iface, VARIANT_BOOL bSilent)
805 WebBrowser *This = WEBBROWSER_THIS(iface);
807 TRACE("(%p)->(%x)\n", This, bSilent);
809 This->doc_host.silent = bSilent ? VARIANT_TRUE : VARIANT_FALSE;
813 static HRESULT WINAPI WebBrowser_get_RegisterAsBrowser(IWebBrowser2 *iface,
814 VARIANT_BOOL *pbRegister)
816 WebBrowser *This = WEBBROWSER_THIS(iface);
818 FIXME("(%p)->(%p)\n", This, pbRegister);
820 *pbRegister = This->register_browser;
824 static HRESULT WINAPI WebBrowser_put_RegisterAsBrowser(IWebBrowser2 *iface,
825 VARIANT_BOOL bRegister)
827 WebBrowser *This = WEBBROWSER_THIS(iface);
829 FIXME("(%p)->(%x)\n", This, bRegister);
831 This->register_browser = bRegister ? VARIANT_TRUE : VARIANT_FALSE;
835 static HRESULT WINAPI WebBrowser_get_RegisterAsDropTarget(IWebBrowser2 *iface,
836 VARIANT_BOOL *pbRegister)
838 WebBrowser *This = WEBBROWSER_THIS(iface);
839 FIXME("(%p)->(%p)\n", This, pbRegister);
844 static HRESULT WINAPI WebBrowser_put_RegisterAsDropTarget(IWebBrowser2 *iface,
845 VARIANT_BOOL bRegister)
847 WebBrowser *This = WEBBROWSER_THIS(iface);
848 FIXME("(%p)->(%x)\n", This, bRegister);
852 static HRESULT WINAPI WebBrowser_get_TheaterMode(IWebBrowser2 *iface, VARIANT_BOOL *pbRegister)
854 WebBrowser *This = WEBBROWSER_THIS(iface);
856 TRACE("(%p)->(%p)\n", This, pbRegister);
858 *pbRegister = This->theater_mode;
862 static HRESULT WINAPI WebBrowser_put_TheaterMode(IWebBrowser2 *iface, VARIANT_BOOL bRegister)
864 WebBrowser *This = WEBBROWSER_THIS(iface);
866 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
868 TRACE("(%p)->(%x)\n", This, bRegister);
870 This->theater_mode = bRegister ? VARIANT_TRUE : VARIANT_FALSE;
872 /* In opposition to InternetExplorer, all we should do here is
873 * inform the embedder about the theater mode change. */
875 V_VT(&arg) = VT_BOOL;
876 V_BOOL(&arg) = bRegister;
877 call_sink(This->doc_host.cps.wbe2, DISPID_ONTHEATERMODE, &dispparams);
882 static HRESULT WINAPI WebBrowser_get_AddressBar(IWebBrowser2 *iface, VARIANT_BOOL *Value)
884 WebBrowser *This = WEBBROWSER_THIS(iface);
886 TRACE("(%p)->(%p)\n", This, Value);
888 *Value = This->address_bar;
892 static HRESULT WINAPI WebBrowser_put_AddressBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
894 WebBrowser *This = WEBBROWSER_THIS(iface);
896 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
898 TRACE("(%p)->(%x)\n", This, Value);
900 This->address_bar = Value ? VARIANT_TRUE : VARIANT_FALSE;
902 /* In opposition to InternetExplorer, all we should do here is
903 * inform the embedder about the address bar change. */
905 V_VT(&arg) = VT_BOOL;
906 V_BOOL(&arg) = Value;
907 call_sink(This->doc_host.cps.wbe2, DISPID_ONADDRESSBAR, &dispparams);
912 static HRESULT WINAPI WebBrowser_get_Resizable(IWebBrowser2 *iface, VARIANT_BOOL *Value)
914 WebBrowser *This = WEBBROWSER_THIS(iface);
916 TRACE("(%p)->(%p)\n", This, Value);
918 /* It's InternetExplorer object's method. We have nothing to do here. */
922 static HRESULT WINAPI WebBrowser_put_Resizable(IWebBrowser2 *iface, VARIANT_BOOL Value)
924 WebBrowser *This = WEBBROWSER_THIS(iface);
926 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
928 TRACE("(%p)->(%x)\n", This, Value);
930 /* In opposition to InternetExplorer, all we should do here is
931 * inform the embedder about the resizable change. */
933 V_VT(&arg) = VT_BOOL;
934 V_BOOL(&arg) = Value;
935 call_sink(This->doc_host.cps.wbe2, DISPID_WINDOWSETRESIZABLE, &dispparams);
940 #undef WEBBROWSER_THIS
942 static const IWebBrowser2Vtbl WebBrowser2Vtbl =
944 WebBrowser_QueryInterface,
947 WebBrowser_GetTypeInfoCount,
948 WebBrowser_GetTypeInfo,
949 WebBrowser_GetIDsOfNames,
952 WebBrowser_GoForward,
959 WebBrowser_get_Application,
960 WebBrowser_get_Parent,
961 WebBrowser_get_Container,
962 WebBrowser_get_Document,
963 WebBrowser_get_TopLevelContainer,
969 WebBrowser_get_Width,
970 WebBrowser_put_Width,
971 WebBrowser_get_Height,
972 WebBrowser_put_Height,
973 WebBrowser_get_LocationName,
974 WebBrowser_get_LocationURL,
977 WebBrowser_ClientToWindow,
978 WebBrowser_PutProperty,
979 WebBrowser_GetProperty,
982 WebBrowser_get_FullName,
984 WebBrowser_get_Visible,
985 WebBrowser_put_Visible,
986 WebBrowser_get_StatusBar,
987 WebBrowser_put_StatusBar,
988 WebBrowser_get_StatusText,
989 WebBrowser_put_StatusText,
990 WebBrowser_get_ToolBar,
991 WebBrowser_put_ToolBar,
992 WebBrowser_get_MenuBar,
993 WebBrowser_put_MenuBar,
994 WebBrowser_get_FullScreen,
995 WebBrowser_put_FullScreen,
996 WebBrowser_Navigate2,
997 WebBrowser_QueryStatusWB,
999 WebBrowser_ShowBrowserBar,
1000 WebBrowser_get_ReadyState,
1001 WebBrowser_get_Offline,
1002 WebBrowser_put_Offline,
1003 WebBrowser_get_Silent,
1004 WebBrowser_put_Silent,
1005 WebBrowser_get_RegisterAsBrowser,
1006 WebBrowser_put_RegisterAsBrowser,
1007 WebBrowser_get_RegisterAsDropTarget,
1008 WebBrowser_put_RegisterAsDropTarget,
1009 WebBrowser_get_TheaterMode,
1010 WebBrowser_put_TheaterMode,
1011 WebBrowser_get_AddressBar,
1012 WebBrowser_put_AddressBar,
1013 WebBrowser_get_Resizable,
1014 WebBrowser_put_Resizable
1017 static HRESULT WebBrowser_Create(INT version, IUnknown *pOuter, REFIID riid, void **ppv)
1022 TRACE("(%p %s %p) version=%d\n", pOuter, debugstr_guid(riid), ppv, version);
1024 ret = heap_alloc(sizeof(WebBrowser));
1026 ret->lpWebBrowser2Vtbl = &WebBrowser2Vtbl;
1028 ret->version = version;
1030 DocHost_Init(&ret->doc_host, (IDispatch*)WEBBROWSER2(ret));
1032 ret->register_browser = VARIANT_FALSE;
1033 ret->visible = VARIANT_TRUE;
1034 ret->menu_bar = VARIANT_TRUE;
1035 ret->address_bar = VARIANT_TRUE;
1036 ret->status_bar = VARIANT_TRUE;
1037 ret->tool_bar = VARIANT_TRUE;
1038 ret->full_screen = VARIANT_FALSE;
1039 ret->theater_mode = VARIANT_FALSE;
1041 WebBrowser_OleObject_Init(ret);
1042 WebBrowser_ViewObject_Init(ret);
1043 WebBrowser_Persist_Init(ret);
1044 WebBrowser_ClassInfo_Init(ret);
1045 WebBrowser_HlinkFrame_Init(ret);
1047 hres = IWebBrowser_QueryInterface(WEBBROWSER(ret), riid, ppv);
1048 if(SUCCEEDED(hres)) {
1049 SHDOCVW_LockModule();
1058 HRESULT WebBrowserV1_Create(IUnknown *pOuter, REFIID riid, void **ppv)
1060 return WebBrowser_Create(1, pOuter, riid, ppv);
1063 HRESULT WebBrowserV2_Create(IUnknown *pOuter, REFIID riid, void **ppv)
1065 return WebBrowser_Create(2, pOuter, riid, ppv);