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_IPersistStreamInit
, riid
)) {
76 TRACE("(%p)->(IID_IPersistStreamInit %p)\n", This
, ppv
);
77 *ppv
= PERSTRINIT(This
);
78 }else if(IsEqualGUID(&IID_IProvideClassInfo
, riid
)) {
79 TRACE("(%p)->(IID_IProvideClassInfo %p)\n", This
, ppv
);
80 *ppv
= CLASSINFO(This
);
81 }else if(IsEqualGUID(&IID_IProvideClassInfo2
, riid
)) {
82 TRACE("(%p)->(IID_IProvideClassInfo2 %p)\n", This
, ppv
);
83 *ppv
= CLASSINFO(This
);
84 }else if(IsEqualGUID(&IID_IConnectionPointContainer
, riid
)) {
85 TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This
, ppv
);
86 *ppv
= CONPTCONT(&This
->doc_host
.cps
);
87 }else if(IsEqualGUID(&IID_IViewObject
, riid
)) {
88 TRACE("(%p)->(IID_IViewObject %p)\n", This
, ppv
);
90 }else if(IsEqualGUID(&IID_IViewObject2
, riid
)) {
91 TRACE("(%p)->(IID_IViewObject2 %p)\n", This
, ppv
);
92 *ppv
= VIEWOBJ2(This
);
93 }else if(IsEqualGUID(&IID_IOleInPlaceActiveObject
, riid
)) {
94 TRACE("(%p)->(IID_IOleInPlaceActiveObject %p)\n", This
, ppv
);
95 *ppv
= ACTIVEOBJ(This
);
96 }else if(IsEqualGUID(&IID_IOleCommandTarget
, riid
)) {
97 TRACE("(%p)->(IID_IOleCommandTarget %p)\n", This
, ppv
);
99 }else if(IsEqualGUID(&IID_IHlinkFrame
, riid
)) {
100 TRACE("(%p)->(IID_IHlinkFrame %p)\n", This
, ppv
);
101 *ppv
= HLINKFRAME(This
);
102 }else if(IsEqualGUID(&IID_IQuickActivate
, riid
)) {
103 TRACE("(%p)->(IID_IQuickActivate %p) returning NULL\n", This
, ppv
);
104 return E_NOINTERFACE
;
105 }else if(IsEqualGUID(&IID_IRunnableObject
, riid
)) {
106 TRACE("(%p)->(IID_IRunnableObject %p) returning NULL\n", This
, ppv
);
107 return E_NOINTERFACE
;
111 IUnknown_AddRef((IUnknown
*)*ppv
);
115 FIXME("(%p)->(%s %p) interface not supported\n", This
, debugstr_guid(riid
), ppv
);
116 return E_NOINTERFACE
;
119 static ULONG WINAPI
WebBrowser_AddRef(IWebBrowser2
*iface
)
121 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
122 LONG ref
= InterlockedIncrement(&This
->ref
);
123 TRACE("(%p) ref=%d\n", This
, ref
);
127 static ULONG WINAPI
WebBrowser_Release(IWebBrowser2
*iface
)
129 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
130 LONG ref
= InterlockedDecrement(&This
->ref
);
132 TRACE("(%p) ref=%d\n", This
, ref
);
135 if(This
->doc_host
.document
)
136 IUnknown_Release(This
->doc_host
.document
);
138 DocHost_Release(&This
->doc_host
);
140 WebBrowser_OleObject_Destroy(This
);
143 SHDOCVW_UnlockModule();
149 /* IDispatch methods */
150 static HRESULT WINAPI
WebBrowser_GetTypeInfoCount(IWebBrowser2
*iface
, UINT
*pctinfo
)
152 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
153 FIXME("(%p)->(%p)\n", This
, pctinfo
);
157 static HRESULT WINAPI
WebBrowser_GetTypeInfo(IWebBrowser2
*iface
, UINT iTInfo
, LCID lcid
,
160 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
161 FIXME("(%p)->(%d %d %p)\n", This
, iTInfo
, lcid
, ppTInfo
);
165 static HRESULT WINAPI
WebBrowser_GetIDsOfNames(IWebBrowser2
*iface
, REFIID riid
,
166 LPOLESTR
*rgszNames
, UINT cNames
,
167 LCID lcid
, DISPID
*rgDispId
)
169 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
170 FIXME("(%p)->(%s %p %d %d %p)\n", This
, debugstr_guid(riid
), rgszNames
, cNames
,
175 static HRESULT WINAPI
WebBrowser_Invoke(IWebBrowser2
*iface
, DISPID dispIdMember
,
176 REFIID riid
, LCID lcid
, WORD wFlags
,
177 DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
178 EXCEPINFO
*pExepInfo
, UINT
*puArgErr
)
180 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
184 TRACE("(%p)->(%d %s %d %08x %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
185 lcid
, wFlags
, pDispParams
, pVarResult
, pExepInfo
, puArgErr
);
187 hres
= get_typeinfo(&typeinfo
);
191 return ITypeInfo_Invoke(typeinfo
, WEBBROWSER2(This
), dispIdMember
, wFlags
, pDispParams
,
192 pVarResult
, pExepInfo
, puArgErr
);
195 /* IWebBrowser methods */
196 static HRESULT WINAPI
WebBrowser_GoBack(IWebBrowser2
*iface
)
198 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
199 FIXME("(%p)\n", This
);
203 static HRESULT WINAPI
WebBrowser_GoForward(IWebBrowser2
*iface
)
205 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
206 FIXME("(%p)\n", This
);
210 static HRESULT WINAPI
WebBrowser_GoHome(IWebBrowser2
*iface
)
212 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
213 TRACE("(%p)\n", This
);
214 return go_home(&This
->doc_host
);
217 static HRESULT WINAPI
WebBrowser_GoSearch(IWebBrowser2
*iface
)
219 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
220 FIXME("(%p)\n", This
);
224 static HRESULT WINAPI
WebBrowser_Navigate(IWebBrowser2
*iface
, BSTR szUrl
,
225 VARIANT
*Flags
, VARIANT
*TargetFrameName
,
226 VARIANT
*PostData
, VARIANT
*Headers
)
228 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
230 TRACE("(%p)->(%s %p %p %p %p)\n", This
, debugstr_w(szUrl
), Flags
, TargetFrameName
,
233 return navigate_url(&This
->doc_host
, szUrl
, Flags
, TargetFrameName
, PostData
, Headers
);
236 static HRESULT WINAPI
WebBrowser_Refresh(IWebBrowser2
*iface
)
238 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
239 FIXME("(%p)\n", This
);
243 static HRESULT WINAPI
WebBrowser_Refresh2(IWebBrowser2
*iface
, VARIANT
*Level
)
245 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
246 FIXME("(%p)->(%p)\n", This
, Level
);
250 static HRESULT WINAPI
WebBrowser_Stop(IWebBrowser2
*iface
)
252 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
253 FIXME("(%p)\n", This
);
257 static HRESULT WINAPI
WebBrowser_get_Application(IWebBrowser2
*iface
, IDispatch
**ppDisp
)
259 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
260 FIXME("(%p)->(%p)\n", This
, ppDisp
);
264 static HRESULT WINAPI
WebBrowser_get_Parent(IWebBrowser2
*iface
, IDispatch
**ppDisp
)
266 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
267 FIXME("(%p)->(%p)\n", This
, ppDisp
);
271 static HRESULT WINAPI
WebBrowser_get_Container(IWebBrowser2
*iface
, IDispatch
**ppDisp
)
273 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
274 FIXME("(%p)->(%p)\n", This
, ppDisp
);
278 static HRESULT WINAPI
WebBrowser_get_Document(IWebBrowser2
*iface
, IDispatch
**ppDisp
)
280 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
282 TRACE("(%p)->(%p)\n", This
, ppDisp
);
285 if(This
->doc_host
.document
)
286 IUnknown_QueryInterface(This
->doc_host
.document
, &IID_IDispatch
, (void**)ppDisp
);
291 static HRESULT WINAPI
WebBrowser_get_TopLevelContainer(IWebBrowser2
*iface
, VARIANT_BOOL
*pBool
)
293 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
294 FIXME("(%p)->(%p)\n", This
, pBool
);
298 static HRESULT WINAPI
WebBrowser_get_Type(IWebBrowser2
*iface
, BSTR
*Type
)
300 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
301 FIXME("(%p)->(%p)\n", This
, Type
);
305 static HRESULT WINAPI
WebBrowser_get_Left(IWebBrowser2
*iface
, long *pl
)
307 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
309 TRACE("(%p)->(%p)\n", This
, pl
);
311 *pl
= This
->pos_rect
.left
;
315 static HRESULT WINAPI
WebBrowser_put_Left(IWebBrowser2
*iface
, long Left
)
317 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
320 TRACE("(%p)->(%ld)\n", This
, Left
);
325 memcpy(&rect
, &This
->pos_rect
, sizeof(RECT
));
328 /* We don't really change the window position here.
329 * We just notify the embedder that he should do so. */
330 return IOleInPlaceSite_OnPosRectChange(This
->inplace
, &rect
);
333 static HRESULT WINAPI
WebBrowser_get_Top(IWebBrowser2
*iface
, long *pl
)
335 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
337 TRACE("(%p)->(%p)\n", This
, pl
);
339 *pl
= This
->pos_rect
.top
;
343 static HRESULT WINAPI
WebBrowser_put_Top(IWebBrowser2
*iface
, long Top
)
345 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
348 TRACE("(%p)->(%ld)\n", This
, Top
);
353 memcpy(&rect
, &This
->pos_rect
, sizeof(RECT
));
356 /* We don't really change the window position here.
357 * We just notify the embedder that he should do so. */
358 return IOleInPlaceSite_OnPosRectChange(This
->inplace
, &rect
);
361 static HRESULT WINAPI
WebBrowser_get_Width(IWebBrowser2
*iface
, long *pl
)
363 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
365 TRACE("(%p)->(%p)\n", This
, pl
);
367 *pl
= This
->pos_rect
.right
- This
->pos_rect
.left
;
371 static HRESULT WINAPI
WebBrowser_put_Width(IWebBrowser2
*iface
, long Width
)
373 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
376 TRACE("(%p)->(%ld)\n", This
, Width
);
381 memcpy(&rect
, &This
->pos_rect
, sizeof(RECT
));
382 rect
.right
= rect
.left
+Width
;
384 /* We don't really change the window size here.
385 * We just notify the embedder that he should do so. */
386 return IOleInPlaceSite_OnPosRectChange(This
->inplace
, &rect
);
389 static HRESULT WINAPI
WebBrowser_get_Height(IWebBrowser2
*iface
, long *pl
)
391 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
393 TRACE("(%p)->(%p)\n", This
, pl
);
395 *pl
= This
->pos_rect
.bottom
- This
->pos_rect
.top
;
399 static HRESULT WINAPI
WebBrowser_put_Height(IWebBrowser2
*iface
, long Height
)
401 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
404 TRACE("(%p)->(%ld)\n", This
, Height
);
409 memcpy(&rect
, &This
->pos_rect
, sizeof(RECT
));
410 rect
.bottom
= rect
.top
+Height
;
412 /* We don't really change the window size here.
413 * We just notify the embedder that he should do so. */
414 return IOleInPlaceSite_OnPosRectChange(This
->inplace
, &rect
);
417 static HRESULT WINAPI
WebBrowser_get_LocationName(IWebBrowser2
*iface
, BSTR
*LocationName
)
419 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
420 FIXME("(%p)->(%p)\n", This
, LocationName
);
424 static HRESULT WINAPI
WebBrowser_get_LocationURL(IWebBrowser2
*iface
, BSTR
*LocationURL
)
426 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
428 FIXME("(%p)->(%p)\n", This
, LocationURL
);
430 if(!This
->doc_host
.url
) {
431 static const WCHAR null_char
= 0;
432 *LocationURL
= SysAllocString(&null_char
);
436 *LocationURL
= SysAllocString(This
->doc_host
.url
);
440 static HRESULT WINAPI
WebBrowser_get_Busy(IWebBrowser2
*iface
, VARIANT_BOOL
*pBool
)
442 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
443 FIXME("(%p)->(%p)\n", This
, pBool
);
447 static HRESULT WINAPI
WebBrowser_Quit(IWebBrowser2
*iface
)
449 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
450 FIXME("(%p)\n", This
);
454 static HRESULT WINAPI
WebBrowser_ClientToWindow(IWebBrowser2
*iface
, int *pcx
, int *pcy
)
456 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
457 FIXME("(%p)->(%p %p)\n", This
, pcx
, pcy
);
461 static HRESULT WINAPI
WebBrowser_PutProperty(IWebBrowser2
*iface
, BSTR szProperty
, VARIANT vtValue
)
463 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
464 FIXME("(%p)->(%s)\n", This
, debugstr_w(szProperty
));
468 static HRESULT WINAPI
WebBrowser_GetProperty(IWebBrowser2
*iface
, BSTR szProperty
, VARIANT
*pvtValue
)
470 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
471 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(szProperty
), pvtValue
);
475 static HRESULT WINAPI
WebBrowser_get_Name(IWebBrowser2
*iface
, BSTR
*Name
)
477 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
478 FIXME("(%p)->(%p)\n", This
, Name
);
482 static HRESULT WINAPI
WebBrowser_get_HWND(IWebBrowser2
*iface
, long *pHWND
)
484 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
486 TRACE("(%p)->(%p)\n", This
, pHWND
);
488 /* WebBrowser control never has a frame window (in opposition to InternetExplorer) */
493 static HRESULT WINAPI
WebBrowser_get_FullName(IWebBrowser2
*iface
, BSTR
*FullName
)
495 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
496 FIXME("(%p)->(%p)\n", This
, FullName
);
500 static HRESULT WINAPI
WebBrowser_get_Path(IWebBrowser2
*iface
, BSTR
*Path
)
502 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
503 FIXME("(%p)->(%p)\n", This
, Path
);
507 static HRESULT WINAPI
WebBrowser_get_Visible(IWebBrowser2
*iface
, VARIANT_BOOL
*pBool
)
509 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
511 TRACE("(%p)->(%p)\n", This
, pBool
);
513 *pBool
= This
->visible
;
517 static HRESULT WINAPI
WebBrowser_put_Visible(IWebBrowser2
*iface
, VARIANT_BOOL Value
)
519 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
521 DISPPARAMS dispparams
= {&arg
, NULL
, 1, 0};
523 TRACE("(%p)->(%x)\n", This
, Value
);
525 This
->visible
= Value
;
527 V_VT(&arg
) = VT_BOOL
;
528 V_BOOL(&arg
) = Value
;
529 call_sink(This
->doc_host
.cps
.wbe2
, DISPID_ONVISIBLE
, &dispparams
);
534 static HRESULT WINAPI
WebBrowser_get_StatusBar(IWebBrowser2
*iface
, VARIANT_BOOL
*pBool
)
536 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
538 TRACE("(%p)->(%p)\n", This
, pBool
);
540 *pBool
= This
->status_bar
;
544 static HRESULT WINAPI
WebBrowser_put_StatusBar(IWebBrowser2
*iface
, VARIANT_BOOL Value
)
546 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
548 DISPPARAMS dispparams
= {&arg
, NULL
, 1, 0};
550 TRACE("(%p)->(%x)\n", This
, Value
);
552 This
->status_bar
= Value
? VARIANT_TRUE
: VARIANT_FALSE
;
554 /* In opposition to InternetExplorer, all we should do here is
555 * inform the embedder about the status bar change. */
557 V_VT(&arg
) = VT_BOOL
;
558 V_BOOL(&arg
) = Value
;
559 call_sink(This
->doc_host
.cps
.wbe2
, DISPID_ONSTATUSBAR
, &dispparams
);
564 static HRESULT WINAPI
WebBrowser_get_StatusText(IWebBrowser2
*iface
, BSTR
*StatusText
)
566 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
567 FIXME("(%p)->(%p)\n", This
, StatusText
);
571 static HRESULT WINAPI
WebBrowser_put_StatusText(IWebBrowser2
*iface
, BSTR StatusText
)
573 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
574 FIXME("(%p)->(%s)\n", This
, debugstr_w(StatusText
));
578 static HRESULT WINAPI
WebBrowser_get_ToolBar(IWebBrowser2
*iface
, int *Value
)
580 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
582 TRACE("(%p)->(%p)\n", This
, Value
);
584 *Value
= This
->tool_bar
;
588 static HRESULT WINAPI
WebBrowser_put_ToolBar(IWebBrowser2
*iface
, int Value
)
590 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
592 DISPPARAMS dispparams
= {&arg
, NULL
, 1, 0};
594 TRACE("(%p)->(%x)\n", This
, Value
);
596 This
->tool_bar
= Value
? VARIANT_TRUE
: VARIANT_FALSE
;
598 /* In opposition to InternetExplorer, all we should do here is
599 * inform the embedder about the tool bar change. */
601 V_VT(&arg
) = VT_BOOL
;
602 V_BOOL(&arg
) = Value
;
603 call_sink(This
->doc_host
.cps
.wbe2
, DISPID_ONTOOLBAR
, &dispparams
);
608 static HRESULT WINAPI
WebBrowser_get_MenuBar(IWebBrowser2
*iface
, VARIANT_BOOL
*Value
)
610 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
612 TRACE("(%p)->(%p)\n", This
, Value
);
614 *Value
= This
->menu_bar
;
618 static HRESULT WINAPI
WebBrowser_put_MenuBar(IWebBrowser2
*iface
, VARIANT_BOOL Value
)
620 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
622 DISPPARAMS dispparams
= {&arg
, NULL
, 1, 0};
624 TRACE("(%p)->(%x)\n", This
, Value
);
626 This
->menu_bar
= Value
? VARIANT_TRUE
: VARIANT_FALSE
;
628 /* In opposition to InternetExplorer, all we should do here is
629 * inform the embedder about the menu bar change. */
631 V_VT(&arg
) = VT_BOOL
;
632 V_BOOL(&arg
) = Value
;
633 call_sink(This
->doc_host
.cps
.wbe2
, DISPID_ONMENUBAR
, &dispparams
);
638 static HRESULT WINAPI
WebBrowser_get_FullScreen(IWebBrowser2
*iface
, VARIANT_BOOL
*pbFullScreen
)
640 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
642 TRACE("(%p)->(%p)\n", This
, pbFullScreen
);
644 *pbFullScreen
= This
->full_screen
;
648 static HRESULT WINAPI
WebBrowser_put_FullScreen(IWebBrowser2
*iface
, VARIANT_BOOL bFullScreen
)
650 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
652 TRACE("(%p)->(%x)\n", This
, bFullScreen
);
654 This
->full_screen
= bFullScreen
? VARIANT_TRUE
: VARIANT_FALSE
;
658 static HRESULT WINAPI
WebBrowser_Navigate2(IWebBrowser2
*iface
, VARIANT
*URL
, VARIANT
*Flags
,
659 VARIANT
*TargetFrameName
, VARIANT
*PostData
, VARIANT
*Headers
)
661 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
663 TRACE("(%p)->(%p %p %p %p %p)\n", This
, URL
, Flags
, TargetFrameName
, PostData
, Headers
);
671 if(V_VT(URL
) != VT_BSTR
) {
672 FIXME("Unsupported V_VT(URL) %d\n", V_VT(URL
));
676 return navigate_url(&This
->doc_host
, V_BSTR(URL
), Flags
, TargetFrameName
, PostData
, Headers
);
679 static HRESULT WINAPI
WebBrowser_QueryStatusWB(IWebBrowser2
*iface
, OLECMDID cmdID
, OLECMDF
*pcmdf
)
681 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
682 FIXME("(%p)->(%d %p)\n", This
, cmdID
, pcmdf
);
686 static HRESULT WINAPI
WebBrowser_ExecWB(IWebBrowser2
*iface
, OLECMDID cmdID
,
687 OLECMDEXECOPT cmdexecopt
, VARIANT
*pvaIn
, VARIANT
*pvaOut
)
689 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
690 FIXME("(%p)->(%d %d %p %p)\n", This
, cmdID
, cmdexecopt
, pvaIn
, pvaOut
);
694 static HRESULT WINAPI
WebBrowser_ShowBrowserBar(IWebBrowser2
*iface
, VARIANT
*pvaClsid
,
695 VARIANT
*pvarShow
, VARIANT
*pvarSize
)
697 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
698 FIXME("(%p)->(%p %p %p)\n", This
, pvaClsid
, pvarShow
, pvarSize
);
702 static HRESULT WINAPI
WebBrowser_get_ReadyState(IWebBrowser2
*iface
, READYSTATE
*lpReadyState
)
704 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
705 FIXME("(%p)->(%p)\n", This
, lpReadyState
);
709 static HRESULT WINAPI
WebBrowser_get_Offline(IWebBrowser2
*iface
, VARIANT_BOOL
*pbOffline
)
711 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
713 TRACE("(%p)->(%p)\n", This
, pbOffline
);
715 *pbOffline
= This
->doc_host
.offline
;
719 static HRESULT WINAPI
WebBrowser_put_Offline(IWebBrowser2
*iface
, VARIANT_BOOL bOffline
)
721 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
723 TRACE("(%p)->(%x)\n", This
, bOffline
);
725 This
->doc_host
.offline
= bOffline
? VARIANT_TRUE
: VARIANT_FALSE
;
729 static HRESULT WINAPI
WebBrowser_get_Silent(IWebBrowser2
*iface
, VARIANT_BOOL
*pbSilent
)
731 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
733 TRACE("(%p)->(%p)\n", This
, pbSilent
);
735 *pbSilent
= This
->doc_host
.silent
;
739 static HRESULT WINAPI
WebBrowser_put_Silent(IWebBrowser2
*iface
, VARIANT_BOOL bSilent
)
741 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
743 TRACE("(%p)->(%x)\n", This
, bSilent
);
745 This
->doc_host
.silent
= bSilent
? VARIANT_TRUE
: VARIANT_FALSE
;
749 static HRESULT WINAPI
WebBrowser_get_RegisterAsBrowser(IWebBrowser2
*iface
,
750 VARIANT_BOOL
*pbRegister
)
752 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
753 FIXME("(%p)->(%p)\n", This
, pbRegister
);
757 static HRESULT WINAPI
WebBrowser_put_RegisterAsBrowser(IWebBrowser2
*iface
,
758 VARIANT_BOOL bRegister
)
760 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
761 FIXME("(%p)->(%x)\n", This
, bRegister
);
765 static HRESULT WINAPI
WebBrowser_get_RegisterAsDropTarget(IWebBrowser2
*iface
,
766 VARIANT_BOOL
*pbRegister
)
768 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
769 FIXME("(%p)->(%p)\n", This
, pbRegister
);
773 static HRESULT WINAPI
WebBrowser_put_RegisterAsDropTarget(IWebBrowser2
*iface
,
774 VARIANT_BOOL bRegister
)
776 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
777 FIXME("(%p)->(%x)\n", This
, bRegister
);
781 static HRESULT WINAPI
WebBrowser_get_TheaterMode(IWebBrowser2
*iface
, VARIANT_BOOL
*pbRegister
)
783 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
784 FIXME("(%p)->(%p)\n", This
, pbRegister
);
788 static HRESULT WINAPI
WebBrowser_put_TheaterMode(IWebBrowser2
*iface
, VARIANT_BOOL bRegister
)
790 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
791 FIXME("(%p)->(%x)\n", This
, bRegister
);
795 static HRESULT WINAPI
WebBrowser_get_AddressBar(IWebBrowser2
*iface
, VARIANT_BOOL
*Value
)
797 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
799 TRACE("(%p)->(%p)\n", This
, Value
);
801 *Value
= This
->address_bar
;
805 static HRESULT WINAPI
WebBrowser_put_AddressBar(IWebBrowser2
*iface
, VARIANT_BOOL Value
)
807 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
809 DISPPARAMS dispparams
= {&arg
, NULL
, 1, 0};
811 TRACE("(%p)->(%x)\n", This
, Value
);
813 This
->address_bar
= Value
? VARIANT_TRUE
: VARIANT_FALSE
;
815 /* In opposition to InternetExplorer, all we should do here is
816 * inform the embedder about the address bar change. */
818 V_VT(&arg
) = VT_BOOL
;
819 V_BOOL(&arg
) = Value
;
820 call_sink(This
->doc_host
.cps
.wbe2
, DISPID_ONADDRESSBAR
, &dispparams
);
825 static HRESULT WINAPI
WebBrowser_get_Resizable(IWebBrowser2
*iface
, VARIANT_BOOL
*Value
)
827 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
829 TRACE("(%p)->(%p)\n", This
, Value
);
831 /* It's InternetExplorer object's method. We have nothing to do here. */
835 static HRESULT WINAPI
WebBrowser_put_Resizable(IWebBrowser2
*iface
, VARIANT_BOOL Value
)
837 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
839 TRACE("(%p)->(%x)\n", This
, Value
);
841 /* It's InternetExplorer object's method. We have nothing to do here. */
845 #undef WEBBROWSER_THIS
847 static const IWebBrowser2Vtbl WebBrowser2Vtbl
=
849 WebBrowser_QueryInterface
,
852 WebBrowser_GetTypeInfoCount
,
853 WebBrowser_GetTypeInfo
,
854 WebBrowser_GetIDsOfNames
,
857 WebBrowser_GoForward
,
864 WebBrowser_get_Application
,
865 WebBrowser_get_Parent
,
866 WebBrowser_get_Container
,
867 WebBrowser_get_Document
,
868 WebBrowser_get_TopLevelContainer
,
874 WebBrowser_get_Width
,
875 WebBrowser_put_Width
,
876 WebBrowser_get_Height
,
877 WebBrowser_put_Height
,
878 WebBrowser_get_LocationName
,
879 WebBrowser_get_LocationURL
,
882 WebBrowser_ClientToWindow
,
883 WebBrowser_PutProperty
,
884 WebBrowser_GetProperty
,
887 WebBrowser_get_FullName
,
889 WebBrowser_get_Visible
,
890 WebBrowser_put_Visible
,
891 WebBrowser_get_StatusBar
,
892 WebBrowser_put_StatusBar
,
893 WebBrowser_get_StatusText
,
894 WebBrowser_put_StatusText
,
895 WebBrowser_get_ToolBar
,
896 WebBrowser_put_ToolBar
,
897 WebBrowser_get_MenuBar
,
898 WebBrowser_put_MenuBar
,
899 WebBrowser_get_FullScreen
,
900 WebBrowser_put_FullScreen
,
901 WebBrowser_Navigate2
,
902 WebBrowser_QueryStatusWB
,
904 WebBrowser_ShowBrowserBar
,
905 WebBrowser_get_ReadyState
,
906 WebBrowser_get_Offline
,
907 WebBrowser_put_Offline
,
908 WebBrowser_get_Silent
,
909 WebBrowser_put_Silent
,
910 WebBrowser_get_RegisterAsBrowser
,
911 WebBrowser_put_RegisterAsBrowser
,
912 WebBrowser_get_RegisterAsDropTarget
,
913 WebBrowser_put_RegisterAsDropTarget
,
914 WebBrowser_get_TheaterMode
,
915 WebBrowser_put_TheaterMode
,
916 WebBrowser_get_AddressBar
,
917 WebBrowser_put_AddressBar
,
918 WebBrowser_get_Resizable
,
919 WebBrowser_put_Resizable
922 static HRESULT
WebBrowser_Create(INT version
, IUnknown
*pOuter
, REFIID riid
, void **ppv
)
927 TRACE("(%p %s %p) version=%d\n", pOuter
, debugstr_guid(riid
), ppv
, version
);
929 ret
= shdocvw_alloc(sizeof(WebBrowser
));
931 ret
->lpWebBrowser2Vtbl
= &WebBrowser2Vtbl
;
933 ret
->version
= version
;
935 DocHost_Init(&ret
->doc_host
, (IDispatch
*)WEBBROWSER2(ret
));
937 ret
->visible
= VARIANT_TRUE
;
938 ret
->menu_bar
= VARIANT_TRUE
;
939 ret
->address_bar
= VARIANT_TRUE
;
940 ret
->status_bar
= VARIANT_TRUE
;
941 ret
->tool_bar
= VARIANT_TRUE
;
942 ret
->full_screen
= VARIANT_FALSE
;
944 WebBrowser_OleObject_Init(ret
);
945 WebBrowser_ViewObject_Init(ret
);
946 WebBrowser_Persist_Init(ret
);
947 WebBrowser_ClassInfo_Init(ret
);
948 WebBrowser_HlinkFrame_Init(ret
);
950 hres
= IWebBrowser_QueryInterface(WEBBROWSER(ret
), riid
, ppv
);
951 if(SUCCEEDED(hres
)) {
952 SHDOCVW_LockModule();
961 HRESULT
WebBrowserV1_Create(IUnknown
*pOuter
, REFIID riid
, void **ppv
)
963 return WebBrowser_Create(1, pOuter
, riid
, ppv
);
966 HRESULT
WebBrowserV2_Create(IUnknown
*pOuter
, REFIID riid
, void **ppv
)
968 return WebBrowser_Create(2, pOuter
, riid
, ppv
);