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_ITargetFrame2
, riid
)) {
106 TRACE("(%p)->(IID_ITargetFrame2 %p)\n", This
, ppv
);
107 *ppv
= TARGETFRAME2(This
);
108 }else if(IsEqualGUID(&IID_IServiceProvider
, riid
)) {
109 *ppv
= SERVPROV(This
);
110 TRACE("(%p)->(IID_IServiceProvider %p)\n", This
, ppv
);
111 }else if(IsEqualGUID(&IID_IDataObject
, riid
)) {
112 *ppv
= DATAOBJECT(This
);
113 TRACE("(%p)->(IID_IDataObject %p)\n", This
, ppv
);
114 }else if(IsEqualGUID(&IID_IQuickActivate
, riid
)) {
115 TRACE("(%p)->(IID_IQuickActivate %p) returning NULL\n", This
, ppv
);
116 return E_NOINTERFACE
;
117 }else if(IsEqualGUID(&IID_IRunnableObject
, riid
)) {
118 TRACE("(%p)->(IID_IRunnableObject %p) returning NULL\n", This
, ppv
);
119 return E_NOINTERFACE
;
120 }else if(IsEqualGUID(&IID_IPerPropertyBrowsing
, riid
)) {
121 TRACE("(%p)->(IID_IPerPropertyBrowsing %p) returning NULL\n", This
, ppv
);
122 return E_NOINTERFACE
;
123 }else if(IsEqualGUID(&IID_IOleCache
, riid
)) {
124 TRACE("(%p)->(IID_IOleCache %p) returning NULL\n", This
, ppv
);
125 return E_NOINTERFACE
;
126 }else if(IsEqualGUID(&IID_IOleInPlaceSite
, riid
)) {
127 TRACE("(%p)->(IID_IOleInPlaceSite %p) returning NULL\n", This
, ppv
);
128 return E_NOINTERFACE
;
129 }else if(IsEqualGUID(&IID_IObjectWithSite
, riid
)) {
130 TRACE("(%p)->(IID_IObjectWithSite %p) returning NULL\n", This
, ppv
);
131 return E_NOINTERFACE
;
132 }else if(IsEqualGUID(&IID_IViewObjectEx
, riid
)) {
133 TRACE("(%p)->(IID_IViewObjectEx %p) returning NULL\n", This
, ppv
);
134 return E_NOINTERFACE
;
138 IUnknown_AddRef((IUnknown
*)*ppv
);
142 FIXME("(%p)->(%s %p) interface not supported\n", This
, debugstr_guid(riid
), ppv
);
143 return E_NOINTERFACE
;
146 static ULONG WINAPI
WebBrowser_AddRef(IWebBrowser2
*iface
)
148 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
149 LONG ref
= InterlockedIncrement(&This
->ref
);
150 TRACE("(%p) ref=%d\n", This
, ref
);
154 static ULONG WINAPI
WebBrowser_Release(IWebBrowser2
*iface
)
156 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
157 LONG ref
= InterlockedDecrement(&This
->ref
);
159 TRACE("(%p) ref=%d\n", This
, ref
);
162 if(This
->doc_host
.document
)
163 IUnknown_Release(This
->doc_host
.document
);
165 DocHost_Release(&This
->doc_host
);
167 WebBrowser_OleObject_Destroy(This
);
170 SHDOCVW_UnlockModule();
176 /* IDispatch methods */
177 static HRESULT WINAPI
WebBrowser_GetTypeInfoCount(IWebBrowser2
*iface
, UINT
*pctinfo
)
179 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
181 TRACE("(%p)->(%p)\n", This
, pctinfo
);
187 static HRESULT WINAPI
WebBrowser_GetTypeInfo(IWebBrowser2
*iface
, UINT iTInfo
, LCID lcid
,
190 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
194 TRACE("(%p)->(%d %d %p)\n", This
, iTInfo
, lcid
, ppTInfo
);
196 hres
= get_typeinfo(&typeinfo
);
200 ITypeInfo_AddRef(typeinfo
);
205 static HRESULT WINAPI
WebBrowser_GetIDsOfNames(IWebBrowser2
*iface
, REFIID riid
,
206 LPOLESTR
*rgszNames
, UINT cNames
,
207 LCID lcid
, DISPID
*rgDispId
)
209 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
213 TRACE("(%p)->(%s %p %d %d %p)\n", This
, debugstr_guid(riid
), rgszNames
, cNames
,
216 hres
= get_typeinfo(&typeinfo
);
220 return ITypeInfo_GetIDsOfNames(typeinfo
, rgszNames
, cNames
, rgDispId
);
223 static HRESULT WINAPI
WebBrowser_Invoke(IWebBrowser2
*iface
, DISPID dispIdMember
,
224 REFIID riid
, LCID lcid
, WORD wFlags
,
225 DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
226 EXCEPINFO
*pExepInfo
, UINT
*puArgErr
)
228 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
232 TRACE("(%p)->(%d %s %d %08x %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
233 lcid
, wFlags
, pDispParams
, pVarResult
, pExepInfo
, puArgErr
);
235 hres
= get_typeinfo(&typeinfo
);
239 return ITypeInfo_Invoke(typeinfo
, WEBBROWSER2(This
), dispIdMember
, wFlags
, pDispParams
,
240 pVarResult
, pExepInfo
, puArgErr
);
243 /* IWebBrowser methods */
244 static HRESULT WINAPI
WebBrowser_GoBack(IWebBrowser2
*iface
)
246 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
247 FIXME("(%p)\n", This
);
251 static HRESULT WINAPI
WebBrowser_GoForward(IWebBrowser2
*iface
)
253 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
254 FIXME("(%p)\n", This
);
258 static HRESULT WINAPI
WebBrowser_GoHome(IWebBrowser2
*iface
)
260 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
261 TRACE("(%p)\n", This
);
262 return go_home(&This
->doc_host
);
265 static HRESULT WINAPI
WebBrowser_GoSearch(IWebBrowser2
*iface
)
267 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
268 FIXME("(%p)\n", This
);
272 static HRESULT WINAPI
WebBrowser_Navigate(IWebBrowser2
*iface
, BSTR szUrl
,
273 VARIANT
*Flags
, VARIANT
*TargetFrameName
,
274 VARIANT
*PostData
, VARIANT
*Headers
)
276 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
278 TRACE("(%p)->(%s %s %s %s %s)\n", This
, debugstr_w(szUrl
), debugstr_variant(Flags
),
279 debugstr_variant(TargetFrameName
), debugstr_variant(PostData
),
280 debugstr_variant(Headers
));
282 return navigate_url(&This
->doc_host
, szUrl
, Flags
, TargetFrameName
, PostData
, Headers
);
285 static HRESULT WINAPI
WebBrowser_Refresh(IWebBrowser2
*iface
)
287 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
288 FIXME("(%p)\n", This
);
292 static HRESULT WINAPI
WebBrowser_Refresh2(IWebBrowser2
*iface
, VARIANT
*Level
)
294 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
295 FIXME("(%p)->(%s)\n", This
, debugstr_variant(Level
));
299 static HRESULT WINAPI
WebBrowser_Stop(IWebBrowser2
*iface
)
301 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
302 FIXME("(%p)\n", This
);
306 static HRESULT WINAPI
WebBrowser_get_Application(IWebBrowser2
*iface
, IDispatch
**ppDisp
)
308 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
310 TRACE("(%p)->(%p)\n", This
, ppDisp
);
315 *ppDisp
= (IDispatch
*)WEBBROWSER2(This
);
316 IDispatch_AddRef(*ppDisp
);
320 static HRESULT WINAPI
WebBrowser_get_Parent(IWebBrowser2
*iface
, IDispatch
**ppDisp
)
322 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
323 FIXME("(%p)->(%p)\n", This
, ppDisp
);
327 static HRESULT WINAPI
WebBrowser_get_Container(IWebBrowser2
*iface
, IDispatch
**ppDisp
)
329 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
330 FIXME("(%p)->(%p)\n", This
, ppDisp
);
334 static HRESULT WINAPI
WebBrowser_get_Document(IWebBrowser2
*iface
, IDispatch
**ppDisp
)
336 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
338 TRACE("(%p)->(%p)\n", This
, ppDisp
);
341 if(This
->doc_host
.document
)
342 IUnknown_QueryInterface(This
->doc_host
.document
, &IID_IDispatch
, (void**)ppDisp
);
347 static HRESULT WINAPI
WebBrowser_get_TopLevelContainer(IWebBrowser2
*iface
, VARIANT_BOOL
*pBool
)
349 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
350 FIXME("(%p)->(%p)\n", This
, pBool
);
354 static HRESULT WINAPI
WebBrowser_get_Type(IWebBrowser2
*iface
, BSTR
*Type
)
356 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
357 FIXME("(%p)->(%p)\n", This
, Type
);
361 static HRESULT WINAPI
WebBrowser_get_Left(IWebBrowser2
*iface
, LONG
*pl
)
363 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
365 TRACE("(%p)->(%p)\n", This
, pl
);
367 *pl
= This
->pos_rect
.left
;
371 static HRESULT WINAPI
WebBrowser_put_Left(IWebBrowser2
*iface
, LONG Left
)
373 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
376 TRACE("(%p)->(%d)\n", This
, Left
);
381 rect
= This
->pos_rect
;
384 /* We don't really change the window position 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_Top(IWebBrowser2
*iface
, LONG
*pl
)
391 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
393 TRACE("(%p)->(%p)\n", This
, pl
);
395 *pl
= This
->pos_rect
.top
;
399 static HRESULT WINAPI
WebBrowser_put_Top(IWebBrowser2
*iface
, LONG Top
)
401 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
404 TRACE("(%p)->(%d)\n", This
, Top
);
409 rect
= This
->pos_rect
;
412 /* We don't really change the window position 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_Width(IWebBrowser2
*iface
, LONG
*pl
)
419 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
421 TRACE("(%p)->(%p)\n", This
, pl
);
423 *pl
= This
->pos_rect
.right
- This
->pos_rect
.left
;
427 static HRESULT WINAPI
WebBrowser_put_Width(IWebBrowser2
*iface
, LONG Width
)
429 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
432 TRACE("(%p)->(%d)\n", This
, Width
);
437 rect
= This
->pos_rect
;
438 rect
.right
= rect
.left
+Width
;
440 /* We don't really change the window size here.
441 * We just notify the embedder that he should do so. */
442 return IOleInPlaceSite_OnPosRectChange(This
->inplace
, &rect
);
445 static HRESULT WINAPI
WebBrowser_get_Height(IWebBrowser2
*iface
, LONG
*pl
)
447 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
449 TRACE("(%p)->(%p)\n", This
, pl
);
451 *pl
= This
->pos_rect
.bottom
- This
->pos_rect
.top
;
455 static HRESULT WINAPI
WebBrowser_put_Height(IWebBrowser2
*iface
, LONG Height
)
457 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
460 TRACE("(%p)->(%d)\n", This
, Height
);
465 rect
= This
->pos_rect
;
466 rect
.bottom
= rect
.top
+Height
;
468 /* We don't really change the window size here.
469 * We just notify the embedder that he should do so. */
470 return IOleInPlaceSite_OnPosRectChange(This
->inplace
, &rect
);
473 static HRESULT WINAPI
WebBrowser_get_LocationName(IWebBrowser2
*iface
, BSTR
*LocationName
)
475 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
476 FIXME("(%p)->(%p)\n", This
, LocationName
);
480 static HRESULT WINAPI
WebBrowser_get_LocationURL(IWebBrowser2
*iface
, BSTR
*LocationURL
)
482 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
484 FIXME("(%p)->(%p)\n", This
, LocationURL
);
486 if(!This
->doc_host
.url
) {
487 static const WCHAR null_char
= 0;
488 *LocationURL
= SysAllocString(&null_char
);
492 *LocationURL
= SysAllocString(This
->doc_host
.url
);
496 static HRESULT WINAPI
WebBrowser_get_Busy(IWebBrowser2
*iface
, VARIANT_BOOL
*pBool
)
498 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
500 TRACE("(%p)->(%p)\n", This
, pBool
);
502 *pBool
= This
->doc_host
.busy
;
506 static HRESULT WINAPI
WebBrowser_Quit(IWebBrowser2
*iface
)
508 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
510 TRACE("(%p)\n", This
);
512 /* It's a InternetExplorer specific method, we have nothing to do here. */
516 static HRESULT WINAPI
WebBrowser_ClientToWindow(IWebBrowser2
*iface
, int *pcx
, int *pcy
)
518 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
519 FIXME("(%p)->(%p %p)\n", This
, pcx
, pcy
);
523 static HRESULT WINAPI
WebBrowser_PutProperty(IWebBrowser2
*iface
, BSTR szProperty
, VARIANT vtValue
)
525 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
526 FIXME("(%p)->(%s %s)\n", This
, debugstr_w(szProperty
), debugstr_variant(&vtValue
));
530 static HRESULT WINAPI
WebBrowser_GetProperty(IWebBrowser2
*iface
, BSTR szProperty
, VARIANT
*pvtValue
)
532 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
533 FIXME("(%p)->(%s %s)\n", This
, debugstr_w(szProperty
), debugstr_variant(pvtValue
));
537 static HRESULT WINAPI
WebBrowser_get_Name(IWebBrowser2
*iface
, BSTR
*Name
)
539 static const WCHAR sName
[] = {'M','i','c','r','o','s','o','f','t',' ','W','e','b',
540 ' ','B','r','o','w','s','e','r',' ','C','o','n','t','r','o','l',0};
541 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
543 TRACE("(%p)->(%p)\n", This
, Name
);
545 *Name
= SysAllocString(sName
);
550 static HRESULT WINAPI
WebBrowser_get_HWND(IWebBrowser2
*iface
, LONG
*pHWND
)
552 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
554 TRACE("(%p)->(%p)\n", This
, pHWND
);
556 /* WebBrowser control never has a frame window (in opposition to InternetExplorer) */
561 static HRESULT WINAPI
WebBrowser_get_FullName(IWebBrowser2
*iface
, BSTR
*FullName
)
563 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
564 FIXME("(%p)->(%p)\n", This
, FullName
);
568 static HRESULT WINAPI
WebBrowser_get_Path(IWebBrowser2
*iface
, BSTR
*Path
)
570 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
571 FIXME("(%p)->(%p)\n", This
, Path
);
575 static HRESULT WINAPI
WebBrowser_get_Visible(IWebBrowser2
*iface
, VARIANT_BOOL
*pBool
)
577 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
579 TRACE("(%p)->(%p)\n", This
, pBool
);
581 *pBool
= This
->visible
;
585 static HRESULT WINAPI
WebBrowser_put_Visible(IWebBrowser2
*iface
, VARIANT_BOOL Value
)
587 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
589 DISPPARAMS dispparams
= {&arg
, NULL
, 1, 0};
591 TRACE("(%p)->(%x)\n", This
, Value
);
593 This
->visible
= Value
;
595 V_VT(&arg
) = VT_BOOL
;
596 V_BOOL(&arg
) = Value
;
597 call_sink(This
->doc_host
.cps
.wbe2
, DISPID_ONVISIBLE
, &dispparams
);
602 static HRESULT WINAPI
WebBrowser_get_StatusBar(IWebBrowser2
*iface
, VARIANT_BOOL
*pBool
)
604 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
606 TRACE("(%p)->(%p)\n", This
, pBool
);
608 *pBool
= This
->status_bar
;
612 static HRESULT WINAPI
WebBrowser_put_StatusBar(IWebBrowser2
*iface
, VARIANT_BOOL Value
)
614 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
616 DISPPARAMS dispparams
= {&arg
, NULL
, 1, 0};
618 TRACE("(%p)->(%x)\n", This
, Value
);
620 This
->status_bar
= Value
? VARIANT_TRUE
: VARIANT_FALSE
;
622 /* In opposition to InternetExplorer, all we should do here is
623 * inform the embedder about the status bar change. */
625 V_VT(&arg
) = VT_BOOL
;
626 V_BOOL(&arg
) = Value
;
627 call_sink(This
->doc_host
.cps
.wbe2
, DISPID_ONSTATUSBAR
, &dispparams
);
632 static HRESULT WINAPI
WebBrowser_get_StatusText(IWebBrowser2
*iface
, BSTR
*StatusText
)
634 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
635 FIXME("(%p)->(%p)\n", This
, StatusText
);
639 static HRESULT WINAPI
WebBrowser_put_StatusText(IWebBrowser2
*iface
, BSTR StatusText
)
641 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
642 FIXME("(%p)->(%s)\n", This
, debugstr_w(StatusText
));
646 static HRESULT WINAPI
WebBrowser_get_ToolBar(IWebBrowser2
*iface
, int *Value
)
648 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
650 TRACE("(%p)->(%p)\n", This
, Value
);
652 *Value
= This
->tool_bar
;
656 static HRESULT WINAPI
WebBrowser_put_ToolBar(IWebBrowser2
*iface
, int Value
)
658 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
660 DISPPARAMS dispparams
= {&arg
, NULL
, 1, 0};
662 TRACE("(%p)->(%x)\n", This
, Value
);
664 This
->tool_bar
= Value
? VARIANT_TRUE
: VARIANT_FALSE
;
666 /* In opposition to InternetExplorer, all we should do here is
667 * inform the embedder about the tool bar change. */
669 V_VT(&arg
) = VT_BOOL
;
670 V_BOOL(&arg
) = This
->tool_bar
;
671 call_sink(This
->doc_host
.cps
.wbe2
, DISPID_ONTOOLBAR
, &dispparams
);
676 static HRESULT WINAPI
WebBrowser_get_MenuBar(IWebBrowser2
*iface
, VARIANT_BOOL
*Value
)
678 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
680 TRACE("(%p)->(%p)\n", This
, Value
);
682 *Value
= This
->menu_bar
;
686 static HRESULT WINAPI
WebBrowser_put_MenuBar(IWebBrowser2
*iface
, VARIANT_BOOL Value
)
688 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
690 DISPPARAMS dispparams
= {&arg
, NULL
, 1, 0};
692 TRACE("(%p)->(%x)\n", This
, Value
);
694 This
->menu_bar
= Value
? VARIANT_TRUE
: VARIANT_FALSE
;
696 /* In opposition to InternetExplorer, all we should do here is
697 * inform the embedder about the menu bar change. */
699 V_VT(&arg
) = VT_BOOL
;
700 V_BOOL(&arg
) = Value
;
701 call_sink(This
->doc_host
.cps
.wbe2
, DISPID_ONMENUBAR
, &dispparams
);
706 static HRESULT WINAPI
WebBrowser_get_FullScreen(IWebBrowser2
*iface
, VARIANT_BOOL
*pbFullScreen
)
708 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
710 TRACE("(%p)->(%p)\n", This
, pbFullScreen
);
712 *pbFullScreen
= This
->full_screen
;
716 static HRESULT WINAPI
WebBrowser_put_FullScreen(IWebBrowser2
*iface
, VARIANT_BOOL bFullScreen
)
718 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
720 DISPPARAMS dispparams
= {&arg
, NULL
, 1, 0};
722 /* In opposition to InternetExplorer, all we should do here is
723 * inform the embedder about the fullscreen change. */
725 TRACE("(%p)->(%x)\n", This
, bFullScreen
);
727 This
->full_screen
= bFullScreen
? VARIANT_TRUE
: VARIANT_FALSE
;
729 V_VT(&arg
) = VT_BOOL
;
730 V_BOOL(&arg
) = bFullScreen
;
731 call_sink(This
->doc_host
.cps
.wbe2
, DISPID_ONFULLSCREEN
, &dispparams
);
736 static HRESULT WINAPI
WebBrowser_Navigate2(IWebBrowser2
*iface
, VARIANT
*URL
, VARIANT
*Flags
,
737 VARIANT
*TargetFrameName
, VARIANT
*PostData
, VARIANT
*Headers
)
739 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
742 TRACE("(%p)->(%s %s %s %s %s)\n", This
, debugstr_variant(URL
), debugstr_variant(Flags
),
743 debugstr_variant(TargetFrameName
), debugstr_variant(PostData
), debugstr_variant(Headers
));
756 case VT_BSTR
|VT_BYREF
:
757 url
= *V_BSTRREF(URL
);
760 FIXME("Unsupported V_VT(URL) %d\n", V_VT(URL
));
764 return navigate_url(&This
->doc_host
, url
, Flags
, TargetFrameName
, PostData
, Headers
);
767 static HRESULT WINAPI
WebBrowser_QueryStatusWB(IWebBrowser2
*iface
, OLECMDID cmdID
, OLECMDF
*pcmdf
)
769 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
770 FIXME("(%p)->(%d %p)\n", This
, cmdID
, pcmdf
);
774 static HRESULT WINAPI
WebBrowser_ExecWB(IWebBrowser2
*iface
, OLECMDID cmdID
,
775 OLECMDEXECOPT cmdexecopt
, VARIANT
*pvaIn
, VARIANT
*pvaOut
)
777 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
778 FIXME("(%p)->(%d %d %s %p)\n", This
, cmdID
, cmdexecopt
, debugstr_variant(pvaIn
), pvaOut
);
782 static HRESULT WINAPI
WebBrowser_ShowBrowserBar(IWebBrowser2
*iface
, VARIANT
*pvaClsid
,
783 VARIANT
*pvarShow
, VARIANT
*pvarSize
)
785 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
786 FIXME("(%p)->(%s %s %s)\n", This
, debugstr_variant(pvaClsid
), debugstr_variant(pvarShow
),
787 debugstr_variant(pvarSize
));
791 static HRESULT WINAPI
WebBrowser_get_ReadyState(IWebBrowser2
*iface
, READYSTATE
*lpReadyState
)
793 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
795 TRACE("(%p)->(%p)\n", This
, lpReadyState
);
797 *lpReadyState
= This
->doc_host
.ready_state
;
801 static HRESULT WINAPI
WebBrowser_get_Offline(IWebBrowser2
*iface
, VARIANT_BOOL
*pbOffline
)
803 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
805 TRACE("(%p)->(%p)\n", This
, pbOffline
);
807 *pbOffline
= This
->doc_host
.offline
;
811 static HRESULT WINAPI
WebBrowser_put_Offline(IWebBrowser2
*iface
, VARIANT_BOOL bOffline
)
813 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
815 TRACE("(%p)->(%x)\n", This
, bOffline
);
817 This
->doc_host
.offline
= bOffline
? VARIANT_TRUE
: VARIANT_FALSE
;
821 static HRESULT WINAPI
WebBrowser_get_Silent(IWebBrowser2
*iface
, VARIANT_BOOL
*pbSilent
)
823 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
825 TRACE("(%p)->(%p)\n", This
, pbSilent
);
827 *pbSilent
= This
->doc_host
.silent
;
831 static HRESULT WINAPI
WebBrowser_put_Silent(IWebBrowser2
*iface
, VARIANT_BOOL bSilent
)
833 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
835 TRACE("(%p)->(%x)\n", This
, bSilent
);
837 This
->doc_host
.silent
= bSilent
? VARIANT_TRUE
: VARIANT_FALSE
;
841 static HRESULT WINAPI
WebBrowser_get_RegisterAsBrowser(IWebBrowser2
*iface
,
842 VARIANT_BOOL
*pbRegister
)
844 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
846 FIXME("(%p)->(%p)\n", This
, pbRegister
);
848 *pbRegister
= This
->register_browser
;
852 static HRESULT WINAPI
WebBrowser_put_RegisterAsBrowser(IWebBrowser2
*iface
,
853 VARIANT_BOOL bRegister
)
855 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
857 FIXME("(%p)->(%x)\n", This
, bRegister
);
859 This
->register_browser
= bRegister
? VARIANT_TRUE
: VARIANT_FALSE
;
863 static HRESULT WINAPI
WebBrowser_get_RegisterAsDropTarget(IWebBrowser2
*iface
,
864 VARIANT_BOOL
*pbRegister
)
866 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
867 FIXME("(%p)->(%p)\n", This
, pbRegister
);
872 static HRESULT WINAPI
WebBrowser_put_RegisterAsDropTarget(IWebBrowser2
*iface
,
873 VARIANT_BOOL bRegister
)
875 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
876 FIXME("(%p)->(%x)\n", This
, bRegister
);
880 static HRESULT WINAPI
WebBrowser_get_TheaterMode(IWebBrowser2
*iface
, VARIANT_BOOL
*pbRegister
)
882 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
884 TRACE("(%p)->(%p)\n", This
, pbRegister
);
886 *pbRegister
= This
->theater_mode
;
890 static HRESULT WINAPI
WebBrowser_put_TheaterMode(IWebBrowser2
*iface
, VARIANT_BOOL bRegister
)
892 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
894 DISPPARAMS dispparams
= {&arg
, NULL
, 1, 0};
896 TRACE("(%p)->(%x)\n", This
, bRegister
);
898 This
->theater_mode
= bRegister
? VARIANT_TRUE
: VARIANT_FALSE
;
900 /* In opposition to InternetExplorer, all we should do here is
901 * inform the embedder about the theater mode change. */
903 V_VT(&arg
) = VT_BOOL
;
904 V_BOOL(&arg
) = bRegister
;
905 call_sink(This
->doc_host
.cps
.wbe2
, DISPID_ONTHEATERMODE
, &dispparams
);
910 static HRESULT WINAPI
WebBrowser_get_AddressBar(IWebBrowser2
*iface
, VARIANT_BOOL
*Value
)
912 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
914 TRACE("(%p)->(%p)\n", This
, Value
);
916 *Value
= This
->address_bar
;
920 static HRESULT WINAPI
WebBrowser_put_AddressBar(IWebBrowser2
*iface
, VARIANT_BOOL Value
)
922 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
924 DISPPARAMS dispparams
= {&arg
, NULL
, 1, 0};
926 TRACE("(%p)->(%x)\n", This
, Value
);
928 This
->address_bar
= Value
? VARIANT_TRUE
: VARIANT_FALSE
;
930 /* In opposition to InternetExplorer, all we should do here is
931 * inform the embedder about the address bar change. */
933 V_VT(&arg
) = VT_BOOL
;
934 V_BOOL(&arg
) = Value
;
935 call_sink(This
->doc_host
.cps
.wbe2
, DISPID_ONADDRESSBAR
, &dispparams
);
940 static HRESULT WINAPI
WebBrowser_get_Resizable(IWebBrowser2
*iface
, VARIANT_BOOL
*Value
)
942 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
944 TRACE("(%p)->(%p)\n", This
, Value
);
946 /* It's InternetExplorer object's method. We have nothing to do here. */
950 static HRESULT WINAPI
WebBrowser_put_Resizable(IWebBrowser2
*iface
, VARIANT_BOOL Value
)
952 WebBrowser
*This
= WEBBROWSER_THIS(iface
);
954 DISPPARAMS dispparams
= {&arg
, NULL
, 1, 0};
956 TRACE("(%p)->(%x)\n", This
, Value
);
958 /* In opposition to InternetExplorer, all we should do here is
959 * inform the embedder about the resizable change. */
961 V_VT(&arg
) = VT_BOOL
;
962 V_BOOL(&arg
) = Value
;
963 call_sink(This
->doc_host
.cps
.wbe2
, DISPID_WINDOWSETRESIZABLE
, &dispparams
);
968 #undef WEBBROWSER_THIS
970 static const IWebBrowser2Vtbl WebBrowser2Vtbl
=
972 WebBrowser_QueryInterface
,
975 WebBrowser_GetTypeInfoCount
,
976 WebBrowser_GetTypeInfo
,
977 WebBrowser_GetIDsOfNames
,
980 WebBrowser_GoForward
,
987 WebBrowser_get_Application
,
988 WebBrowser_get_Parent
,
989 WebBrowser_get_Container
,
990 WebBrowser_get_Document
,
991 WebBrowser_get_TopLevelContainer
,
997 WebBrowser_get_Width
,
998 WebBrowser_put_Width
,
999 WebBrowser_get_Height
,
1000 WebBrowser_put_Height
,
1001 WebBrowser_get_LocationName
,
1002 WebBrowser_get_LocationURL
,
1003 WebBrowser_get_Busy
,
1005 WebBrowser_ClientToWindow
,
1006 WebBrowser_PutProperty
,
1007 WebBrowser_GetProperty
,
1008 WebBrowser_get_Name
,
1009 WebBrowser_get_HWND
,
1010 WebBrowser_get_FullName
,
1011 WebBrowser_get_Path
,
1012 WebBrowser_get_Visible
,
1013 WebBrowser_put_Visible
,
1014 WebBrowser_get_StatusBar
,
1015 WebBrowser_put_StatusBar
,
1016 WebBrowser_get_StatusText
,
1017 WebBrowser_put_StatusText
,
1018 WebBrowser_get_ToolBar
,
1019 WebBrowser_put_ToolBar
,
1020 WebBrowser_get_MenuBar
,
1021 WebBrowser_put_MenuBar
,
1022 WebBrowser_get_FullScreen
,
1023 WebBrowser_put_FullScreen
,
1024 WebBrowser_Navigate2
,
1025 WebBrowser_QueryStatusWB
,
1027 WebBrowser_ShowBrowserBar
,
1028 WebBrowser_get_ReadyState
,
1029 WebBrowser_get_Offline
,
1030 WebBrowser_put_Offline
,
1031 WebBrowser_get_Silent
,
1032 WebBrowser_put_Silent
,
1033 WebBrowser_get_RegisterAsBrowser
,
1034 WebBrowser_put_RegisterAsBrowser
,
1035 WebBrowser_get_RegisterAsDropTarget
,
1036 WebBrowser_put_RegisterAsDropTarget
,
1037 WebBrowser_get_TheaterMode
,
1038 WebBrowser_put_TheaterMode
,
1039 WebBrowser_get_AddressBar
,
1040 WebBrowser_put_AddressBar
,
1041 WebBrowser_get_Resizable
,
1042 WebBrowser_put_Resizable
1045 #define SERVPROV_THIS(iface) DEFINE_THIS(WebBrowser, OleObject, iface)
1047 * IServiceProvider interface.
1049 static HRESULT WINAPI
WebBrowser_IServiceProvider_QueryInterface(IServiceProvider
*iface
,
1050 REFIID riid
, LPVOID
*ppv
)
1052 WebBrowser
*This
= SERVPROV_THIS(iface
);
1058 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
1059 *ppv
= WEBBROWSER(This
);
1060 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
1061 }else if(IsEqualGUID(&IID_IServiceProvider
, riid
)) {
1062 *ppv
= WEBBROWSER(This
);
1063 TRACE("(%p)->(IID_IServiceProvider %p)\n", This
, ppv
);
1067 IUnknown_AddRef((IUnknown
*)*ppv
);
1071 FIXME("(%p)->(%s %p) interface not supported\n", This
, debugstr_guid(riid
), ppv
);
1072 return E_NOINTERFACE
;
1075 static ULONG WINAPI
WebBrowser_IServiceProvider_AddRef(IServiceProvider
*iface
)
1077 WebBrowser
*This
= SERVPROV_THIS(iface
);
1078 return IWebBrowser_AddRef(WEBBROWSER(This
));
1081 static ULONG WINAPI
WebBrowser_IServiceProvider_Release(IServiceProvider
*iface
)
1083 WebBrowser
*This
= SERVPROV_THIS(iface
);
1084 return IWebBrowser_Release(WEBBROWSER(This
));
1087 static HRESULT STDMETHODCALLTYPE
WebBrowser_IServiceProvider_QueryService(IServiceProvider
*iface
,
1088 REFGUID guidService
, REFIID riid
, void **ppv
)
1090 WebBrowser
*This
= SERVPROV_THIS(iface
);
1091 static const IID IID_IBrowserService2
=
1092 {0x68BD21CC,0x438B,0x11d2,{0xA5,0x60,0x00,0xA0,0xC,0x2D,0xBF,0xE8}};
1097 if(IsEqualGUID(&IID_IBrowserService2
, riid
)) {
1098 TRACE("(%p)->(IID_IBrowserService2 return E_FAIL)\n", This
);
1102 FIXME("(%p)->(%s, %s %p)\n", This
, debugstr_guid(guidService
), debugstr_guid(riid
), ppv
);
1104 return E_NOINTERFACE
;
1107 #undef SERVPROV_THIS
1109 static const IServiceProviderVtbl ServiceProviderVtbl
=
1111 WebBrowser_IServiceProvider_QueryInterface
,
1112 WebBrowser_IServiceProvider_AddRef
,
1113 WebBrowser_IServiceProvider_Release
,
1114 WebBrowser_IServiceProvider_QueryService
1117 static HRESULT
WebBrowser_Create(INT version
, IUnknown
*pOuter
, REFIID riid
, void **ppv
)
1122 TRACE("(%p %s %p) version=%d\n", pOuter
, debugstr_guid(riid
), ppv
, version
);
1124 ret
= heap_alloc_zero(sizeof(WebBrowser
));
1126 ret
->lpWebBrowser2Vtbl
= &WebBrowser2Vtbl
;
1127 ret
->lpServiceProviderVtbl
= &ServiceProviderVtbl
;
1129 ret
->version
= version
;
1131 DocHost_Init(&ret
->doc_host
, (IDispatch
*)WEBBROWSER2(ret
));
1133 ret
->visible
= VARIANT_TRUE
;
1134 ret
->menu_bar
= VARIANT_TRUE
;
1135 ret
->address_bar
= VARIANT_TRUE
;
1136 ret
->status_bar
= VARIANT_TRUE
;
1137 ret
->tool_bar
= VARIANT_TRUE
;
1139 WebBrowser_OleObject_Init(ret
);
1140 WebBrowser_ViewObject_Init(ret
);
1141 WebBrowser_DataObject_Init(ret
);
1142 WebBrowser_Persist_Init(ret
);
1143 WebBrowser_ClassInfo_Init(ret
);
1144 WebBrowser_HlinkFrame_Init(ret
);
1146 SHDOCVW_LockModule();
1148 hres
= IWebBrowser_QueryInterface(WEBBROWSER(ret
), riid
, ppv
);
1150 IWebBrowser2_Release(WEBBROWSER(ret
));
1154 HRESULT
WebBrowserV1_Create(IUnknown
*pOuter
, REFIID riid
, void **ppv
)
1156 return WebBrowser_Create(1, pOuter
, riid
, ppv
);
1159 HRESULT
WebBrowserV2_Create(IUnknown
*pOuter
, REFIID riid
, void **ppv
)
1161 return WebBrowser_Create(2, pOuter
, riid
, ppv
);