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_IServiceProvider, riid)) {
106 *ppv = SERVPROV(This);
107 TRACE("(%p)->(IID_IServiceProvider %p)\n", This, ppv);
108 }else if(IsEqualGUID(&IID_IQuickActivate, riid)) {
109 TRACE("(%p)->(IID_IQuickActivate %p) returning NULL\n", This, ppv);
110 return E_NOINTERFACE;
111 }else if(IsEqualGUID(&IID_IRunnableObject, riid)) {
112 TRACE("(%p)->(IID_IRunnableObject %p) returning NULL\n", This, ppv);
113 return E_NOINTERFACE;
114 }else if(IsEqualGUID(&IID_IPerPropertyBrowsing, riid)) {
115 TRACE("(%p)->(IID_IPerPropertyBrowsing %p) returning NULL\n", This, ppv);
116 return E_NOINTERFACE;
117 }else if(IsEqualGUID(&IID_IOleCache, riid)) {
118 TRACE("(%p)->(IID_IOleCache %p) returning NULL\n", This, ppv);
119 return E_NOINTERFACE;
120 }else if(IsEqualGUID(&IID_IOleInPlaceSite, riid)) {
121 TRACE("(%p)->(IID_IOleInPlaceSite %p) returning NULL\n", This, ppv);
122 return E_NOINTERFACE;
123 }else if(IsEqualGUID(&IID_IObjectWithSite, riid)) {
124 TRACE("(%p)->(IID_IObjectWithSite %p) returning NULL\n", This, ppv);
125 return E_NOINTERFACE;
126 }else if(IsEqualGUID(&IID_IViewObjectEx, riid)) {
127 TRACE("(%p)->(IID_IViewObjectEx %p) returning NULL\n", This, ppv);
128 return E_NOINTERFACE;
132 IUnknown_AddRef((IUnknown*)*ppv);
136 FIXME("(%p)->(%s %p) interface not supported\n", This, debugstr_guid(riid), ppv);
137 return E_NOINTERFACE;
140 static ULONG WINAPI WebBrowser_AddRef(IWebBrowser2 *iface)
142 WebBrowser *This = WEBBROWSER_THIS(iface);
143 LONG ref = InterlockedIncrement(&This->ref);
144 TRACE("(%p) ref=%d\n", This, ref);
148 static ULONG WINAPI WebBrowser_Release(IWebBrowser2 *iface)
150 WebBrowser *This = WEBBROWSER_THIS(iface);
151 LONG ref = InterlockedDecrement(&This->ref);
153 TRACE("(%p) ref=%d\n", This, ref);
156 if(This->doc_host.document)
157 IUnknown_Release(This->doc_host.document);
159 DocHost_Release(&This->doc_host);
161 WebBrowser_OleObject_Destroy(This);
164 SHDOCVW_UnlockModule();
170 /* IDispatch methods */
171 static HRESULT WINAPI WebBrowser_GetTypeInfoCount(IWebBrowser2 *iface, UINT *pctinfo)
173 WebBrowser *This = WEBBROWSER_THIS(iface);
175 TRACE("(%p)->(%p)\n", This, pctinfo);
181 static HRESULT WINAPI WebBrowser_GetTypeInfo(IWebBrowser2 *iface, UINT iTInfo, LCID lcid,
184 WebBrowser *This = WEBBROWSER_THIS(iface);
188 TRACE("(%p)->(%d %d %p)\n", This, iTInfo, lcid, ppTInfo);
190 hres = get_typeinfo(&typeinfo);
194 ITypeInfo_AddRef(typeinfo);
199 static HRESULT WINAPI WebBrowser_GetIDsOfNames(IWebBrowser2 *iface, REFIID riid,
200 LPOLESTR *rgszNames, UINT cNames,
201 LCID lcid, DISPID *rgDispId)
203 WebBrowser *This = WEBBROWSER_THIS(iface);
207 TRACE("(%p)->(%s %p %d %d %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
210 hres = get_typeinfo(&typeinfo);
214 return ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
217 static HRESULT WINAPI WebBrowser_Invoke(IWebBrowser2 *iface, DISPID dispIdMember,
218 REFIID riid, LCID lcid, WORD wFlags,
219 DISPPARAMS *pDispParams, VARIANT *pVarResult,
220 EXCEPINFO *pExepInfo, UINT *puArgErr)
222 WebBrowser *This = WEBBROWSER_THIS(iface);
226 TRACE("(%p)->(%d %s %d %08x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
227 lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
229 hres = get_typeinfo(&typeinfo);
233 return ITypeInfo_Invoke(typeinfo, WEBBROWSER2(This), dispIdMember, wFlags, pDispParams,
234 pVarResult, pExepInfo, puArgErr);
237 /* IWebBrowser methods */
238 static HRESULT WINAPI WebBrowser_GoBack(IWebBrowser2 *iface)
240 WebBrowser *This = WEBBROWSER_THIS(iface);
241 FIXME("(%p)\n", This);
245 static HRESULT WINAPI WebBrowser_GoForward(IWebBrowser2 *iface)
247 WebBrowser *This = WEBBROWSER_THIS(iface);
248 FIXME("(%p)\n", This);
252 static HRESULT WINAPI WebBrowser_GoHome(IWebBrowser2 *iface)
254 WebBrowser *This = WEBBROWSER_THIS(iface);
255 TRACE("(%p)\n", This);
256 return go_home(&This->doc_host);
259 static HRESULT WINAPI WebBrowser_GoSearch(IWebBrowser2 *iface)
261 WebBrowser *This = WEBBROWSER_THIS(iface);
262 FIXME("(%p)\n", This);
266 static HRESULT WINAPI WebBrowser_Navigate(IWebBrowser2 *iface, BSTR szUrl,
267 VARIANT *Flags, VARIANT *TargetFrameName,
268 VARIANT *PostData, VARIANT *Headers)
270 WebBrowser *This = WEBBROWSER_THIS(iface);
272 TRACE("(%p)->(%s %s %s %s %s)\n", This, debugstr_w(szUrl), debugstr_variant(Flags),
273 debugstr_variant(TargetFrameName), debugstr_variant(PostData),
274 debugstr_variant(Headers));
276 return navigate_url(&This->doc_host, szUrl, Flags, TargetFrameName, PostData, Headers);
279 static HRESULT WINAPI WebBrowser_Refresh(IWebBrowser2 *iface)
281 WebBrowser *This = WEBBROWSER_THIS(iface);
282 FIXME("(%p)\n", This);
286 static HRESULT WINAPI WebBrowser_Refresh2(IWebBrowser2 *iface, VARIANT *Level)
288 WebBrowser *This = WEBBROWSER_THIS(iface);
289 FIXME("(%p)->(%s)\n", This, debugstr_variant(Level));
293 static HRESULT WINAPI WebBrowser_Stop(IWebBrowser2 *iface)
295 WebBrowser *This = WEBBROWSER_THIS(iface);
296 FIXME("(%p)\n", This);
300 static HRESULT WINAPI WebBrowser_get_Application(IWebBrowser2 *iface, IDispatch **ppDisp)
302 WebBrowser *This = WEBBROWSER_THIS(iface);
304 TRACE("(%p)->(%p)\n", This, ppDisp);
309 *ppDisp = (IDispatch*)WEBBROWSER2(This);
310 IDispatch_AddRef(*ppDisp);
314 static HRESULT WINAPI WebBrowser_get_Parent(IWebBrowser2 *iface, IDispatch **ppDisp)
316 WebBrowser *This = WEBBROWSER_THIS(iface);
317 FIXME("(%p)->(%p)\n", This, ppDisp);
321 static HRESULT WINAPI WebBrowser_get_Container(IWebBrowser2 *iface, IDispatch **ppDisp)
323 WebBrowser *This = WEBBROWSER_THIS(iface);
324 FIXME("(%p)->(%p)\n", This, ppDisp);
328 static HRESULT WINAPI WebBrowser_get_Document(IWebBrowser2 *iface, IDispatch **ppDisp)
330 WebBrowser *This = WEBBROWSER_THIS(iface);
332 TRACE("(%p)->(%p)\n", This, ppDisp);
335 if(This->doc_host.document)
336 IUnknown_QueryInterface(This->doc_host.document, &IID_IDispatch, (void**)ppDisp);
341 static HRESULT WINAPI WebBrowser_get_TopLevelContainer(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
343 WebBrowser *This = WEBBROWSER_THIS(iface);
344 FIXME("(%p)->(%p)\n", This, pBool);
348 static HRESULT WINAPI WebBrowser_get_Type(IWebBrowser2 *iface, BSTR *Type)
350 WebBrowser *This = WEBBROWSER_THIS(iface);
351 FIXME("(%p)->(%p)\n", This, Type);
355 static HRESULT WINAPI WebBrowser_get_Left(IWebBrowser2 *iface, LONG *pl)
357 WebBrowser *This = WEBBROWSER_THIS(iface);
359 TRACE("(%p)->(%p)\n", This, pl);
361 *pl = This->pos_rect.left;
365 static HRESULT WINAPI WebBrowser_put_Left(IWebBrowser2 *iface, LONG Left)
367 WebBrowser *This = WEBBROWSER_THIS(iface);
370 TRACE("(%p)->(%d)\n", This, Left);
375 rect = This->pos_rect;
378 /* We don't really change the window position here.
379 * We just notify the embedder that he should do so. */
380 return IOleInPlaceSite_OnPosRectChange(This->inplace, &rect);
383 static HRESULT WINAPI WebBrowser_get_Top(IWebBrowser2 *iface, LONG *pl)
385 WebBrowser *This = WEBBROWSER_THIS(iface);
387 TRACE("(%p)->(%p)\n", This, pl);
389 *pl = This->pos_rect.top;
393 static HRESULT WINAPI WebBrowser_put_Top(IWebBrowser2 *iface, LONG Top)
395 WebBrowser *This = WEBBROWSER_THIS(iface);
398 TRACE("(%p)->(%d)\n", This, Top);
403 rect = This->pos_rect;
406 /* We don't really change the window position here.
407 * We just notify the embedder that he should do so. */
408 return IOleInPlaceSite_OnPosRectChange(This->inplace, &rect);
411 static HRESULT WINAPI WebBrowser_get_Width(IWebBrowser2 *iface, LONG *pl)
413 WebBrowser *This = WEBBROWSER_THIS(iface);
415 TRACE("(%p)->(%p)\n", This, pl);
417 *pl = This->pos_rect.right - This->pos_rect.left;
421 static HRESULT WINAPI WebBrowser_put_Width(IWebBrowser2 *iface, LONG Width)
423 WebBrowser *This = WEBBROWSER_THIS(iface);
426 TRACE("(%p)->(%d)\n", This, Width);
431 rect = This->pos_rect;
432 rect.right = rect.left+Width;
434 /* We don't really change the window size here.
435 * We just notify the embedder that he should do so. */
436 return IOleInPlaceSite_OnPosRectChange(This->inplace, &rect);
439 static HRESULT WINAPI WebBrowser_get_Height(IWebBrowser2 *iface, LONG *pl)
441 WebBrowser *This = WEBBROWSER_THIS(iface);
443 TRACE("(%p)->(%p)\n", This, pl);
445 *pl = This->pos_rect.bottom - This->pos_rect.top;
449 static HRESULT WINAPI WebBrowser_put_Height(IWebBrowser2 *iface, LONG Height)
451 WebBrowser *This = WEBBROWSER_THIS(iface);
454 TRACE("(%p)->(%d)\n", This, Height);
459 rect = This->pos_rect;
460 rect.bottom = rect.top+Height;
462 /* We don't really change the window size here.
463 * We just notify the embedder that he should do so. */
464 return IOleInPlaceSite_OnPosRectChange(This->inplace, &rect);
467 static HRESULT WINAPI WebBrowser_get_LocationName(IWebBrowser2 *iface, BSTR *LocationName)
469 WebBrowser *This = WEBBROWSER_THIS(iface);
470 FIXME("(%p)->(%p)\n", This, LocationName);
474 static HRESULT WINAPI WebBrowser_get_LocationURL(IWebBrowser2 *iface, BSTR *LocationURL)
476 WebBrowser *This = WEBBROWSER_THIS(iface);
478 FIXME("(%p)->(%p)\n", This, LocationURL);
480 if(!This->doc_host.url) {
481 static const WCHAR null_char = 0;
482 *LocationURL = SysAllocString(&null_char);
486 *LocationURL = SysAllocString(This->doc_host.url);
490 static HRESULT WINAPI WebBrowser_get_Busy(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
492 WebBrowser *This = WEBBROWSER_THIS(iface);
494 TRACE("(%p)->(%p)\n", This, pBool);
496 *pBool = This->doc_host.busy;
500 static HRESULT WINAPI WebBrowser_Quit(IWebBrowser2 *iface)
502 WebBrowser *This = WEBBROWSER_THIS(iface);
504 TRACE("(%p)\n", This);
506 /* It's a InternetExplorer specific method, we have nothing to do here. */
510 static HRESULT WINAPI WebBrowser_ClientToWindow(IWebBrowser2 *iface, int *pcx, int *pcy)
512 WebBrowser *This = WEBBROWSER_THIS(iface);
513 FIXME("(%p)->(%p %p)\n", This, pcx, pcy);
517 static HRESULT WINAPI WebBrowser_PutProperty(IWebBrowser2 *iface, BSTR szProperty, VARIANT vtValue)
519 WebBrowser *This = WEBBROWSER_THIS(iface);
520 FIXME("(%p)->(%s %s)\n", This, debugstr_w(szProperty), debugstr_variant(&vtValue));
524 static HRESULT WINAPI WebBrowser_GetProperty(IWebBrowser2 *iface, BSTR szProperty, VARIANT *pvtValue)
526 WebBrowser *This = WEBBROWSER_THIS(iface);
527 FIXME("(%p)->(%s %s)\n", This, debugstr_w(szProperty), debugstr_variant(pvtValue));
531 static HRESULT WINAPI WebBrowser_get_Name(IWebBrowser2 *iface, BSTR *Name)
533 WebBrowser *This = WEBBROWSER_THIS(iface);
534 FIXME("(%p)->(%p)\n", This, Name);
538 static HRESULT WINAPI WebBrowser_get_HWND(IWebBrowser2 *iface, LONG *pHWND)
540 WebBrowser *This = WEBBROWSER_THIS(iface);
542 TRACE("(%p)->(%p)\n", This, pHWND);
544 /* WebBrowser control never has a frame window (in opposition to InternetExplorer) */
549 static HRESULT WINAPI WebBrowser_get_FullName(IWebBrowser2 *iface, BSTR *FullName)
551 WebBrowser *This = WEBBROWSER_THIS(iface);
552 FIXME("(%p)->(%p)\n", This, FullName);
556 static HRESULT WINAPI WebBrowser_get_Path(IWebBrowser2 *iface, BSTR *Path)
558 WebBrowser *This = WEBBROWSER_THIS(iface);
559 FIXME("(%p)->(%p)\n", This, Path);
563 static HRESULT WINAPI WebBrowser_get_Visible(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
565 WebBrowser *This = WEBBROWSER_THIS(iface);
567 TRACE("(%p)->(%p)\n", This, pBool);
569 *pBool = This->visible;
573 static HRESULT WINAPI WebBrowser_put_Visible(IWebBrowser2 *iface, VARIANT_BOOL Value)
575 WebBrowser *This = WEBBROWSER_THIS(iface);
577 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
579 TRACE("(%p)->(%x)\n", This, Value);
581 This->visible = Value;
583 V_VT(&arg) = VT_BOOL;
584 V_BOOL(&arg) = Value;
585 call_sink(This->doc_host.cps.wbe2, DISPID_ONVISIBLE, &dispparams);
590 static HRESULT WINAPI WebBrowser_get_StatusBar(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
592 WebBrowser *This = WEBBROWSER_THIS(iface);
594 TRACE("(%p)->(%p)\n", This, pBool);
596 *pBool = This->status_bar;
600 static HRESULT WINAPI WebBrowser_put_StatusBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
602 WebBrowser *This = WEBBROWSER_THIS(iface);
604 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
606 TRACE("(%p)->(%x)\n", This, Value);
608 This->status_bar = Value ? VARIANT_TRUE : VARIANT_FALSE;
610 /* In opposition to InternetExplorer, all we should do here is
611 * inform the embedder about the status bar change. */
613 V_VT(&arg) = VT_BOOL;
614 V_BOOL(&arg) = Value;
615 call_sink(This->doc_host.cps.wbe2, DISPID_ONSTATUSBAR, &dispparams);
620 static HRESULT WINAPI WebBrowser_get_StatusText(IWebBrowser2 *iface, BSTR *StatusText)
622 WebBrowser *This = WEBBROWSER_THIS(iface);
623 FIXME("(%p)->(%p)\n", This, StatusText);
627 static HRESULT WINAPI WebBrowser_put_StatusText(IWebBrowser2 *iface, BSTR StatusText)
629 WebBrowser *This = WEBBROWSER_THIS(iface);
630 FIXME("(%p)->(%s)\n", This, debugstr_w(StatusText));
634 static HRESULT WINAPI WebBrowser_get_ToolBar(IWebBrowser2 *iface, int *Value)
636 WebBrowser *This = WEBBROWSER_THIS(iface);
638 TRACE("(%p)->(%p)\n", This, Value);
640 *Value = This->tool_bar;
644 static HRESULT WINAPI WebBrowser_put_ToolBar(IWebBrowser2 *iface, int Value)
646 WebBrowser *This = WEBBROWSER_THIS(iface);
648 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
650 TRACE("(%p)->(%x)\n", This, Value);
652 This->tool_bar = Value ? VARIANT_TRUE : VARIANT_FALSE;
654 /* In opposition to InternetExplorer, all we should do here is
655 * inform the embedder about the tool bar change. */
657 V_VT(&arg) = VT_BOOL;
658 V_BOOL(&arg) = This->tool_bar;
659 call_sink(This->doc_host.cps.wbe2, DISPID_ONTOOLBAR, &dispparams);
664 static HRESULT WINAPI WebBrowser_get_MenuBar(IWebBrowser2 *iface, VARIANT_BOOL *Value)
666 WebBrowser *This = WEBBROWSER_THIS(iface);
668 TRACE("(%p)->(%p)\n", This, Value);
670 *Value = This->menu_bar;
674 static HRESULT WINAPI WebBrowser_put_MenuBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
676 WebBrowser *This = WEBBROWSER_THIS(iface);
678 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
680 TRACE("(%p)->(%x)\n", This, Value);
682 This->menu_bar = Value ? VARIANT_TRUE : VARIANT_FALSE;
684 /* In opposition to InternetExplorer, all we should do here is
685 * inform the embedder about the menu bar change. */
687 V_VT(&arg) = VT_BOOL;
688 V_BOOL(&arg) = Value;
689 call_sink(This->doc_host.cps.wbe2, DISPID_ONMENUBAR, &dispparams);
694 static HRESULT WINAPI WebBrowser_get_FullScreen(IWebBrowser2 *iface, VARIANT_BOOL *pbFullScreen)
696 WebBrowser *This = WEBBROWSER_THIS(iface);
698 TRACE("(%p)->(%p)\n", This, pbFullScreen);
700 *pbFullScreen = This->full_screen;
704 static HRESULT WINAPI WebBrowser_put_FullScreen(IWebBrowser2 *iface, VARIANT_BOOL bFullScreen)
706 WebBrowser *This = WEBBROWSER_THIS(iface);
708 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
710 /* In opposition to InternetExplorer, all we should do here is
711 * inform the embedder about the fullscreen change. */
713 TRACE("(%p)->(%x)\n", This, bFullScreen);
715 This->full_screen = bFullScreen ? VARIANT_TRUE : VARIANT_FALSE;
717 V_VT(&arg) = VT_BOOL;
718 V_BOOL(&arg) = bFullScreen;
719 call_sink(This->doc_host.cps.wbe2, DISPID_ONFULLSCREEN, &dispparams);
724 static HRESULT WINAPI WebBrowser_Navigate2(IWebBrowser2 *iface, VARIANT *URL, VARIANT *Flags,
725 VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
727 WebBrowser *This = WEBBROWSER_THIS(iface);
730 TRACE("(%p)->(%s %s %s %s %s)\n", This, debugstr_variant(URL), debugstr_variant(Flags),
731 debugstr_variant(TargetFrameName), debugstr_variant(PostData), debugstr_variant(Headers));
744 case VT_BSTR|VT_BYREF:
745 url = *V_BSTRREF(URL);
748 FIXME("Unsupported V_VT(URL) %d\n", V_VT(URL));
752 return navigate_url(&This->doc_host, url, Flags, TargetFrameName, PostData, Headers);
755 static HRESULT WINAPI WebBrowser_QueryStatusWB(IWebBrowser2 *iface, OLECMDID cmdID, OLECMDF *pcmdf)
757 WebBrowser *This = WEBBROWSER_THIS(iface);
758 FIXME("(%p)->(%d %p)\n", This, cmdID, pcmdf);
762 static HRESULT WINAPI WebBrowser_ExecWB(IWebBrowser2 *iface, OLECMDID cmdID,
763 OLECMDEXECOPT cmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
765 WebBrowser *This = WEBBROWSER_THIS(iface);
766 FIXME("(%p)->(%d %d %s %p)\n", This, cmdID, cmdexecopt, debugstr_variant(pvaIn), pvaOut);
770 static HRESULT WINAPI WebBrowser_ShowBrowserBar(IWebBrowser2 *iface, VARIANT *pvaClsid,
771 VARIANT *pvarShow, VARIANT *pvarSize)
773 WebBrowser *This = WEBBROWSER_THIS(iface);
774 FIXME("(%p)->(%s %s %s)\n", This, debugstr_variant(pvaClsid), debugstr_variant(pvarShow),
775 debugstr_variant(pvarSize));
779 static HRESULT WINAPI WebBrowser_get_ReadyState(IWebBrowser2 *iface, READYSTATE *lpReadyState)
781 WebBrowser *This = WEBBROWSER_THIS(iface);
783 TRACE("(%p)->(%p)\n", This, lpReadyState);
785 *lpReadyState = This->doc_host.ready_state;
789 static HRESULT WINAPI WebBrowser_get_Offline(IWebBrowser2 *iface, VARIANT_BOOL *pbOffline)
791 WebBrowser *This = WEBBROWSER_THIS(iface);
793 TRACE("(%p)->(%p)\n", This, pbOffline);
795 *pbOffline = This->doc_host.offline;
799 static HRESULT WINAPI WebBrowser_put_Offline(IWebBrowser2 *iface, VARIANT_BOOL bOffline)
801 WebBrowser *This = WEBBROWSER_THIS(iface);
803 TRACE("(%p)->(%x)\n", This, bOffline);
805 This->doc_host.offline = bOffline ? VARIANT_TRUE : VARIANT_FALSE;
809 static HRESULT WINAPI WebBrowser_get_Silent(IWebBrowser2 *iface, VARIANT_BOOL *pbSilent)
811 WebBrowser *This = WEBBROWSER_THIS(iface);
813 TRACE("(%p)->(%p)\n", This, pbSilent);
815 *pbSilent = This->doc_host.silent;
819 static HRESULT WINAPI WebBrowser_put_Silent(IWebBrowser2 *iface, VARIANT_BOOL bSilent)
821 WebBrowser *This = WEBBROWSER_THIS(iface);
823 TRACE("(%p)->(%x)\n", This, bSilent);
825 This->doc_host.silent = bSilent ? VARIANT_TRUE : VARIANT_FALSE;
829 static HRESULT WINAPI WebBrowser_get_RegisterAsBrowser(IWebBrowser2 *iface,
830 VARIANT_BOOL *pbRegister)
832 WebBrowser *This = WEBBROWSER_THIS(iface);
834 FIXME("(%p)->(%p)\n", This, pbRegister);
836 *pbRegister = This->register_browser;
840 static HRESULT WINAPI WebBrowser_put_RegisterAsBrowser(IWebBrowser2 *iface,
841 VARIANT_BOOL bRegister)
843 WebBrowser *This = WEBBROWSER_THIS(iface);
845 FIXME("(%p)->(%x)\n", This, bRegister);
847 This->register_browser = bRegister ? VARIANT_TRUE : VARIANT_FALSE;
851 static HRESULT WINAPI WebBrowser_get_RegisterAsDropTarget(IWebBrowser2 *iface,
852 VARIANT_BOOL *pbRegister)
854 WebBrowser *This = WEBBROWSER_THIS(iface);
855 FIXME("(%p)->(%p)\n", This, pbRegister);
860 static HRESULT WINAPI WebBrowser_put_RegisterAsDropTarget(IWebBrowser2 *iface,
861 VARIANT_BOOL bRegister)
863 WebBrowser *This = WEBBROWSER_THIS(iface);
864 FIXME("(%p)->(%x)\n", This, bRegister);
868 static HRESULT WINAPI WebBrowser_get_TheaterMode(IWebBrowser2 *iface, VARIANT_BOOL *pbRegister)
870 WebBrowser *This = WEBBROWSER_THIS(iface);
872 TRACE("(%p)->(%p)\n", This, pbRegister);
874 *pbRegister = This->theater_mode;
878 static HRESULT WINAPI WebBrowser_put_TheaterMode(IWebBrowser2 *iface, VARIANT_BOOL bRegister)
880 WebBrowser *This = WEBBROWSER_THIS(iface);
882 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
884 TRACE("(%p)->(%x)\n", This, bRegister);
886 This->theater_mode = bRegister ? VARIANT_TRUE : VARIANT_FALSE;
888 /* In opposition to InternetExplorer, all we should do here is
889 * inform the embedder about the theater mode change. */
891 V_VT(&arg) = VT_BOOL;
892 V_BOOL(&arg) = bRegister;
893 call_sink(This->doc_host.cps.wbe2, DISPID_ONTHEATERMODE, &dispparams);
898 static HRESULT WINAPI WebBrowser_get_AddressBar(IWebBrowser2 *iface, VARIANT_BOOL *Value)
900 WebBrowser *This = WEBBROWSER_THIS(iface);
902 TRACE("(%p)->(%p)\n", This, Value);
904 *Value = This->address_bar;
908 static HRESULT WINAPI WebBrowser_put_AddressBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
910 WebBrowser *This = WEBBROWSER_THIS(iface);
912 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
914 TRACE("(%p)->(%x)\n", This, Value);
916 This->address_bar = Value ? VARIANT_TRUE : VARIANT_FALSE;
918 /* In opposition to InternetExplorer, all we should do here is
919 * inform the embedder about the address bar change. */
921 V_VT(&arg) = VT_BOOL;
922 V_BOOL(&arg) = Value;
923 call_sink(This->doc_host.cps.wbe2, DISPID_ONADDRESSBAR, &dispparams);
928 static HRESULT WINAPI WebBrowser_get_Resizable(IWebBrowser2 *iface, VARIANT_BOOL *Value)
930 WebBrowser *This = WEBBROWSER_THIS(iface);
932 TRACE("(%p)->(%p)\n", This, Value);
934 /* It's InternetExplorer object's method. We have nothing to do here. */
938 static HRESULT WINAPI WebBrowser_put_Resizable(IWebBrowser2 *iface, VARIANT_BOOL Value)
940 WebBrowser *This = WEBBROWSER_THIS(iface);
942 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
944 TRACE("(%p)->(%x)\n", This, Value);
946 /* In opposition to InternetExplorer, all we should do here is
947 * inform the embedder about the resizable change. */
949 V_VT(&arg) = VT_BOOL;
950 V_BOOL(&arg) = Value;
951 call_sink(This->doc_host.cps.wbe2, DISPID_WINDOWSETRESIZABLE, &dispparams);
956 #undef WEBBROWSER_THIS
958 static const IWebBrowser2Vtbl WebBrowser2Vtbl =
960 WebBrowser_QueryInterface,
963 WebBrowser_GetTypeInfoCount,
964 WebBrowser_GetTypeInfo,
965 WebBrowser_GetIDsOfNames,
968 WebBrowser_GoForward,
975 WebBrowser_get_Application,
976 WebBrowser_get_Parent,
977 WebBrowser_get_Container,
978 WebBrowser_get_Document,
979 WebBrowser_get_TopLevelContainer,
985 WebBrowser_get_Width,
986 WebBrowser_put_Width,
987 WebBrowser_get_Height,
988 WebBrowser_put_Height,
989 WebBrowser_get_LocationName,
990 WebBrowser_get_LocationURL,
993 WebBrowser_ClientToWindow,
994 WebBrowser_PutProperty,
995 WebBrowser_GetProperty,
998 WebBrowser_get_FullName,
1000 WebBrowser_get_Visible,
1001 WebBrowser_put_Visible,
1002 WebBrowser_get_StatusBar,
1003 WebBrowser_put_StatusBar,
1004 WebBrowser_get_StatusText,
1005 WebBrowser_put_StatusText,
1006 WebBrowser_get_ToolBar,
1007 WebBrowser_put_ToolBar,
1008 WebBrowser_get_MenuBar,
1009 WebBrowser_put_MenuBar,
1010 WebBrowser_get_FullScreen,
1011 WebBrowser_put_FullScreen,
1012 WebBrowser_Navigate2,
1013 WebBrowser_QueryStatusWB,
1015 WebBrowser_ShowBrowserBar,
1016 WebBrowser_get_ReadyState,
1017 WebBrowser_get_Offline,
1018 WebBrowser_put_Offline,
1019 WebBrowser_get_Silent,
1020 WebBrowser_put_Silent,
1021 WebBrowser_get_RegisterAsBrowser,
1022 WebBrowser_put_RegisterAsBrowser,
1023 WebBrowser_get_RegisterAsDropTarget,
1024 WebBrowser_put_RegisterAsDropTarget,
1025 WebBrowser_get_TheaterMode,
1026 WebBrowser_put_TheaterMode,
1027 WebBrowser_get_AddressBar,
1028 WebBrowser_put_AddressBar,
1029 WebBrowser_get_Resizable,
1030 WebBrowser_put_Resizable
1033 #define SERVPROV_THIS(iface) DEFINE_THIS(WebBrowser, OleObject, iface)
1035 * IServiceProvider interface.
1037 static HRESULT WINAPI WebBrowser_IServiceProvider_QueryInterface(IServiceProvider *iface,
1038 REFIID riid, LPVOID *ppv)
1040 WebBrowser *This = SERVPROV_THIS(iface);
1046 if(IsEqualGUID(&IID_IUnknown, riid)) {
1047 *ppv = WEBBROWSER(This);
1048 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1049 }else if(IsEqualGUID(&IID_IServiceProvider, riid)) {
1050 *ppv = WEBBROWSER(This);
1051 TRACE("(%p)->(IID_IServiceProvider %p)\n", This, ppv);
1055 IUnknown_AddRef((IUnknown*)*ppv);
1059 FIXME("(%p)->(%s %p) interface not supported\n", This, debugstr_guid(riid), ppv);
1060 return E_NOINTERFACE;
1063 static ULONG WINAPI WebBrowser_IServiceProvider_AddRef(IServiceProvider *iface)
1065 WebBrowser *This = SERVPROV_THIS(iface);
1066 return IWebBrowser_AddRef(WEBBROWSER(This));
1069 static ULONG WINAPI WebBrowser_IServiceProvider_Release(IServiceProvider *iface)
1071 WebBrowser *This = SERVPROV_THIS(iface);
1072 return IWebBrowser_Release(WEBBROWSER(This));
1075 static HRESULT STDMETHODCALLTYPE WebBrowser_IServiceProvider_QueryService(IServiceProvider *iface,
1076 REFGUID guidService, REFIID riid, void **ppv)
1078 WebBrowser *This = SERVPROV_THIS(iface);
1079 static const IID IID_IBrowserService2 =
1080 {0x68BD21CC,0x438B,0x11d2,{0xA5,0x60,0x00,0xA0,0xC,0x2D,0xBF,0xE8}};
1085 if(IsEqualGUID(&IID_IBrowserService2, riid)) {
1086 TRACE("(%p)->(IID_IBrowserService2 return E_FAIL)\n", This);
1090 FIXME("(%p)->(%s, %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv);
1092 return E_NOINTERFACE;
1095 #undef SERVPROV_THIS
1097 static const IServiceProviderVtbl ServiceProviderVtbl =
1099 WebBrowser_IServiceProvider_QueryInterface,
1100 WebBrowser_IServiceProvider_AddRef,
1101 WebBrowser_IServiceProvider_Release,
1102 WebBrowser_IServiceProvider_QueryService
1105 static HRESULT WebBrowser_Create(INT version, IUnknown *pOuter, REFIID riid, void **ppv)
1110 TRACE("(%p %s %p) version=%d\n", pOuter, debugstr_guid(riid), ppv, version);
1112 ret = heap_alloc(sizeof(WebBrowser));
1114 ret->lpWebBrowser2Vtbl = &WebBrowser2Vtbl;
1115 ret->lpServiceProviderVtbl = &ServiceProviderVtbl;
1117 ret->version = version;
1119 DocHost_Init(&ret->doc_host, (IDispatch*)WEBBROWSER2(ret));
1121 ret->register_browser = VARIANT_FALSE;
1122 ret->visible = VARIANT_TRUE;
1123 ret->menu_bar = VARIANT_TRUE;
1124 ret->address_bar = VARIANT_TRUE;
1125 ret->status_bar = VARIANT_TRUE;
1126 ret->tool_bar = VARIANT_TRUE;
1127 ret->full_screen = VARIANT_FALSE;
1128 ret->theater_mode = VARIANT_FALSE;
1130 WebBrowser_OleObject_Init(ret);
1131 WebBrowser_ViewObject_Init(ret);
1132 WebBrowser_Persist_Init(ret);
1133 WebBrowser_ClassInfo_Init(ret);
1134 WebBrowser_HlinkFrame_Init(ret);
1136 hres = IWebBrowser_QueryInterface(WEBBROWSER(ret), riid, ppv);
1137 if(SUCCEEDED(hres)) {
1138 SHDOCVW_LockModule();
1147 HRESULT WebBrowserV1_Create(IUnknown *pOuter, REFIID riid, void **ppv)
1149 return WebBrowser_Create(1, pOuter, riid, ppv);
1152 HRESULT WebBrowserV2_Create(IUnknown *pOuter, REFIID riid, void **ppv)
1154 return WebBrowser_Create(2, pOuter, riid, ppv);