mfplat: Read queue subscriber within the critical section.
[wine/zf.git] / dlls / ieframe / webbrowser.c
blob87b74b8e01f48112641b11f6050cdc98962d8889
1 /*
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 "ieframe.h"
24 #include "exdispid.h"
25 #include "mshtml.h"
27 #include "wine/debug.h"
29 WINE_DEFAULT_DEBUG_CHANNEL(ieframe);
31 static inline WebBrowser *impl_from_IUnknown(IUnknown *iface)
33 return CONTAINING_RECORD(iface, WebBrowser, IUnknown_inner);
36 static HRESULT WINAPI WebBrowser_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
38 WebBrowser *This = impl_from_IUnknown(iface);
40 if (ppv == NULL)
41 return E_POINTER;
42 *ppv = NULL;
44 if(IsEqualGUID(&IID_IUnknown, riid)) {
45 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
46 *ppv = &This->IUnknown_inner;
47 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
48 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
49 *ppv = &This->IWebBrowser2_iface;
50 }else if(IsEqualGUID(&IID_IWebBrowser, riid)) {
51 TRACE("(%p)->(IID_IWebBrowser %p)\n", This, ppv);
52 *ppv = &This->IWebBrowser2_iface;
53 }else if(IsEqualGUID(&IID_IWebBrowserApp, riid)) {
54 TRACE("(%p)->(IID_IWebBrowserApp %p)\n", This, ppv);
55 *ppv = &This->IWebBrowser2_iface;
56 }else if(IsEqualGUID(&IID_IWebBrowser2, riid)) {
57 TRACE("(%p)->(IID_IWebBrowser2 %p)\n", This, ppv);
58 *ppv = &This->IWebBrowser2_iface;
59 }else if(IsEqualGUID(&IID_IOleObject, riid)) {
60 TRACE("(%p)->(IID_IOleObject %p)\n", This, ppv);
61 *ppv = &This->IOleObject_iface;
62 }else if(IsEqualGUID(&IID_IOleWindow, riid)) {
63 TRACE("(%p)->(IID_IOleWindow %p)\n", This, ppv);
64 *ppv = &This->IOleInPlaceObject_iface;
65 }else if(IsEqualGUID (&IID_IOleInPlaceObject, riid)) {
66 TRACE("(%p)->(IID_IOleInPlaceObject %p)\n", This, ppv);
67 *ppv = &This->IOleInPlaceObject_iface;
68 }else if(IsEqualGUID(&IID_IOleControl, riid)) {
69 TRACE("(%p)->(IID_IOleControl %p)\n", This, ppv);
70 *ppv = &This->IOleControl_iface;
71 }else if(IsEqualGUID(&IID_IPersist, riid)) {
72 TRACE("(%p)->(IID_IPersist %p)\n", This, ppv);
73 *ppv = &This->IPersistStorage_iface;
74 }else if(IsEqualGUID(&IID_IPersistStorage, riid)) {
75 TRACE("(%p)->(IID_IPersistStorage %p)\n", This, ppv);
76 *ppv = &This->IPersistStorage_iface;
77 }else if(IsEqualGUID(&IID_IPersistMemory, riid)) {
78 TRACE("(%p)->(IID_IPersistStorage %p)\n", This, ppv);
79 *ppv = &This->IPersistMemory_iface;
80 }else if(IsEqualGUID (&IID_IPersistStreamInit, riid)) {
81 TRACE("(%p)->(IID_IPersistStreamInit %p)\n", This, ppv);
82 *ppv = &This->IPersistStreamInit_iface;
83 }else if(IsEqualGUID(&IID_IProvideClassInfo, riid)) {
84 TRACE("(%p)->(IID_IProvideClassInfo %p)\n", This, ppv);
85 *ppv = &This->IProvideClassInfo2_iface;
86 }else if(IsEqualGUID(&IID_IProvideClassInfo2, riid)) {
87 TRACE("(%p)->(IID_IProvideClassInfo2 %p)\n", This, ppv);
88 *ppv = &This->IProvideClassInfo2_iface;
89 }else if(IsEqualGUID(&IID_IConnectionPointContainer, riid)) {
90 TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This, ppv);
91 *ppv = &This->doc_host.cps.IConnectionPointContainer_iface;
92 }else if(IsEqualGUID(&IID_IViewObject, riid)) {
93 TRACE("(%p)->(IID_IViewObject %p)\n", This, ppv);
94 *ppv = &This->IViewObject2_iface;
95 }else if(IsEqualGUID(&IID_IViewObject2, riid)) {
96 TRACE("(%p)->(IID_IViewObject2 %p)\n", This, ppv);
97 *ppv = &This->IViewObject2_iface;
98 }else if(IsEqualGUID(&IID_IOleInPlaceActiveObject, riid)) {
99 TRACE("(%p)->(IID_IOleInPlaceActiveObject %p)\n", This, ppv);
100 *ppv = &This->IOleInPlaceActiveObject_iface;
101 }else if(IsEqualGUID(&IID_IOleCommandTarget, riid)) {
102 TRACE("(%p)->(IID_IOleCommandTarget %p)\n", This, ppv);
103 *ppv = &This->IOleCommandTarget_iface;
104 }else if(IsEqualGUID(&IID_IServiceProvider, riid)) {
105 *ppv = &This->IServiceProvider_iface;
106 TRACE("(%p)->(IID_IServiceProvider %p)\n", This, ppv);
107 }else if(IsEqualGUID(&IID_IDataObject, riid)) {
108 *ppv = &This->IDataObject_iface;
109 TRACE("(%p)->(IID_IDataObject %p)\n", This, ppv);
110 }else if(IsEqualGUID(&IID_IQuickActivate, riid)) {
111 TRACE("(%p)->(IID_IQuickActivate %p) returning NULL\n", This, ppv);
112 return E_NOINTERFACE;
113 }else if(IsEqualGUID(&IID_IRunnableObject, riid)) {
114 TRACE("(%p)->(IID_IRunnableObject %p) returning NULL\n", This, ppv);
115 return E_NOINTERFACE;
116 }else if(IsEqualGUID(&IID_IPerPropertyBrowsing, riid)) {
117 TRACE("(%p)->(IID_IPerPropertyBrowsing %p) returning NULL\n", This, ppv);
118 return E_NOINTERFACE;
119 }else if(IsEqualGUID(&IID_IOleCache, riid)) {
120 TRACE("(%p)->(IID_IOleCache %p) returning NULL\n", This, ppv);
121 return E_NOINTERFACE;
122 }else if(IsEqualGUID(&IID_IOleInPlaceSite, riid)) {
123 TRACE("(%p)->(IID_IOleInPlaceSite %p) returning NULL\n", This, ppv);
124 return E_NOINTERFACE;
125 }else if(IsEqualGUID(&IID_IObjectWithSite, riid)) {
126 TRACE("(%p)->(IID_IObjectWithSite %p) returning NULL\n", This, ppv);
127 return E_NOINTERFACE;
128 }else if(IsEqualGUID(&IID_IViewObjectEx, riid)) {
129 TRACE("(%p)->(IID_IViewObjectEx %p) returning NULL\n", This, ppv);
130 return E_NOINTERFACE;
131 }else if(IsEqualGUID(&IID_IOleLink, riid)) {
132 TRACE("(%p)->(IID_IOleLink %p) returning NULL\n", This, ppv);
133 return E_NOINTERFACE;
134 }else if(IsEqualGUID(&IID_IMarshal, riid)) {
135 TRACE("(%p)->(IID_IMarshal %p) returning NULL\n", This, ppv);
136 return E_NOINTERFACE;
137 }else if(IsEqualGUID(&IID_IStdMarshalInfo, riid)) {
138 /* This is implemented since IE10 */
139 WARN("(%p)->(IID_IStdMarshalInfo %p) returning NULL\n", This, ppv);
140 return E_NOINTERFACE;
141 }else if(HlinkFrame_QI(&This->hlink_frame, riid, ppv)) {
142 return S_OK;
145 if(*ppv) {
146 IUnknown_AddRef((IUnknown*)*ppv);
147 return S_OK;
150 FIXME("(%p)->(%s %p) interface not supported\n", This, debugstr_guid(riid), ppv);
151 return E_NOINTERFACE;
154 static ULONG WINAPI WebBrowser_AddRef(IUnknown *iface)
156 WebBrowser *This = impl_from_IUnknown(iface);
157 LONG ref = InterlockedIncrement(&This->ref);
158 TRACE("(%p) ref=%d\n", This, ref);
159 return ref;
162 static ULONG WINAPI WebBrowser_Release(IUnknown *iface)
164 WebBrowser *This = impl_from_IUnknown(iface);
165 LONG ref = InterlockedDecrement(&This->ref);
167 TRACE("(%p) ref=%d\n", This, ref);
169 if(!ref) {
170 if(This->sink)
171 IAdviseSink_Release(This->sink);
173 if(This->advise_holder)
174 IOleAdviseHolder_Release(This->advise_holder);
176 if(This->doc_host.document)
177 IUnknown_Release(This->doc_host.document);
179 DocHost_Release(&This->doc_host);
181 WebBrowser_OleObject_Destroy(This);
183 heap_free(This);
184 unlock_module();
187 return ref;
190 static const struct IUnknownVtbl internal_unk_vtbl =
192 WebBrowser_QueryInterface,
193 WebBrowser_AddRef,
194 WebBrowser_Release
197 static inline WebBrowser *impl_from_IWebBrowser2(IWebBrowser2 *iface)
199 return CONTAINING_RECORD(iface, WebBrowser, IWebBrowser2_iface);
202 static HRESULT WINAPI WebBrowser2_QueryInterface(IWebBrowser2 *iface, REFIID riid, LPVOID *ppv)
204 WebBrowser *This = impl_from_IWebBrowser2(iface);
206 return IUnknown_QueryInterface(This->hlink_frame.outer, riid, ppv);
209 static ULONG WINAPI WebBrowser2_AddRef(IWebBrowser2 *iface)
211 WebBrowser *This = impl_from_IWebBrowser2(iface);
213 return IUnknown_AddRef(This->hlink_frame.outer);
216 static ULONG WINAPI WebBrowser2_Release(IWebBrowser2 *iface)
218 WebBrowser *This = impl_from_IWebBrowser2(iface);
220 return IUnknown_Release(This->hlink_frame.outer);
223 /* IDispatch methods */
224 static HRESULT WINAPI WebBrowser_GetTypeInfoCount(IWebBrowser2 *iface, UINT *pctinfo)
226 WebBrowser *This = impl_from_IWebBrowser2(iface);
228 TRACE("(%p)->(%p)\n", This, pctinfo);
230 *pctinfo = 1;
231 return S_OK;
234 static HRESULT WINAPI WebBrowser_GetTypeInfo(IWebBrowser2 *iface, UINT iTInfo, LCID lcid,
235 LPTYPEINFO *ppTInfo)
237 WebBrowser *This = impl_from_IWebBrowser2(iface);
238 ITypeInfo *typeinfo;
239 HRESULT hres;
241 TRACE("(%p)->(%d %d %p)\n", This, iTInfo, lcid, ppTInfo);
243 hres = get_typeinfo(IWebBrowser2_tid, &typeinfo);
244 if(FAILED(hres))
245 return hres;
247 ITypeInfo_AddRef(typeinfo);
248 *ppTInfo = typeinfo;
249 return S_OK;
252 static HRESULT WINAPI WebBrowser_GetIDsOfNames(IWebBrowser2 *iface, REFIID riid,
253 LPOLESTR *rgszNames, UINT cNames,
254 LCID lcid, DISPID *rgDispId)
256 WebBrowser *This = impl_from_IWebBrowser2(iface);
257 ITypeInfo *typeinfo;
258 HRESULT hres;
260 TRACE("(%p)->(%s %p %d %d %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
261 lcid, rgDispId);
263 hres = get_typeinfo(IWebBrowser2_tid, &typeinfo);
264 if(FAILED(hres))
265 return hres;
267 return ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
270 static HRESULT WINAPI WebBrowser_Invoke(IWebBrowser2 *iface, DISPID dispIdMember,
271 REFIID riid, LCID lcid, WORD wFlags,
272 DISPPARAMS *pDispParams, VARIANT *pVarResult,
273 EXCEPINFO *pExepInfo, UINT *puArgErr)
275 WebBrowser *This = impl_from_IWebBrowser2(iface);
276 ITypeInfo *typeinfo;
277 HRESULT hres;
279 TRACE("(%p)->(%d %s %d %08x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
280 lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
282 hres = get_typeinfo(IWebBrowser2_tid, &typeinfo);
283 if(FAILED(hres))
284 return hres;
286 return ITypeInfo_Invoke(typeinfo, &This->IWebBrowser2_iface, dispIdMember, wFlags, pDispParams,
287 pVarResult, pExepInfo, puArgErr);
290 /* IWebBrowser methods */
291 static HRESULT WINAPI WebBrowser_GoBack(IWebBrowser2 *iface)
293 WebBrowser *This = impl_from_IWebBrowser2(iface);
294 TRACE("(%p)\n", This);
295 return go_back(&This->doc_host);
298 static HRESULT WINAPI WebBrowser_GoForward(IWebBrowser2 *iface)
300 WebBrowser *This = impl_from_IWebBrowser2(iface);
301 TRACE("(%p)\n", This);
302 return go_forward(&This->doc_host);
305 static HRESULT WINAPI WebBrowser_GoHome(IWebBrowser2 *iface)
307 WebBrowser *This = impl_from_IWebBrowser2(iface);
308 TRACE("(%p)\n", This);
309 return go_home(&This->doc_host);
312 static HRESULT WINAPI WebBrowser_GoSearch(IWebBrowser2 *iface)
314 WebBrowser *This = impl_from_IWebBrowser2(iface);
315 FIXME("(%p)\n", This);
316 return E_NOTIMPL;
319 static HRESULT WINAPI WebBrowser_Navigate(IWebBrowser2 *iface, BSTR szUrl,
320 VARIANT *Flags, VARIANT *TargetFrameName,
321 VARIANT *PostData, VARIANT *Headers)
323 WebBrowser *This = impl_from_IWebBrowser2(iface);
325 TRACE("(%p)->(%s %s %s %s %s)\n", This, debugstr_w(szUrl), debugstr_variant(Flags),
326 debugstr_variant(TargetFrameName), debugstr_variant(PostData),
327 debugstr_variant(Headers));
329 return navigate_url(&This->doc_host, szUrl, Flags, TargetFrameName, PostData, Headers);
332 static HRESULT WINAPI WebBrowser_Refresh(IWebBrowser2 *iface)
334 WebBrowser *This = impl_from_IWebBrowser2(iface);
336 TRACE("(%p)\n", This);
338 return refresh_document(&This->doc_host, NULL);
341 static HRESULT WINAPI WebBrowser_Refresh2(IWebBrowser2 *iface, VARIANT *Level)
343 WebBrowser *This = impl_from_IWebBrowser2(iface);
345 TRACE("(%p)->(%s)\n", This, debugstr_variant(Level));
347 return refresh_document(&This->doc_host, Level);
350 static HRESULT WINAPI WebBrowser_Stop(IWebBrowser2 *iface)
352 WebBrowser *This = impl_from_IWebBrowser2(iface);
353 FIXME("(%p)\n", This);
354 return S_OK;
357 static HRESULT WINAPI WebBrowser_get_Application(IWebBrowser2 *iface, IDispatch **ppDisp)
359 WebBrowser *This = impl_from_IWebBrowser2(iface);
361 TRACE("(%p)->(%p)\n", This, ppDisp);
363 if(!ppDisp)
364 return E_POINTER;
366 *ppDisp = (IDispatch*)&This->IWebBrowser2_iface;
367 IDispatch_AddRef(*ppDisp);
368 return S_OK;
371 static HRESULT WINAPI WebBrowser_get_Parent(IWebBrowser2 *iface, IDispatch **ppDisp)
373 WebBrowser *This = impl_from_IWebBrowser2(iface);
374 FIXME("(%p)->(%p)\n", This, ppDisp);
375 return E_NOTIMPL;
378 static HRESULT WINAPI WebBrowser_get_Container(IWebBrowser2 *iface, IDispatch **ppDisp)
380 WebBrowser *This = impl_from_IWebBrowser2(iface);
381 FIXME("(%p)->(%p)\n", This, ppDisp);
382 return E_NOTIMPL;
385 static HRESULT WINAPI WebBrowser_get_Document(IWebBrowser2 *iface, IDispatch **ppDisp)
387 WebBrowser *This = impl_from_IWebBrowser2(iface);
388 IDispatch *disp = NULL;
390 TRACE("(%p)->(%p)\n", This, ppDisp);
392 if(This->doc_host.document) {
393 HRESULT hres;
395 hres = IUnknown_QueryInterface(This->doc_host.document, &IID_IDispatch, (void**)&disp);
396 if(SUCCEEDED(hres)) {
397 IDispatch *html_doc;
399 /* Some broken apps cast returned IDispatch to IHTMLDocument2
400 * without QueryInterface call */
401 hres = IDispatch_QueryInterface(disp, &IID_IHTMLDocument2, (void**)&html_doc);
402 if(SUCCEEDED(hres)) {
403 IDispatch_Release(disp);
404 disp = html_doc;
409 *ppDisp = disp;
410 return disp ? S_OK : S_FALSE;
413 static HRESULT WINAPI WebBrowser_get_TopLevelContainer(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
415 WebBrowser *This = impl_from_IWebBrowser2(iface);
416 FIXME("(%p)->(%p)\n", This, pBool);
417 return E_NOTIMPL;
420 static HRESULT WINAPI WebBrowser_get_Type(IWebBrowser2 *iface, BSTR *Type)
422 WebBrowser *This = impl_from_IWebBrowser2(iface);
423 FIXME("(%p)->(%p)\n", This, Type);
424 return E_NOTIMPL;
427 static HRESULT WINAPI WebBrowser_get_Left(IWebBrowser2 *iface, LONG *pl)
429 WebBrowser *This = impl_from_IWebBrowser2(iface);
431 TRACE("(%p)->(%p)\n", This, pl);
433 *pl = This->pos_rect.left;
434 return S_OK;
437 static HRESULT WINAPI WebBrowser_put_Left(IWebBrowser2 *iface, LONG Left)
439 WebBrowser *This = impl_from_IWebBrowser2(iface);
440 RECT rect;
442 TRACE("(%p)->(%d)\n", This, Left);
444 if(!This->inplace)
445 return E_UNEXPECTED;
447 rect = This->pos_rect;
448 rect.left = Left;
450 /* We don't really change the window position here.
451 * We just notify the embedder that he should do so. */
452 return IOleInPlaceSiteEx_OnPosRectChange(This->inplace, &rect);
455 static HRESULT WINAPI WebBrowser_get_Top(IWebBrowser2 *iface, LONG *pl)
457 WebBrowser *This = impl_from_IWebBrowser2(iface);
459 TRACE("(%p)->(%p)\n", This, pl);
461 *pl = This->pos_rect.top;
462 return S_OK;
465 static HRESULT WINAPI WebBrowser_put_Top(IWebBrowser2 *iface, LONG Top)
467 WebBrowser *This = impl_from_IWebBrowser2(iface);
468 RECT rect;
470 TRACE("(%p)->(%d)\n", This, Top);
472 if(!This->inplace)
473 return E_UNEXPECTED;
475 rect = This->pos_rect;
476 rect.top = Top;
478 /* We don't really change the window position here.
479 * We just notify the embedder that he should do so. */
480 return IOleInPlaceSiteEx_OnPosRectChange(This->inplace, &rect);
483 static HRESULT WINAPI WebBrowser_get_Width(IWebBrowser2 *iface, LONG *pl)
485 WebBrowser *This = impl_from_IWebBrowser2(iface);
487 TRACE("(%p)->(%p)\n", This, pl);
489 *pl = This->pos_rect.right - This->pos_rect.left;
490 return S_OK;
493 static HRESULT WINAPI WebBrowser_put_Width(IWebBrowser2 *iface, LONG Width)
495 WebBrowser *This = impl_from_IWebBrowser2(iface);
496 RECT rect;
498 TRACE("(%p)->(%d)\n", This, Width);
500 if(!This->inplace)
501 return E_UNEXPECTED;
503 rect = This->pos_rect;
504 rect.right = rect.left+Width;
506 /* We don't really change the window size here.
507 * We just notify the embedder that he should do so. */
508 return IOleInPlaceSiteEx_OnPosRectChange(This->inplace, &rect);
511 static HRESULT WINAPI WebBrowser_get_Height(IWebBrowser2 *iface, LONG *pl)
513 WebBrowser *This = impl_from_IWebBrowser2(iface);
515 TRACE("(%p)->(%p)\n", This, pl);
517 *pl = This->pos_rect.bottom - This->pos_rect.top;
518 return S_OK;
521 static HRESULT WINAPI WebBrowser_put_Height(IWebBrowser2 *iface, LONG Height)
523 WebBrowser *This = impl_from_IWebBrowser2(iface);
524 RECT rect;
526 TRACE("(%p)->(%d)\n", This, Height);
528 if(!This->inplace)
529 return E_UNEXPECTED;
531 rect = This->pos_rect;
532 rect.bottom = rect.top+Height;
534 /* We don't really change the window size here.
535 * We just notify the embedder that he should do so. */
536 return IOleInPlaceSiteEx_OnPosRectChange(This->inplace, &rect);
539 static HRESULT WINAPI WebBrowser_get_LocationName(IWebBrowser2 *iface, BSTR *LocationName)
541 WebBrowser *This = impl_from_IWebBrowser2(iface);
542 FIXME("(%p)->(%p)\n", This, LocationName);
543 return E_NOTIMPL;
546 static HRESULT WINAPI WebBrowser_get_LocationURL(IWebBrowser2 *iface, BSTR *LocationURL)
548 WebBrowser *This = impl_from_IWebBrowser2(iface);
550 TRACE("(%p)->(%p)\n", This, LocationURL);
552 return get_location_url(&This->doc_host, LocationURL);
555 static HRESULT WINAPI WebBrowser_get_Busy(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
557 WebBrowser *This = impl_from_IWebBrowser2(iface);
559 TRACE("(%p)->(%p)\n", This, pBool);
561 *pBool = This->doc_host.busy;
562 return S_OK;
565 static HRESULT WINAPI WebBrowser_Quit(IWebBrowser2 *iface)
567 WebBrowser *This = impl_from_IWebBrowser2(iface);
569 TRACE("(%p)\n", This);
571 /* It's a InternetExplorer specific method, we have nothing to do here. */
572 return E_FAIL;
575 static HRESULT WINAPI WebBrowser_ClientToWindow(IWebBrowser2 *iface, int *pcx, int *pcy)
577 WebBrowser *This = impl_from_IWebBrowser2(iface);
578 FIXME("(%p)->(%p %p)\n", This, pcx, pcy);
579 return E_NOTIMPL;
582 static HRESULT WINAPI WebBrowser_PutProperty(IWebBrowser2 *iface, BSTR szProperty, VARIANT vtValue)
584 WebBrowser *This = impl_from_IWebBrowser2(iface);
585 FIXME("(%p)->(%s %s)\n", This, debugstr_w(szProperty), debugstr_variant(&vtValue));
586 return E_NOTIMPL;
589 static HRESULT WINAPI WebBrowser_GetProperty(IWebBrowser2 *iface, BSTR szProperty, VARIANT *pvtValue)
591 WebBrowser *This = impl_from_IWebBrowser2(iface);
592 FIXME("(%p)->(%s %s)\n", This, debugstr_w(szProperty), debugstr_variant(pvtValue));
593 return E_NOTIMPL;
596 static HRESULT WINAPI WebBrowser_get_Name(IWebBrowser2 *iface, BSTR *Name)
598 static const WCHAR sName[] = {'M','i','c','r','o','s','o','f','t',' ','W','e','b',
599 ' ','B','r','o','w','s','e','r',' ','C','o','n','t','r','o','l',0};
600 WebBrowser *This = impl_from_IWebBrowser2(iface);
602 TRACE("(%p)->(%p)\n", This, Name);
604 *Name = SysAllocString(sName);
606 return S_OK;
609 static HRESULT WINAPI WebBrowser_get_HWND(IWebBrowser2 *iface, SHANDLE_PTR *pHWND)
611 WebBrowser *This = impl_from_IWebBrowser2(iface);
613 TRACE("(%p)->(%p)\n", This, pHWND);
615 /* WebBrowser control never has a frame window (in opposition to InternetExplorer) */
616 *pHWND = 0;
617 return E_FAIL;
620 static HRESULT WINAPI WebBrowser_get_FullName(IWebBrowser2 *iface, BSTR *FullName)
622 WebBrowser *This = impl_from_IWebBrowser2(iface);
623 FIXME("(%p)->(%p)\n", This, FullName);
624 return E_NOTIMPL;
627 static HRESULT WINAPI WebBrowser_get_Path(IWebBrowser2 *iface, BSTR *Path)
629 WebBrowser *This = impl_from_IWebBrowser2(iface);
630 FIXME("(%p)->(%p)\n", This, Path);
631 return E_NOTIMPL;
634 static HRESULT WINAPI WebBrowser_get_Visible(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
636 WebBrowser *This = impl_from_IWebBrowser2(iface);
638 TRACE("(%p)->(%p)\n", This, pBool);
640 *pBool = This->visible;
641 return S_OK;
644 static HRESULT WINAPI WebBrowser_put_Visible(IWebBrowser2 *iface, VARIANT_BOOL Value)
646 WebBrowser *This = impl_from_IWebBrowser2(iface);
647 VARIANTARG arg;
648 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
650 TRACE("(%p)->(%x)\n", This, Value);
652 This->visible = Value;
654 V_VT(&arg) = VT_BOOL;
655 V_BOOL(&arg) = Value;
656 call_sink(This->doc_host.cps.wbe2, DISPID_ONVISIBLE, &dispparams);
658 return S_OK;
661 static HRESULT WINAPI WebBrowser_get_StatusBar(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
663 WebBrowser *This = impl_from_IWebBrowser2(iface);
665 TRACE("(%p)->(%p)\n", This, pBool);
667 *pBool = This->status_bar;
668 return S_OK;
671 static HRESULT WINAPI WebBrowser_put_StatusBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
673 WebBrowser *This = impl_from_IWebBrowser2(iface);
674 VARIANTARG arg;
675 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
677 TRACE("(%p)->(%x)\n", This, Value);
679 This->status_bar = Value ? VARIANT_TRUE : VARIANT_FALSE;
681 /* In opposition to InternetExplorer, all we should do here is
682 * inform the embedder about the status bar change. */
684 V_VT(&arg) = VT_BOOL;
685 V_BOOL(&arg) = Value;
686 call_sink(This->doc_host.cps.wbe2, DISPID_ONSTATUSBAR, &dispparams);
688 return S_OK;
691 static HRESULT WINAPI WebBrowser_get_StatusText(IWebBrowser2 *iface, BSTR *StatusText)
693 WebBrowser *This = impl_from_IWebBrowser2(iface);
694 FIXME("(%p)->(%p)\n", This, StatusText);
695 return E_NOTIMPL;
698 static HRESULT WINAPI WebBrowser_put_StatusText(IWebBrowser2 *iface, BSTR StatusText)
700 WebBrowser *This = impl_from_IWebBrowser2(iface);
701 FIXME("(%p)->(%s)\n", This, debugstr_w(StatusText));
702 return E_NOTIMPL;
705 static HRESULT WINAPI WebBrowser_get_ToolBar(IWebBrowser2 *iface, int *Value)
707 WebBrowser *This = impl_from_IWebBrowser2(iface);
709 TRACE("(%p)->(%p)\n", This, Value);
711 *Value = This->tool_bar;
712 return S_OK;
715 static HRESULT WINAPI WebBrowser_put_ToolBar(IWebBrowser2 *iface, int Value)
717 WebBrowser *This = impl_from_IWebBrowser2(iface);
718 VARIANTARG arg;
719 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
721 TRACE("(%p)->(%x)\n", This, Value);
723 This->tool_bar = Value ? VARIANT_TRUE : VARIANT_FALSE;
725 /* In opposition to InternetExplorer, all we should do here is
726 * inform the embedder about the tool bar change. */
728 V_VT(&arg) = VT_BOOL;
729 V_BOOL(&arg) = This->tool_bar;
730 call_sink(This->doc_host.cps.wbe2, DISPID_ONTOOLBAR, &dispparams);
732 return S_OK;
735 static HRESULT WINAPI WebBrowser_get_MenuBar(IWebBrowser2 *iface, VARIANT_BOOL *Value)
737 WebBrowser *This = impl_from_IWebBrowser2(iface);
739 TRACE("(%p)->(%p)\n", This, Value);
741 *Value = This->menu_bar;
742 return S_OK;
745 static HRESULT WINAPI WebBrowser_put_MenuBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
747 WebBrowser *This = impl_from_IWebBrowser2(iface);
748 VARIANTARG arg;
749 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
751 TRACE("(%p)->(%x)\n", This, Value);
753 This->menu_bar = Value ? VARIANT_TRUE : VARIANT_FALSE;
755 /* In opposition to InternetExplorer, all we should do here is
756 * inform the embedder about the menu bar change. */
758 V_VT(&arg) = VT_BOOL;
759 V_BOOL(&arg) = Value;
760 call_sink(This->doc_host.cps.wbe2, DISPID_ONMENUBAR, &dispparams);
762 return S_OK;
765 static HRESULT WINAPI WebBrowser_get_FullScreen(IWebBrowser2 *iface, VARIANT_BOOL *pbFullScreen)
767 WebBrowser *This = impl_from_IWebBrowser2(iface);
769 TRACE("(%p)->(%p)\n", This, pbFullScreen);
771 *pbFullScreen = This->full_screen;
772 return S_OK;
775 static HRESULT WINAPI WebBrowser_put_FullScreen(IWebBrowser2 *iface, VARIANT_BOOL bFullScreen)
777 WebBrowser *This = impl_from_IWebBrowser2(iface);
778 VARIANTARG arg;
779 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
781 /* In opposition to InternetExplorer, all we should do here is
782 * inform the embedder about the fullscreen change. */
784 TRACE("(%p)->(%x)\n", This, bFullScreen);
786 This->full_screen = bFullScreen ? VARIANT_TRUE : VARIANT_FALSE;
788 V_VT(&arg) = VT_BOOL;
789 V_BOOL(&arg) = bFullScreen;
790 call_sink(This->doc_host.cps.wbe2, DISPID_ONFULLSCREEN, &dispparams);
792 return S_OK;
795 static HRESULT WINAPI WebBrowser_Navigate2(IWebBrowser2 *iface, VARIANT *URL, VARIANT *Flags,
796 VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
798 WebBrowser *This = impl_from_IWebBrowser2(iface);
799 LPCWSTR url;
801 TRACE("(%p)->(%s %s %s %s %s)\n", This, debugstr_variant(URL), debugstr_variant(Flags),
802 debugstr_variant(TargetFrameName), debugstr_variant(PostData), debugstr_variant(Headers));
804 if(!This->client)
805 return E_FAIL;
807 if(!URL)
808 return S_OK;
810 switch (V_VT(URL))
812 case VT_BSTR:
813 url = V_BSTR(URL);
814 break;
815 case VT_BSTR|VT_BYREF:
816 url = *V_BSTRREF(URL);
817 break;
818 default:
819 FIXME("Unsupported V_VT(URL) %d\n", V_VT(URL));
820 return E_INVALIDARG;
823 return navigate_url(&This->doc_host, url, Flags, TargetFrameName, PostData, Headers);
826 static HRESULT WINAPI WebBrowser_QueryStatusWB(IWebBrowser2 *iface, OLECMDID cmdID, OLECMDF *pcmdf)
828 WebBrowser *This = impl_from_IWebBrowser2(iface);
829 IOleCommandTarget *target = NULL;
830 OLECMD ole_command[1];
831 HRESULT hres;
833 TRACE("(%p)->(%d %p)\n", This, cmdID, pcmdf);
835 if (!pcmdf)
836 return E_POINTER;
837 ole_command[0].cmdID = cmdID;
838 ole_command[0].cmdf = *pcmdf;
840 if (This->container)
842 hres = IOleContainer_QueryInterface(This->container, &IID_IOleCommandTarget, (LPVOID*)&target);
843 if(FAILED(hres))
844 target = NULL;
846 if (!target && This->doc_host.document)
848 hres = IUnknown_QueryInterface(This->doc_host.document, &IID_IOleCommandTarget, (LPVOID*)&target);
849 if(FAILED(hres))
850 target = NULL;
853 if (!target)
854 return E_UNEXPECTED;
856 hres = IOleCommandTarget_QueryStatus(target, NULL, 1, ole_command, NULL);
857 if (SUCCEEDED(hres))
858 *pcmdf = ole_command[0].cmdf;
859 if (hres == OLECMDERR_E_NOTSUPPORTED)
861 *pcmdf = 0;
862 hres = S_OK;
864 IOleCommandTarget_Release(target);
866 return hres;
869 static HRESULT WINAPI WebBrowser_ExecWB(IWebBrowser2 *iface, OLECMDID cmdID,
870 OLECMDEXECOPT cmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
872 WebBrowser *This = impl_from_IWebBrowser2(iface);
873 IOleCommandTarget *target = NULL;
874 HRESULT hres;
876 TRACE("(%p)->(%d %d %s %p)\n", This, cmdID, cmdexecopt, debugstr_variant(pvaIn), pvaOut);
878 if(This->container)
880 hres = IOleContainer_QueryInterface(This->container, &IID_IOleCommandTarget, (LPVOID*)&target);
881 if(FAILED(hres))
882 target = NULL;
884 if(!target && This->doc_host.document)
886 hres = IUnknown_QueryInterface(This->doc_host.document, &IID_IOleCommandTarget, (LPVOID*)&target);
887 if(FAILED(hres))
888 target = NULL;
891 if(!target)
892 return E_UNEXPECTED;
894 hres = IOleCommandTarget_Exec(target, NULL, cmdID, cmdexecopt, pvaIn, pvaOut);
895 IOleCommandTarget_Release(target);
897 return hres;
900 static HRESULT WINAPI WebBrowser_ShowBrowserBar(IWebBrowser2 *iface, VARIANT *pvaClsid,
901 VARIANT *pvarShow, VARIANT *pvarSize)
903 WebBrowser *This = impl_from_IWebBrowser2(iface);
904 FIXME("(%p)->(%s %s %s)\n", This, debugstr_variant(pvaClsid), debugstr_variant(pvarShow),
905 debugstr_variant(pvarSize));
906 return E_NOTIMPL;
909 static HRESULT WINAPI WebBrowser_get_ReadyState(IWebBrowser2 *iface, READYSTATE *lpReadyState)
911 WebBrowser *This = impl_from_IWebBrowser2(iface);
913 TRACE("(%p)->(%p)\n", This, lpReadyState);
915 *lpReadyState = This->doc_host.ready_state;
916 return S_OK;
919 static HRESULT WINAPI WebBrowser_get_Offline(IWebBrowser2 *iface, VARIANT_BOOL *pbOffline)
921 WebBrowser *This = impl_from_IWebBrowser2(iface);
923 TRACE("(%p)->(%p)\n", This, pbOffline);
925 *pbOffline = This->doc_host.offline;
926 return S_OK;
929 static HRESULT WINAPI WebBrowser_put_Offline(IWebBrowser2 *iface, VARIANT_BOOL bOffline)
931 WebBrowser *This = impl_from_IWebBrowser2(iface);
933 TRACE("(%p)->(%x)\n", This, bOffline);
935 This->doc_host.offline = bOffline ? VARIANT_TRUE : VARIANT_FALSE;
936 return S_OK;
939 static HRESULT WINAPI WebBrowser_get_Silent(IWebBrowser2 *iface, VARIANT_BOOL *pbSilent)
941 WebBrowser *This = impl_from_IWebBrowser2(iface);
943 TRACE("(%p)->(%p)\n", This, pbSilent);
945 *pbSilent = This->doc_host.silent;
946 return S_OK;
949 static HRESULT WINAPI WebBrowser_put_Silent(IWebBrowser2 *iface, VARIANT_BOOL bSilent)
951 WebBrowser *This = impl_from_IWebBrowser2(iface);
953 TRACE("(%p)->(%x)\n", This, bSilent);
955 This->doc_host.silent = bSilent ? VARIANT_TRUE : VARIANT_FALSE;
956 return S_OK;
959 static HRESULT WINAPI WebBrowser_get_RegisterAsBrowser(IWebBrowser2 *iface,
960 VARIANT_BOOL *pbRegister)
962 WebBrowser *This = impl_from_IWebBrowser2(iface);
964 FIXME("(%p)->(%p)\n", This, pbRegister);
966 *pbRegister = This->register_browser;
967 return S_OK;
970 static HRESULT WINAPI WebBrowser_put_RegisterAsBrowser(IWebBrowser2 *iface,
971 VARIANT_BOOL bRegister)
973 WebBrowser *This = impl_from_IWebBrowser2(iface);
975 FIXME("(%p)->(%x)\n", This, bRegister);
977 This->register_browser = bRegister ? VARIANT_TRUE : VARIANT_FALSE;
978 return S_OK;
981 static HRESULT WINAPI WebBrowser_get_RegisterAsDropTarget(IWebBrowser2 *iface,
982 VARIANT_BOOL *pbRegister)
984 WebBrowser *This = impl_from_IWebBrowser2(iface);
986 FIXME("(%p)->(%p)\n", This, pbRegister);
988 if(!pbRegister)
989 return E_INVALIDARG;
991 *pbRegister=0;
992 return S_OK;
995 static HRESULT WINAPI WebBrowser_put_RegisterAsDropTarget(IWebBrowser2 *iface,
996 VARIANT_BOOL bRegister)
998 WebBrowser *This = impl_from_IWebBrowser2(iface);
999 FIXME("(%p)->(%x)\n", This, bRegister);
1000 return S_OK;
1003 static HRESULT WINAPI WebBrowser_get_TheaterMode(IWebBrowser2 *iface, VARIANT_BOOL *pbRegister)
1005 WebBrowser *This = impl_from_IWebBrowser2(iface);
1007 TRACE("(%p)->(%p)\n", This, pbRegister);
1009 *pbRegister = This->theater_mode;
1010 return S_OK;
1013 static HRESULT WINAPI WebBrowser_put_TheaterMode(IWebBrowser2 *iface, VARIANT_BOOL bRegister)
1015 WebBrowser *This = impl_from_IWebBrowser2(iface);
1016 VARIANTARG arg;
1017 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
1019 TRACE("(%p)->(%x)\n", This, bRegister);
1021 This->theater_mode = bRegister ? VARIANT_TRUE : VARIANT_FALSE;
1023 /* In opposition to InternetExplorer, all we should do here is
1024 * inform the embedder about the theater mode change. */
1026 V_VT(&arg) = VT_BOOL;
1027 V_BOOL(&arg) = bRegister;
1028 call_sink(This->doc_host.cps.wbe2, DISPID_ONTHEATERMODE, &dispparams);
1030 return S_OK;
1033 static HRESULT WINAPI WebBrowser_get_AddressBar(IWebBrowser2 *iface, VARIANT_BOOL *Value)
1035 WebBrowser *This = impl_from_IWebBrowser2(iface);
1037 TRACE("(%p)->(%p)\n", This, Value);
1039 *Value = This->address_bar;
1040 return S_OK;
1043 static HRESULT WINAPI WebBrowser_put_AddressBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
1045 WebBrowser *This = impl_from_IWebBrowser2(iface);
1046 VARIANTARG arg;
1047 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
1049 TRACE("(%p)->(%x)\n", This, Value);
1051 This->address_bar = Value ? VARIANT_TRUE : VARIANT_FALSE;
1053 /* In opposition to InternetExplorer, all we should do here is
1054 * inform the embedder about the address bar change. */
1056 V_VT(&arg) = VT_BOOL;
1057 V_BOOL(&arg) = Value;
1058 call_sink(This->doc_host.cps.wbe2, DISPID_ONADDRESSBAR, &dispparams);
1060 return S_OK;
1063 static HRESULT WINAPI WebBrowser_get_Resizable(IWebBrowser2 *iface, VARIANT_BOOL *Value)
1065 WebBrowser *This = impl_from_IWebBrowser2(iface);
1067 TRACE("(%p)->(%p)\n", This, Value);
1069 /* It's InternetExplorer object's method. We have nothing to do here. */
1070 return E_NOTIMPL;
1073 static HRESULT WINAPI WebBrowser_put_Resizable(IWebBrowser2 *iface, VARIANT_BOOL Value)
1075 WebBrowser *This = impl_from_IWebBrowser2(iface);
1076 VARIANTARG arg;
1077 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
1079 TRACE("(%p)->(%x)\n", This, Value);
1081 /* In opposition to InternetExplorer, all we should do here is
1082 * inform the embedder about the resizable change. */
1084 V_VT(&arg) = VT_BOOL;
1085 V_BOOL(&arg) = Value;
1086 call_sink(This->doc_host.cps.wbe2, DISPID_WINDOWSETRESIZABLE, &dispparams);
1088 return S_OK;
1091 static const IWebBrowser2Vtbl WebBrowser2Vtbl =
1093 WebBrowser2_QueryInterface,
1094 WebBrowser2_AddRef,
1095 WebBrowser2_Release,
1096 WebBrowser_GetTypeInfoCount,
1097 WebBrowser_GetTypeInfo,
1098 WebBrowser_GetIDsOfNames,
1099 WebBrowser_Invoke,
1100 WebBrowser_GoBack,
1101 WebBrowser_GoForward,
1102 WebBrowser_GoHome,
1103 WebBrowser_GoSearch,
1104 WebBrowser_Navigate,
1105 WebBrowser_Refresh,
1106 WebBrowser_Refresh2,
1107 WebBrowser_Stop,
1108 WebBrowser_get_Application,
1109 WebBrowser_get_Parent,
1110 WebBrowser_get_Container,
1111 WebBrowser_get_Document,
1112 WebBrowser_get_TopLevelContainer,
1113 WebBrowser_get_Type,
1114 WebBrowser_get_Left,
1115 WebBrowser_put_Left,
1116 WebBrowser_get_Top,
1117 WebBrowser_put_Top,
1118 WebBrowser_get_Width,
1119 WebBrowser_put_Width,
1120 WebBrowser_get_Height,
1121 WebBrowser_put_Height,
1122 WebBrowser_get_LocationName,
1123 WebBrowser_get_LocationURL,
1124 WebBrowser_get_Busy,
1125 WebBrowser_Quit,
1126 WebBrowser_ClientToWindow,
1127 WebBrowser_PutProperty,
1128 WebBrowser_GetProperty,
1129 WebBrowser_get_Name,
1130 WebBrowser_get_HWND,
1131 WebBrowser_get_FullName,
1132 WebBrowser_get_Path,
1133 WebBrowser_get_Visible,
1134 WebBrowser_put_Visible,
1135 WebBrowser_get_StatusBar,
1136 WebBrowser_put_StatusBar,
1137 WebBrowser_get_StatusText,
1138 WebBrowser_put_StatusText,
1139 WebBrowser_get_ToolBar,
1140 WebBrowser_put_ToolBar,
1141 WebBrowser_get_MenuBar,
1142 WebBrowser_put_MenuBar,
1143 WebBrowser_get_FullScreen,
1144 WebBrowser_put_FullScreen,
1145 WebBrowser_Navigate2,
1146 WebBrowser_QueryStatusWB,
1147 WebBrowser_ExecWB,
1148 WebBrowser_ShowBrowserBar,
1149 WebBrowser_get_ReadyState,
1150 WebBrowser_get_Offline,
1151 WebBrowser_put_Offline,
1152 WebBrowser_get_Silent,
1153 WebBrowser_put_Silent,
1154 WebBrowser_get_RegisterAsBrowser,
1155 WebBrowser_put_RegisterAsBrowser,
1156 WebBrowser_get_RegisterAsDropTarget,
1157 WebBrowser_put_RegisterAsDropTarget,
1158 WebBrowser_get_TheaterMode,
1159 WebBrowser_put_TheaterMode,
1160 WebBrowser_get_AddressBar,
1161 WebBrowser_put_AddressBar,
1162 WebBrowser_get_Resizable,
1163 WebBrowser_put_Resizable
1166 static inline WebBrowser *impl_from_IServiceProvider(IServiceProvider *iface)
1168 return CONTAINING_RECORD(iface, WebBrowser, IServiceProvider_iface);
1171 static HRESULT WINAPI WBServiceProvider_QueryInterface(IServiceProvider *iface,
1172 REFIID riid, LPVOID *ppv)
1174 WebBrowser *This = impl_from_IServiceProvider(iface);
1175 return IUnknown_QueryInterface(This->hlink_frame.outer, riid, ppv);
1178 static ULONG WINAPI WBServiceProvider_AddRef(IServiceProvider *iface)
1180 WebBrowser *This = impl_from_IServiceProvider(iface);
1181 return IUnknown_AddRef(This->hlink_frame.outer);
1184 static ULONG WINAPI WBServiceProvider_Release(IServiceProvider *iface)
1186 WebBrowser *This = impl_from_IServiceProvider(iface);
1187 return IUnknown_Release(This->hlink_frame.outer);
1190 static HRESULT STDMETHODCALLTYPE WBServiceProvider_QueryService(IServiceProvider *iface,
1191 REFGUID guidService, REFIID riid, void **ppv)
1193 WebBrowser *This = impl_from_IServiceProvider(iface);
1195 if(IsEqualGUID(&SID_SHTMLWindow, riid)) {
1196 TRACE("(%p)->(SID_SHTMLWindow)\n", This);
1197 return IHTMLWindow2_QueryInterface(&This->doc_host.html_window.IHTMLWindow2_iface, riid, ppv);
1200 if(IsEqualGUID(&IID_IBrowserService2, riid)) {
1201 TRACE("(%p)->(IID_IBrowserService2 return E_FAIL)\n", This);
1202 *ppv = NULL;
1203 return E_FAIL;
1206 FIXME("(%p)->(%s, %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv);
1207 *ppv = NULL;
1208 return E_NOINTERFACE;
1211 static const IServiceProviderVtbl ServiceProviderVtbl =
1213 WBServiceProvider_QueryInterface,
1214 WBServiceProvider_AddRef,
1215 WBServiceProvider_Release,
1216 WBServiceProvider_QueryService
1219 static inline WebBrowser *impl_from_DocHost(DocHost *iface)
1221 return CONTAINING_RECORD(iface, WebBrowser, doc_host);
1224 static ULONG WebBrowser_addref(DocHost *iface)
1226 WebBrowser *This = impl_from_DocHost(iface);
1227 return IUnknown_AddRef(This->hlink_frame.outer);
1230 static ULONG WebBrowser_release(DocHost *iface)
1232 WebBrowser *This = impl_from_DocHost(iface);
1233 return IUnknown_Release(This->hlink_frame.outer);
1236 static void DocHostContainer_get_docobj_rect(DocHost *This, RECT *rc)
1238 GetClientRect(This->frame_hwnd, rc);
1241 static HRESULT DocHostContainer_set_status_text(DocHost *This, const WCHAR *text)
1243 return E_NOTIMPL;
1246 static void DocHostContainer_on_command_state_change(DocHost *This, LONG command, BOOL enable)
1250 static void DocHostContainer_set_url(DocHost *This, const WCHAR *url)
1254 static const IDocHostContainerVtbl DocHostContainerVtbl = {
1255 WebBrowser_addref,
1256 WebBrowser_release,
1257 DocHostContainer_get_docobj_rect,
1258 DocHostContainer_set_status_text,
1259 DocHostContainer_on_command_state_change,
1260 DocHostContainer_set_url
1263 static HRESULT create_webbrowser(int version, IUnknown *outer, REFIID riid, void **ppv)
1265 WebBrowser *ret;
1266 HRESULT hres;
1268 TRACE("(%p %s %p) version=%d\n", outer, debugstr_guid(riid), ppv, version);
1270 if (outer && !IsEqualIID(riid, &IID_IUnknown))
1271 return CLASS_E_NOAGGREGATION;
1273 ret = heap_alloc_zero(sizeof(WebBrowser));
1275 ret->IUnknown_inner.lpVtbl = &internal_unk_vtbl;
1276 ret->IWebBrowser2_iface.lpVtbl = &WebBrowser2Vtbl;
1277 ret->IServiceProvider_iface.lpVtbl = &ServiceProviderVtbl;
1278 ret->ref = 1;
1279 ret->version = version;
1281 HlinkFrame_Init(&ret->hlink_frame, outer ? outer : &ret->IUnknown_inner, &ret->doc_host);
1282 DocHost_Init(&ret->doc_host, &ret->IWebBrowser2_iface, &DocHostContainerVtbl);
1284 ret->visible = VARIANT_TRUE;
1285 ret->menu_bar = VARIANT_TRUE;
1286 ret->address_bar = VARIANT_TRUE;
1287 ret->status_bar = VARIANT_TRUE;
1288 ret->tool_bar = VARIANT_TRUE;
1290 WebBrowser_OleObject_Init(ret);
1291 WebBrowser_ViewObject_Init(ret);
1292 WebBrowser_Persist_Init(ret);
1293 WebBrowser_ClassInfo_Init(ret);
1295 lock_module();
1297 hres = IUnknown_QueryInterface(&ret->IUnknown_inner, riid, ppv);
1299 IUnknown_Release(&ret->IUnknown_inner);
1300 return hres;
1303 HRESULT WINAPI WebBrowserV1_Create(IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **ppv)
1305 return create_webbrowser(1, pOuter, riid, ppv);
1308 HRESULT WINAPI WebBrowser_Create(IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **ppv)
1310 return create_webbrowser(2, pOuter, riid, ppv);