xref: /reactos/dll/win32/ieframe/webbrowser.c (revision fc19c80d)
1c2c66affSColin Finck /*
2c2c66affSColin Finck  * Implementation of IWebBrowser interface for WebBrowser control
3c2c66affSColin Finck  *
4c2c66affSColin Finck  * Copyright 2001 John R. Sheets (for CodeWeavers)
5c2c66affSColin Finck  * Copyright 2005 Jacek Caban
6c2c66affSColin Finck  *
7c2c66affSColin Finck  * This library is free software; you can redistribute it and/or
8c2c66affSColin Finck  * modify it under the terms of the GNU Lesser General Public
9c2c66affSColin Finck  * License as published by the Free Software Foundation; either
10c2c66affSColin Finck  * version 2.1 of the License, or (at your option) any later version.
11c2c66affSColin Finck  *
12c2c66affSColin Finck  * This library is distributed in the hope that it will be useful,
13c2c66affSColin Finck  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14c2c66affSColin Finck  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15c2c66affSColin Finck  * Lesser General Public License for more details.
16c2c66affSColin Finck  *
17c2c66affSColin Finck  * You should have received a copy of the GNU Lesser General Public
18c2c66affSColin Finck  * License along with this library; if not, write to the Free Software
19c2c66affSColin Finck  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20c2c66affSColin Finck  */
21c2c66affSColin Finck 
22c2c66affSColin Finck #include "ieframe.h"
23c2c66affSColin Finck 
24*fc19c80dSAmine Khaldi #include "exdispid.h"
25*fc19c80dSAmine Khaldi #include "mshtml.h"
26*fc19c80dSAmine Khaldi 
27*fc19c80dSAmine Khaldi #include "wine/debug.h"
28*fc19c80dSAmine Khaldi 
29*fc19c80dSAmine Khaldi WINE_DEFAULT_DEBUG_CHANNEL(ieframe);
30*fc19c80dSAmine Khaldi 
impl_from_IWebBrowser2(IWebBrowser2 * iface)31c2c66affSColin Finck static inline WebBrowser *impl_from_IWebBrowser2(IWebBrowser2 *iface)
32c2c66affSColin Finck {
33c2c66affSColin Finck     return CONTAINING_RECORD(iface, WebBrowser, IWebBrowser2_iface);
34c2c66affSColin Finck }
35c2c66affSColin Finck 
WebBrowser_QueryInterface(IWebBrowser2 * iface,REFIID riid,LPVOID * ppv)36c2c66affSColin Finck static HRESULT WINAPI WebBrowser_QueryInterface(IWebBrowser2 *iface, REFIID riid, LPVOID *ppv)
37c2c66affSColin Finck {
38c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
39c2c66affSColin Finck 
40c2c66affSColin Finck     if (ppv == NULL)
41c2c66affSColin Finck         return E_POINTER;
42c2c66affSColin Finck     *ppv = NULL;
43c2c66affSColin Finck 
44c2c66affSColin Finck     if(IsEqualGUID(&IID_IUnknown, riid)) {
45c2c66affSColin Finck         TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
46c2c66affSColin Finck         *ppv = &This->IWebBrowser2_iface;
47c2c66affSColin Finck     }else if(IsEqualGUID(&IID_IDispatch, riid)) {
48c2c66affSColin Finck         TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
49c2c66affSColin Finck         *ppv = &This->IWebBrowser2_iface;
50c2c66affSColin Finck     }else if(IsEqualGUID(&IID_IWebBrowser, riid)) {
51c2c66affSColin Finck         TRACE("(%p)->(IID_IWebBrowser %p)\n", This, ppv);
52c2c66affSColin Finck         *ppv = &This->IWebBrowser2_iface;
53c2c66affSColin Finck     }else if(IsEqualGUID(&IID_IWebBrowserApp, riid)) {
54c2c66affSColin Finck         TRACE("(%p)->(IID_IWebBrowserApp %p)\n", This, ppv);
55c2c66affSColin Finck         *ppv = &This->IWebBrowser2_iface;
56c2c66affSColin Finck     }else if(IsEqualGUID(&IID_IWebBrowser2, riid)) {
57c2c66affSColin Finck         TRACE("(%p)->(IID_IWebBrowser2 %p)\n", This, ppv);
58c2c66affSColin Finck         *ppv = &This->IWebBrowser2_iface;
59c2c66affSColin Finck     }else if(IsEqualGUID(&IID_IOleObject, riid)) {
60c2c66affSColin Finck         TRACE("(%p)->(IID_IOleObject %p)\n", This, ppv);
61c2c66affSColin Finck         *ppv = &This->IOleObject_iface;
62c2c66affSColin Finck     }else if(IsEqualGUID(&IID_IOleWindow, riid)) {
63c2c66affSColin Finck         TRACE("(%p)->(IID_IOleWindow %p)\n", This, ppv);
64c2c66affSColin Finck         *ppv = &This->IOleInPlaceObject_iface;
65c2c66affSColin Finck     }else if(IsEqualGUID (&IID_IOleInPlaceObject, riid)) {
66c2c66affSColin Finck         TRACE("(%p)->(IID_IOleInPlaceObject %p)\n", This, ppv);
67c2c66affSColin Finck         *ppv = &This->IOleInPlaceObject_iface;
68c2c66affSColin Finck     }else if(IsEqualGUID(&IID_IOleControl, riid)) {
69c2c66affSColin Finck         TRACE("(%p)->(IID_IOleControl %p)\n", This, ppv);
70c2c66affSColin Finck         *ppv = &This->IOleControl_iface;
71c2c66affSColin Finck     }else if(IsEqualGUID(&IID_IPersist, riid)) {
72c2c66affSColin Finck         TRACE("(%p)->(IID_IPersist %p)\n", This, ppv);
73c2c66affSColin Finck         *ppv = &This->IPersistStorage_iface;
74c2c66affSColin Finck     }else if(IsEqualGUID(&IID_IPersistStorage, riid)) {
75c2c66affSColin Finck         TRACE("(%p)->(IID_IPersistStorage %p)\n", This, ppv);
76c2c66affSColin Finck         *ppv = &This->IPersistStorage_iface;
77c2c66affSColin Finck     }else if(IsEqualGUID(&IID_IPersistMemory, riid)) {
78c2c66affSColin Finck         TRACE("(%p)->(IID_IPersistStorage %p)\n", This, ppv);
79c2c66affSColin Finck         *ppv = &This->IPersistMemory_iface;
80c2c66affSColin Finck     }else if(IsEqualGUID (&IID_IPersistStreamInit, riid)) {
81c2c66affSColin Finck         TRACE("(%p)->(IID_IPersistStreamInit %p)\n", This, ppv);
82c2c66affSColin Finck         *ppv = &This->IPersistStreamInit_iface;
83c2c66affSColin Finck     }else if(IsEqualGUID(&IID_IProvideClassInfo, riid)) {
84c2c66affSColin Finck         TRACE("(%p)->(IID_IProvideClassInfo %p)\n", This, ppv);
85c2c66affSColin Finck         *ppv = &This->IProvideClassInfo2_iface;
86c2c66affSColin Finck     }else if(IsEqualGUID(&IID_IProvideClassInfo2, riid)) {
87c2c66affSColin Finck         TRACE("(%p)->(IID_IProvideClassInfo2 %p)\n", This, ppv);
88c2c66affSColin Finck         *ppv = &This->IProvideClassInfo2_iface;
89c2c66affSColin Finck     }else if(IsEqualGUID(&IID_IConnectionPointContainer, riid)) {
90c2c66affSColin Finck         TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This, ppv);
91c2c66affSColin Finck         *ppv = &This->doc_host.cps.IConnectionPointContainer_iface;
92c2c66affSColin Finck     }else if(IsEqualGUID(&IID_IViewObject, riid)) {
93c2c66affSColin Finck         TRACE("(%p)->(IID_IViewObject %p)\n", This, ppv);
94c2c66affSColin Finck         *ppv = &This->IViewObject2_iface;
95c2c66affSColin Finck     }else if(IsEqualGUID(&IID_IViewObject2, riid)) {
96c2c66affSColin Finck         TRACE("(%p)->(IID_IViewObject2 %p)\n", This, ppv);
97c2c66affSColin Finck         *ppv = &This->IViewObject2_iface;
98c2c66affSColin Finck     }else if(IsEqualGUID(&IID_IOleInPlaceActiveObject, riid)) {
99c2c66affSColin Finck         TRACE("(%p)->(IID_IOleInPlaceActiveObject %p)\n", This, ppv);
100c2c66affSColin Finck         *ppv = &This->IOleInPlaceActiveObject_iface;
101c2c66affSColin Finck     }else if(IsEqualGUID(&IID_IOleCommandTarget, riid)) {
102c2c66affSColin Finck         TRACE("(%p)->(IID_IOleCommandTarget %p)\n", This, ppv);
103c2c66affSColin Finck         *ppv = &This->IOleCommandTarget_iface;
104c2c66affSColin Finck     }else if(IsEqualGUID(&IID_IServiceProvider, riid)) {
105c2c66affSColin Finck         *ppv = &This->IServiceProvider_iface;
106c2c66affSColin Finck         TRACE("(%p)->(IID_IServiceProvider %p)\n", This, ppv);
107c2c66affSColin Finck     }else if(IsEqualGUID(&IID_IDataObject, riid)) {
108c2c66affSColin Finck         *ppv = &This->IDataObject_iface;
109c2c66affSColin Finck         TRACE("(%p)->(IID_IDataObject %p)\n", This, ppv);
110c2c66affSColin Finck     }else if(IsEqualGUID(&IID_IQuickActivate, riid)) {
111c2c66affSColin Finck         TRACE("(%p)->(IID_IQuickActivate %p) returning NULL\n", This, ppv);
112c2c66affSColin Finck         return E_NOINTERFACE;
113c2c66affSColin Finck     }else if(IsEqualGUID(&IID_IRunnableObject, riid)) {
114c2c66affSColin Finck         TRACE("(%p)->(IID_IRunnableObject %p) returning NULL\n", This, ppv);
115c2c66affSColin Finck         return E_NOINTERFACE;
116c2c66affSColin Finck     }else if(IsEqualGUID(&IID_IPerPropertyBrowsing, riid)) {
117c2c66affSColin Finck         TRACE("(%p)->(IID_IPerPropertyBrowsing %p) returning NULL\n", This, ppv);
118c2c66affSColin Finck         return E_NOINTERFACE;
119c2c66affSColin Finck     }else if(IsEqualGUID(&IID_IOleCache, riid)) {
120c2c66affSColin Finck         TRACE("(%p)->(IID_IOleCache %p) returning NULL\n", This, ppv);
121c2c66affSColin Finck         return E_NOINTERFACE;
122c2c66affSColin Finck     }else if(IsEqualGUID(&IID_IOleInPlaceSite, riid)) {
123c2c66affSColin Finck         TRACE("(%p)->(IID_IOleInPlaceSite %p) returning NULL\n", This, ppv);
124c2c66affSColin Finck         return E_NOINTERFACE;
125c2c66affSColin Finck     }else if(IsEqualGUID(&IID_IObjectWithSite, riid)) {
126c2c66affSColin Finck         TRACE("(%p)->(IID_IObjectWithSite %p) returning NULL\n", This, ppv);
127c2c66affSColin Finck         return E_NOINTERFACE;
128c2c66affSColin Finck     }else if(IsEqualGUID(&IID_IViewObjectEx, riid)) {
129c2c66affSColin Finck         TRACE("(%p)->(IID_IViewObjectEx %p) returning NULL\n", This, ppv);
130c2c66affSColin Finck         return E_NOINTERFACE;
131c2c66affSColin Finck     }else if(IsEqualGUID(&IID_IOleLink, riid)) {
132c2c66affSColin Finck         TRACE("(%p)->(IID_IOleLink %p) returning NULL\n", This, ppv);
133c2c66affSColin Finck         return E_NOINTERFACE;
134c2c66affSColin Finck     }else if(IsEqualGUID(&IID_IMarshal, riid)) {
135c2c66affSColin Finck         TRACE("(%p)->(IID_IMarshal %p) returning NULL\n", This, ppv);
136c2c66affSColin Finck         return E_NOINTERFACE;
137c2c66affSColin Finck     }else if(IsEqualGUID(&IID_IStdMarshalInfo, riid)) {
138c2c66affSColin Finck         /* This is implemented since IE10 */
139c2c66affSColin Finck         WARN("(%p)->(IID_IStdMarshalInfo %p) returning NULL\n", This, ppv);
140c2c66affSColin Finck         return E_NOINTERFACE;
141c2c66affSColin Finck     }else if(HlinkFrame_QI(&This->hlink_frame, riid, ppv)) {
142c2c66affSColin Finck         return S_OK;
143c2c66affSColin Finck     }
144c2c66affSColin Finck 
145c2c66affSColin Finck     if(*ppv) {
146c2c66affSColin Finck         IUnknown_AddRef((IUnknown*)*ppv);
147c2c66affSColin Finck         return S_OK;
148c2c66affSColin Finck     }
149c2c66affSColin Finck 
150c2c66affSColin Finck     FIXME("(%p)->(%s %p) interface not supported\n", This, debugstr_guid(riid), ppv);
151c2c66affSColin Finck     return E_NOINTERFACE;
152c2c66affSColin Finck }
153c2c66affSColin Finck 
WebBrowser_AddRef(IWebBrowser2 * iface)154c2c66affSColin Finck static ULONG WINAPI WebBrowser_AddRef(IWebBrowser2 *iface)
155c2c66affSColin Finck {
156c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
157c2c66affSColin Finck     LONG ref = InterlockedIncrement(&This->ref);
158c2c66affSColin Finck     TRACE("(%p) ref=%d\n", This, ref);
159c2c66affSColin Finck     return ref;
160c2c66affSColin Finck }
161c2c66affSColin Finck 
WebBrowser_Release(IWebBrowser2 * iface)162c2c66affSColin Finck static ULONG WINAPI WebBrowser_Release(IWebBrowser2 *iface)
163c2c66affSColin Finck {
164c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
165c2c66affSColin Finck     LONG ref = InterlockedDecrement(&This->ref);
166c2c66affSColin Finck 
167c2c66affSColin Finck     TRACE("(%p) ref=%d\n", This, ref);
168c2c66affSColin Finck 
169c2c66affSColin Finck     if(!ref) {
170c2c66affSColin Finck         if(This->sink)
171c2c66affSColin Finck             IAdviseSink_Release(This->sink);
172c2c66affSColin Finck 
173c2c66affSColin Finck         if(This->doc_host.document)
174c2c66affSColin Finck             IUnknown_Release(This->doc_host.document);
175c2c66affSColin Finck 
176c2c66affSColin Finck         DocHost_Release(&This->doc_host);
177c2c66affSColin Finck 
178c2c66affSColin Finck         WebBrowser_OleObject_Destroy(This);
179c2c66affSColin Finck 
180c2c66affSColin Finck         heap_free(This);
181c2c66affSColin Finck         unlock_module();
182c2c66affSColin Finck     }
183c2c66affSColin Finck 
184c2c66affSColin Finck     return ref;
185c2c66affSColin Finck }
186c2c66affSColin Finck 
187c2c66affSColin Finck /* IDispatch methods */
WebBrowser_GetTypeInfoCount(IWebBrowser2 * iface,UINT * pctinfo)188c2c66affSColin Finck static HRESULT WINAPI WebBrowser_GetTypeInfoCount(IWebBrowser2 *iface, UINT *pctinfo)
189c2c66affSColin Finck {
190c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
191c2c66affSColin Finck 
192c2c66affSColin Finck     TRACE("(%p)->(%p)\n", This, pctinfo);
193c2c66affSColin Finck 
194c2c66affSColin Finck     *pctinfo = 1;
195c2c66affSColin Finck     return S_OK;
196c2c66affSColin Finck }
197c2c66affSColin Finck 
WebBrowser_GetTypeInfo(IWebBrowser2 * iface,UINT iTInfo,LCID lcid,LPTYPEINFO * ppTInfo)198c2c66affSColin Finck static HRESULT WINAPI WebBrowser_GetTypeInfo(IWebBrowser2 *iface, UINT iTInfo, LCID lcid,
199c2c66affSColin Finck                                      LPTYPEINFO *ppTInfo)
200c2c66affSColin Finck {
201c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
202c2c66affSColin Finck     ITypeInfo *typeinfo;
203c2c66affSColin Finck     HRESULT hres;
204c2c66affSColin Finck 
205c2c66affSColin Finck     TRACE("(%p)->(%d %d %p)\n", This, iTInfo, lcid, ppTInfo);
206c2c66affSColin Finck 
207c2c66affSColin Finck     hres = get_typeinfo(IWebBrowser2_tid, &typeinfo);
208c2c66affSColin Finck     if(FAILED(hres))
209c2c66affSColin Finck         return hres;
210c2c66affSColin Finck 
211c2c66affSColin Finck     ITypeInfo_AddRef(typeinfo);
212c2c66affSColin Finck     *ppTInfo = typeinfo;
213c2c66affSColin Finck     return S_OK;
214c2c66affSColin Finck }
215c2c66affSColin Finck 
WebBrowser_GetIDsOfNames(IWebBrowser2 * iface,REFIID riid,LPOLESTR * rgszNames,UINT cNames,LCID lcid,DISPID * rgDispId)216c2c66affSColin Finck static HRESULT WINAPI WebBrowser_GetIDsOfNames(IWebBrowser2 *iface, REFIID riid,
217c2c66affSColin Finck                                        LPOLESTR *rgszNames, UINT cNames,
218c2c66affSColin Finck                                        LCID lcid, DISPID *rgDispId)
219c2c66affSColin Finck {
220c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
221c2c66affSColin Finck     ITypeInfo *typeinfo;
222c2c66affSColin Finck     HRESULT hres;
223c2c66affSColin Finck 
224c2c66affSColin Finck     TRACE("(%p)->(%s %p %d %d %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
225c2c66affSColin Finck           lcid, rgDispId);
226c2c66affSColin Finck 
227c2c66affSColin Finck     hres = get_typeinfo(IWebBrowser2_tid, &typeinfo);
228c2c66affSColin Finck     if(FAILED(hres))
229c2c66affSColin Finck         return hres;
230c2c66affSColin Finck 
231c2c66affSColin Finck     return ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
232c2c66affSColin Finck }
233c2c66affSColin Finck 
WebBrowser_Invoke(IWebBrowser2 * iface,DISPID dispIdMember,REFIID riid,LCID lcid,WORD wFlags,DISPPARAMS * pDispParams,VARIANT * pVarResult,EXCEPINFO * pExepInfo,UINT * puArgErr)234c2c66affSColin Finck static HRESULT WINAPI WebBrowser_Invoke(IWebBrowser2 *iface, DISPID dispIdMember,
235c2c66affSColin Finck                                 REFIID riid, LCID lcid, WORD wFlags,
236c2c66affSColin Finck                                 DISPPARAMS *pDispParams, VARIANT *pVarResult,
237c2c66affSColin Finck                                 EXCEPINFO *pExepInfo, UINT *puArgErr)
238c2c66affSColin Finck {
239c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
240c2c66affSColin Finck     ITypeInfo *typeinfo;
241c2c66affSColin Finck     HRESULT hres;
242c2c66affSColin Finck 
243c2c66affSColin Finck     TRACE("(%p)->(%d %s %d %08x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
244c2c66affSColin Finck             lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
245c2c66affSColin Finck 
246c2c66affSColin Finck     hres = get_typeinfo(IWebBrowser2_tid, &typeinfo);
247c2c66affSColin Finck     if(FAILED(hres))
248c2c66affSColin Finck         return hres;
249c2c66affSColin Finck 
250c2c66affSColin Finck     return ITypeInfo_Invoke(typeinfo, &This->IWebBrowser2_iface, dispIdMember, wFlags, pDispParams,
251c2c66affSColin Finck             pVarResult, pExepInfo, puArgErr);
252c2c66affSColin Finck }
253c2c66affSColin Finck 
254c2c66affSColin Finck /* IWebBrowser methods */
WebBrowser_GoBack(IWebBrowser2 * iface)255c2c66affSColin Finck static HRESULT WINAPI WebBrowser_GoBack(IWebBrowser2 *iface)
256c2c66affSColin Finck {
257c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
258c2c66affSColin Finck     TRACE("(%p)\n", This);
259c2c66affSColin Finck     return go_back(&This->doc_host);
260c2c66affSColin Finck }
261c2c66affSColin Finck 
WebBrowser_GoForward(IWebBrowser2 * iface)262c2c66affSColin Finck static HRESULT WINAPI WebBrowser_GoForward(IWebBrowser2 *iface)
263c2c66affSColin Finck {
264c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
265c2c66affSColin Finck     TRACE("(%p)\n", This);
266c2c66affSColin Finck     return go_forward(&This->doc_host);
267c2c66affSColin Finck }
268c2c66affSColin Finck 
WebBrowser_GoHome(IWebBrowser2 * iface)269c2c66affSColin Finck static HRESULT WINAPI WebBrowser_GoHome(IWebBrowser2 *iface)
270c2c66affSColin Finck {
271c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
272c2c66affSColin Finck     TRACE("(%p)\n", This);
273c2c66affSColin Finck     return go_home(&This->doc_host);
274c2c66affSColin Finck }
275c2c66affSColin Finck 
WebBrowser_GoSearch(IWebBrowser2 * iface)276c2c66affSColin Finck static HRESULT WINAPI WebBrowser_GoSearch(IWebBrowser2 *iface)
277c2c66affSColin Finck {
278c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
279c2c66affSColin Finck     FIXME("(%p)\n", This);
280c2c66affSColin Finck     return E_NOTIMPL;
281c2c66affSColin Finck }
282c2c66affSColin Finck 
WebBrowser_Navigate(IWebBrowser2 * iface,BSTR szUrl,VARIANT * Flags,VARIANT * TargetFrameName,VARIANT * PostData,VARIANT * Headers)283c2c66affSColin Finck static HRESULT WINAPI WebBrowser_Navigate(IWebBrowser2 *iface, BSTR szUrl,
284c2c66affSColin Finck                                   VARIANT *Flags, VARIANT *TargetFrameName,
285c2c66affSColin Finck                                   VARIANT *PostData, VARIANT *Headers)
286c2c66affSColin Finck {
287c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
288c2c66affSColin Finck 
289c2c66affSColin Finck     TRACE("(%p)->(%s %s %s %s %s)\n", This, debugstr_w(szUrl), debugstr_variant(Flags),
290c2c66affSColin Finck           debugstr_variant(TargetFrameName), debugstr_variant(PostData),
291c2c66affSColin Finck           debugstr_variant(Headers));
292c2c66affSColin Finck 
293c2c66affSColin Finck     return navigate_url(&This->doc_host, szUrl, Flags, TargetFrameName, PostData, Headers);
294c2c66affSColin Finck }
295c2c66affSColin Finck 
WebBrowser_Refresh(IWebBrowser2 * iface)296c2c66affSColin Finck static HRESULT WINAPI WebBrowser_Refresh(IWebBrowser2 *iface)
297c2c66affSColin Finck {
298c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
299c2c66affSColin Finck 
300c2c66affSColin Finck     TRACE("(%p)\n", This);
301c2c66affSColin Finck 
302c2c66affSColin Finck     return refresh_document(&This->doc_host, NULL);
303c2c66affSColin Finck }
304c2c66affSColin Finck 
WebBrowser_Refresh2(IWebBrowser2 * iface,VARIANT * Level)305c2c66affSColin Finck static HRESULT WINAPI WebBrowser_Refresh2(IWebBrowser2 *iface, VARIANT *Level)
306c2c66affSColin Finck {
307c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
308c2c66affSColin Finck 
309c2c66affSColin Finck     TRACE("(%p)->(%s)\n", This, debugstr_variant(Level));
310c2c66affSColin Finck 
311c2c66affSColin Finck     return refresh_document(&This->doc_host, Level);
312c2c66affSColin Finck }
313c2c66affSColin Finck 
WebBrowser_Stop(IWebBrowser2 * iface)314c2c66affSColin Finck static HRESULT WINAPI WebBrowser_Stop(IWebBrowser2 *iface)
315c2c66affSColin Finck {
316c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
317c2c66affSColin Finck     FIXME("(%p)\n", This);
318c2c66affSColin Finck     return S_OK;
319c2c66affSColin Finck }
320c2c66affSColin Finck 
WebBrowser_get_Application(IWebBrowser2 * iface,IDispatch ** ppDisp)321c2c66affSColin Finck static HRESULT WINAPI WebBrowser_get_Application(IWebBrowser2 *iface, IDispatch **ppDisp)
322c2c66affSColin Finck {
323c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
324c2c66affSColin Finck 
325c2c66affSColin Finck     TRACE("(%p)->(%p)\n", This, ppDisp);
326c2c66affSColin Finck 
327c2c66affSColin Finck     if(!ppDisp)
328c2c66affSColin Finck         return E_POINTER;
329c2c66affSColin Finck 
330c2c66affSColin Finck     *ppDisp = (IDispatch*)&This->IWebBrowser2_iface;
331c2c66affSColin Finck     IDispatch_AddRef(*ppDisp);
332c2c66affSColin Finck     return S_OK;
333c2c66affSColin Finck }
334c2c66affSColin Finck 
WebBrowser_get_Parent(IWebBrowser2 * iface,IDispatch ** ppDisp)335c2c66affSColin Finck static HRESULT WINAPI WebBrowser_get_Parent(IWebBrowser2 *iface, IDispatch **ppDisp)
336c2c66affSColin Finck {
337c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
338c2c66affSColin Finck     FIXME("(%p)->(%p)\n", This, ppDisp);
339c2c66affSColin Finck     return E_NOTIMPL;
340c2c66affSColin Finck }
341c2c66affSColin Finck 
WebBrowser_get_Container(IWebBrowser2 * iface,IDispatch ** ppDisp)342c2c66affSColin Finck static HRESULT WINAPI WebBrowser_get_Container(IWebBrowser2 *iface, IDispatch **ppDisp)
343c2c66affSColin Finck {
344c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
345c2c66affSColin Finck     FIXME("(%p)->(%p)\n", This, ppDisp);
346c2c66affSColin Finck     return E_NOTIMPL;
347c2c66affSColin Finck }
348c2c66affSColin Finck 
WebBrowser_get_Document(IWebBrowser2 * iface,IDispatch ** ppDisp)349c2c66affSColin Finck static HRESULT WINAPI WebBrowser_get_Document(IWebBrowser2 *iface, IDispatch **ppDisp)
350c2c66affSColin Finck {
351c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
352c2c66affSColin Finck     IDispatch *disp = NULL;
353c2c66affSColin Finck 
354c2c66affSColin Finck     TRACE("(%p)->(%p)\n", This, ppDisp);
355c2c66affSColin Finck 
356c2c66affSColin Finck     if(This->doc_host.document) {
357c2c66affSColin Finck         HRESULT hres;
358c2c66affSColin Finck 
359c2c66affSColin Finck         hres = IUnknown_QueryInterface(This->doc_host.document, &IID_IDispatch, (void**)&disp);
360c2c66affSColin Finck         if(SUCCEEDED(hres)) {
361c2c66affSColin Finck             IDispatch *html_doc;
362c2c66affSColin Finck 
363c2c66affSColin Finck             /* Some broken apps cast returned IDispatch to IHTMLDocument2
364c2c66affSColin Finck              * without QueryInterface call */
365c2c66affSColin Finck             hres = IDispatch_QueryInterface(disp, &IID_IHTMLDocument2, (void**)&html_doc);
366c2c66affSColin Finck             if(SUCCEEDED(hres)) {
367c2c66affSColin Finck                 IDispatch_Release(disp);
368c2c66affSColin Finck                 disp = html_doc;
369c2c66affSColin Finck             }
370c2c66affSColin Finck         }
371c2c66affSColin Finck     }
372c2c66affSColin Finck 
373c2c66affSColin Finck     *ppDisp = disp;
374c2c66affSColin Finck     return S_OK;
375c2c66affSColin Finck }
376c2c66affSColin Finck 
WebBrowser_get_TopLevelContainer(IWebBrowser2 * iface,VARIANT_BOOL * pBool)377c2c66affSColin Finck static HRESULT WINAPI WebBrowser_get_TopLevelContainer(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
378c2c66affSColin Finck {
379c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
380c2c66affSColin Finck     FIXME("(%p)->(%p)\n", This, pBool);
381c2c66affSColin Finck     return E_NOTIMPL;
382c2c66affSColin Finck }
383c2c66affSColin Finck 
WebBrowser_get_Type(IWebBrowser2 * iface,BSTR * Type)384c2c66affSColin Finck static HRESULT WINAPI WebBrowser_get_Type(IWebBrowser2 *iface, BSTR *Type)
385c2c66affSColin Finck {
386c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
387c2c66affSColin Finck     FIXME("(%p)->(%p)\n", This, Type);
388c2c66affSColin Finck     return E_NOTIMPL;
389c2c66affSColin Finck }
390c2c66affSColin Finck 
WebBrowser_get_Left(IWebBrowser2 * iface,LONG * pl)391c2c66affSColin Finck static HRESULT WINAPI WebBrowser_get_Left(IWebBrowser2 *iface, LONG *pl)
392c2c66affSColin Finck {
393c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
394c2c66affSColin Finck 
395c2c66affSColin Finck     TRACE("(%p)->(%p)\n", This, pl);
396c2c66affSColin Finck 
397c2c66affSColin Finck     *pl = This->pos_rect.left;
398c2c66affSColin Finck     return S_OK;
399c2c66affSColin Finck }
400c2c66affSColin Finck 
WebBrowser_put_Left(IWebBrowser2 * iface,LONG Left)401c2c66affSColin Finck static HRESULT WINAPI WebBrowser_put_Left(IWebBrowser2 *iface, LONG Left)
402c2c66affSColin Finck {
403c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
404c2c66affSColin Finck     RECT rect;
405c2c66affSColin Finck 
406c2c66affSColin Finck     TRACE("(%p)->(%d)\n", This, Left);
407c2c66affSColin Finck 
408c2c66affSColin Finck     if(!This->inplace)
409c2c66affSColin Finck         return E_UNEXPECTED;
410c2c66affSColin Finck 
411c2c66affSColin Finck     rect = This->pos_rect;
412c2c66affSColin Finck     rect.left = Left;
413c2c66affSColin Finck 
414c2c66affSColin Finck     /* We don't really change the window position here.
415c2c66affSColin Finck      * We just notify the embedder that he should do so. */
416c2c66affSColin Finck     return IOleInPlaceSiteEx_OnPosRectChange(This->inplace, &rect);
417c2c66affSColin Finck }
418c2c66affSColin Finck 
WebBrowser_get_Top(IWebBrowser2 * iface,LONG * pl)419c2c66affSColin Finck static HRESULT WINAPI WebBrowser_get_Top(IWebBrowser2 *iface, LONG *pl)
420c2c66affSColin Finck {
421c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
422c2c66affSColin Finck 
423c2c66affSColin Finck     TRACE("(%p)->(%p)\n", This, pl);
424c2c66affSColin Finck 
425c2c66affSColin Finck     *pl = This->pos_rect.top;
426c2c66affSColin Finck     return S_OK;
427c2c66affSColin Finck }
428c2c66affSColin Finck 
WebBrowser_put_Top(IWebBrowser2 * iface,LONG Top)429c2c66affSColin Finck static HRESULT WINAPI WebBrowser_put_Top(IWebBrowser2 *iface, LONG Top)
430c2c66affSColin Finck {
431c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
432c2c66affSColin Finck     RECT rect;
433c2c66affSColin Finck 
434c2c66affSColin Finck     TRACE("(%p)->(%d)\n", This, Top);
435c2c66affSColin Finck 
436c2c66affSColin Finck     if(!This->inplace)
437c2c66affSColin Finck         return E_UNEXPECTED;
438c2c66affSColin Finck 
439c2c66affSColin Finck     rect = This->pos_rect;
440c2c66affSColin Finck     rect.top = Top;
441c2c66affSColin Finck 
442c2c66affSColin Finck     /* We don't really change the window position here.
443c2c66affSColin Finck      * We just notify the embedder that he should do so. */
444c2c66affSColin Finck     return IOleInPlaceSiteEx_OnPosRectChange(This->inplace, &rect);
445c2c66affSColin Finck }
446c2c66affSColin Finck 
WebBrowser_get_Width(IWebBrowser2 * iface,LONG * pl)447c2c66affSColin Finck static HRESULT WINAPI WebBrowser_get_Width(IWebBrowser2 *iface, LONG *pl)
448c2c66affSColin Finck {
449c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
450c2c66affSColin Finck 
451c2c66affSColin Finck     TRACE("(%p)->(%p)\n", This, pl);
452c2c66affSColin Finck 
453c2c66affSColin Finck     *pl = This->pos_rect.right - This->pos_rect.left;
454c2c66affSColin Finck     return S_OK;
455c2c66affSColin Finck }
456c2c66affSColin Finck 
WebBrowser_put_Width(IWebBrowser2 * iface,LONG Width)457c2c66affSColin Finck static HRESULT WINAPI WebBrowser_put_Width(IWebBrowser2 *iface, LONG Width)
458c2c66affSColin Finck {
459c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
460c2c66affSColin Finck     RECT rect;
461c2c66affSColin Finck 
462c2c66affSColin Finck     TRACE("(%p)->(%d)\n", This, Width);
463c2c66affSColin Finck 
464c2c66affSColin Finck     if(!This->inplace)
465c2c66affSColin Finck         return E_UNEXPECTED;
466c2c66affSColin Finck 
467c2c66affSColin Finck     rect = This->pos_rect;
468c2c66affSColin Finck     rect.right = rect.left+Width;
469c2c66affSColin Finck 
470c2c66affSColin Finck     /* We don't really change the window size here.
471c2c66affSColin Finck      * We just notify the embedder that he should do so. */
472c2c66affSColin Finck    return IOleInPlaceSiteEx_OnPosRectChange(This->inplace, &rect);
473c2c66affSColin Finck }
474c2c66affSColin Finck 
WebBrowser_get_Height(IWebBrowser2 * iface,LONG * pl)475c2c66affSColin Finck static HRESULT WINAPI WebBrowser_get_Height(IWebBrowser2 *iface, LONG *pl)
476c2c66affSColin Finck {
477c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
478c2c66affSColin Finck 
479c2c66affSColin Finck     TRACE("(%p)->(%p)\n", This, pl);
480c2c66affSColin Finck 
481c2c66affSColin Finck     *pl = This->pos_rect.bottom - This->pos_rect.top;
482c2c66affSColin Finck     return S_OK;
483c2c66affSColin Finck }
484c2c66affSColin Finck 
WebBrowser_put_Height(IWebBrowser2 * iface,LONG Height)485c2c66affSColin Finck static HRESULT WINAPI WebBrowser_put_Height(IWebBrowser2 *iface, LONG Height)
486c2c66affSColin Finck {
487c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
488c2c66affSColin Finck     RECT rect;
489c2c66affSColin Finck 
490c2c66affSColin Finck     TRACE("(%p)->(%d)\n", This, Height);
491c2c66affSColin Finck 
492c2c66affSColin Finck     if(!This->inplace)
493c2c66affSColin Finck         return E_UNEXPECTED;
494c2c66affSColin Finck 
495c2c66affSColin Finck     rect = This->pos_rect;
496c2c66affSColin Finck     rect.bottom = rect.top+Height;
497c2c66affSColin Finck 
498c2c66affSColin Finck     /* We don't really change the window size here.
499c2c66affSColin Finck      * We just notify the embedder that he should do so. */
500c2c66affSColin Finck     return IOleInPlaceSiteEx_OnPosRectChange(This->inplace, &rect);
501c2c66affSColin Finck }
502c2c66affSColin Finck 
WebBrowser_get_LocationName(IWebBrowser2 * iface,BSTR * LocationName)503c2c66affSColin Finck static HRESULT WINAPI WebBrowser_get_LocationName(IWebBrowser2 *iface, BSTR *LocationName)
504c2c66affSColin Finck {
505c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
506c2c66affSColin Finck     FIXME("(%p)->(%p)\n", This, LocationName);
507c2c66affSColin Finck     return E_NOTIMPL;
508c2c66affSColin Finck }
509c2c66affSColin Finck 
WebBrowser_get_LocationURL(IWebBrowser2 * iface,BSTR * LocationURL)510c2c66affSColin Finck static HRESULT WINAPI WebBrowser_get_LocationURL(IWebBrowser2 *iface, BSTR *LocationURL)
511c2c66affSColin Finck {
512c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
513c2c66affSColin Finck 
514c2c66affSColin Finck     TRACE("(%p)->(%p)\n", This, LocationURL);
515c2c66affSColin Finck 
516c2c66affSColin Finck     return get_location_url(&This->doc_host, LocationURL);
517c2c66affSColin Finck }
518c2c66affSColin Finck 
WebBrowser_get_Busy(IWebBrowser2 * iface,VARIANT_BOOL * pBool)519c2c66affSColin Finck static HRESULT WINAPI WebBrowser_get_Busy(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
520c2c66affSColin Finck {
521c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
522c2c66affSColin Finck 
523c2c66affSColin Finck     TRACE("(%p)->(%p)\n", This, pBool);
524c2c66affSColin Finck 
525c2c66affSColin Finck     *pBool = This->doc_host.busy;
526c2c66affSColin Finck     return S_OK;
527c2c66affSColin Finck }
528c2c66affSColin Finck 
WebBrowser_Quit(IWebBrowser2 * iface)529c2c66affSColin Finck static HRESULT WINAPI WebBrowser_Quit(IWebBrowser2 *iface)
530c2c66affSColin Finck {
531c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
532c2c66affSColin Finck 
533c2c66affSColin Finck     TRACE("(%p)\n", This);
534c2c66affSColin Finck 
535c2c66affSColin Finck     /* It's a InternetExplorer specific method, we have nothing to do here. */
536c2c66affSColin Finck     return E_FAIL;
537c2c66affSColin Finck }
538c2c66affSColin Finck 
WebBrowser_ClientToWindow(IWebBrowser2 * iface,int * pcx,int * pcy)539c2c66affSColin Finck static HRESULT WINAPI WebBrowser_ClientToWindow(IWebBrowser2 *iface, int *pcx, int *pcy)
540c2c66affSColin Finck {
541c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
542c2c66affSColin Finck     FIXME("(%p)->(%p %p)\n", This, pcx, pcy);
543c2c66affSColin Finck     return E_NOTIMPL;
544c2c66affSColin Finck }
545c2c66affSColin Finck 
WebBrowser_PutProperty(IWebBrowser2 * iface,BSTR szProperty,VARIANT vtValue)546c2c66affSColin Finck static HRESULT WINAPI WebBrowser_PutProperty(IWebBrowser2 *iface, BSTR szProperty, VARIANT vtValue)
547c2c66affSColin Finck {
548c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
549c2c66affSColin Finck     FIXME("(%p)->(%s %s)\n", This, debugstr_w(szProperty), debugstr_variant(&vtValue));
550c2c66affSColin Finck     return E_NOTIMPL;
551c2c66affSColin Finck }
552c2c66affSColin Finck 
WebBrowser_GetProperty(IWebBrowser2 * iface,BSTR szProperty,VARIANT * pvtValue)553c2c66affSColin Finck static HRESULT WINAPI WebBrowser_GetProperty(IWebBrowser2 *iface, BSTR szProperty, VARIANT *pvtValue)
554c2c66affSColin Finck {
555c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
556c2c66affSColin Finck     FIXME("(%p)->(%s %s)\n", This, debugstr_w(szProperty), debugstr_variant(pvtValue));
557c2c66affSColin Finck     return E_NOTIMPL;
558c2c66affSColin Finck }
559c2c66affSColin Finck 
WebBrowser_get_Name(IWebBrowser2 * iface,BSTR * Name)560c2c66affSColin Finck static HRESULT WINAPI WebBrowser_get_Name(IWebBrowser2 *iface, BSTR *Name)
561c2c66affSColin Finck {
562c2c66affSColin Finck     static const WCHAR sName[] = {'M','i','c','r','o','s','o','f','t',' ','W','e','b',
563c2c66affSColin Finck                                   ' ','B','r','o','w','s','e','r',' ','C','o','n','t','r','o','l',0};
564c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
565c2c66affSColin Finck 
566c2c66affSColin Finck     TRACE("(%p)->(%p)\n", This, Name);
567c2c66affSColin Finck 
568c2c66affSColin Finck     *Name = SysAllocString(sName);
569c2c66affSColin Finck 
570c2c66affSColin Finck     return S_OK;
571c2c66affSColin Finck }
572c2c66affSColin Finck 
WebBrowser_get_HWND(IWebBrowser2 * iface,SHANDLE_PTR * pHWND)573c2c66affSColin Finck static HRESULT WINAPI WebBrowser_get_HWND(IWebBrowser2 *iface, SHANDLE_PTR *pHWND)
574c2c66affSColin Finck {
575c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
576c2c66affSColin Finck 
577c2c66affSColin Finck     TRACE("(%p)->(%p)\n", This, pHWND);
578c2c66affSColin Finck 
579c2c66affSColin Finck     /* WebBrowser control never has a frame window (in opposition to InternetExplorer) */
580c2c66affSColin Finck     *pHWND = 0;
581c2c66affSColin Finck     return E_FAIL;
582c2c66affSColin Finck }
583c2c66affSColin Finck 
WebBrowser_get_FullName(IWebBrowser2 * iface,BSTR * FullName)584c2c66affSColin Finck static HRESULT WINAPI WebBrowser_get_FullName(IWebBrowser2 *iface, BSTR *FullName)
585c2c66affSColin Finck {
586c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
587c2c66affSColin Finck     FIXME("(%p)->(%p)\n", This, FullName);
588c2c66affSColin Finck     return E_NOTIMPL;
589c2c66affSColin Finck }
590c2c66affSColin Finck 
WebBrowser_get_Path(IWebBrowser2 * iface,BSTR * Path)591c2c66affSColin Finck static HRESULT WINAPI WebBrowser_get_Path(IWebBrowser2 *iface, BSTR *Path)
592c2c66affSColin Finck {
593c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
594c2c66affSColin Finck     FIXME("(%p)->(%p)\n", This, Path);
595c2c66affSColin Finck     return E_NOTIMPL;
596c2c66affSColin Finck }
597c2c66affSColin Finck 
WebBrowser_get_Visible(IWebBrowser2 * iface,VARIANT_BOOL * pBool)598c2c66affSColin Finck static HRESULT WINAPI WebBrowser_get_Visible(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
599c2c66affSColin Finck {
600c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
601c2c66affSColin Finck 
602c2c66affSColin Finck     TRACE("(%p)->(%p)\n", This, pBool);
603c2c66affSColin Finck 
604c2c66affSColin Finck     *pBool = This->visible;
605c2c66affSColin Finck     return S_OK;
606c2c66affSColin Finck }
607c2c66affSColin Finck 
WebBrowser_put_Visible(IWebBrowser2 * iface,VARIANT_BOOL Value)608c2c66affSColin Finck static HRESULT WINAPI WebBrowser_put_Visible(IWebBrowser2 *iface, VARIANT_BOOL Value)
609c2c66affSColin Finck {
610c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
611c2c66affSColin Finck     VARIANTARG arg;
612c2c66affSColin Finck     DISPPARAMS dispparams = {&arg, NULL, 1, 0};
613c2c66affSColin Finck 
614c2c66affSColin Finck     TRACE("(%p)->(%x)\n", This, Value);
615c2c66affSColin Finck 
616c2c66affSColin Finck     This->visible = Value;
617c2c66affSColin Finck 
618c2c66affSColin Finck     V_VT(&arg) = VT_BOOL;
619c2c66affSColin Finck     V_BOOL(&arg) = Value;
620c2c66affSColin Finck     call_sink(This->doc_host.cps.wbe2, DISPID_ONVISIBLE, &dispparams);
621c2c66affSColin Finck 
622c2c66affSColin Finck     return S_OK;
623c2c66affSColin Finck }
624c2c66affSColin Finck 
WebBrowser_get_StatusBar(IWebBrowser2 * iface,VARIANT_BOOL * pBool)625c2c66affSColin Finck static HRESULT WINAPI WebBrowser_get_StatusBar(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
626c2c66affSColin Finck {
627c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
628c2c66affSColin Finck 
629c2c66affSColin Finck     TRACE("(%p)->(%p)\n", This, pBool);
630c2c66affSColin Finck 
631c2c66affSColin Finck     *pBool = This->status_bar;
632c2c66affSColin Finck     return S_OK;
633c2c66affSColin Finck }
634c2c66affSColin Finck 
WebBrowser_put_StatusBar(IWebBrowser2 * iface,VARIANT_BOOL Value)635c2c66affSColin Finck static HRESULT WINAPI WebBrowser_put_StatusBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
636c2c66affSColin Finck {
637c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
638c2c66affSColin Finck     VARIANTARG arg;
639c2c66affSColin Finck     DISPPARAMS dispparams = {&arg, NULL, 1, 0};
640c2c66affSColin Finck 
641c2c66affSColin Finck     TRACE("(%p)->(%x)\n", This, Value);
642c2c66affSColin Finck 
643c2c66affSColin Finck     This->status_bar = Value ? VARIANT_TRUE : VARIANT_FALSE;
644c2c66affSColin Finck 
645c2c66affSColin Finck     /* In opposition to InternetExplorer, all we should do here is
646c2c66affSColin Finck      * inform the embedder about the status bar change. */
647c2c66affSColin Finck 
648c2c66affSColin Finck     V_VT(&arg) = VT_BOOL;
649c2c66affSColin Finck     V_BOOL(&arg) = Value;
650c2c66affSColin Finck     call_sink(This->doc_host.cps.wbe2, DISPID_ONSTATUSBAR, &dispparams);
651c2c66affSColin Finck 
652c2c66affSColin Finck     return S_OK;
653c2c66affSColin Finck }
654c2c66affSColin Finck 
WebBrowser_get_StatusText(IWebBrowser2 * iface,BSTR * StatusText)655c2c66affSColin Finck static HRESULT WINAPI WebBrowser_get_StatusText(IWebBrowser2 *iface, BSTR *StatusText)
656c2c66affSColin Finck {
657c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
658c2c66affSColin Finck     FIXME("(%p)->(%p)\n", This, StatusText);
659c2c66affSColin Finck     return E_NOTIMPL;
660c2c66affSColin Finck }
661c2c66affSColin Finck 
WebBrowser_put_StatusText(IWebBrowser2 * iface,BSTR StatusText)662c2c66affSColin Finck static HRESULT WINAPI WebBrowser_put_StatusText(IWebBrowser2 *iface, BSTR StatusText)
663c2c66affSColin Finck {
664c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
665c2c66affSColin Finck     FIXME("(%p)->(%s)\n", This, debugstr_w(StatusText));
666c2c66affSColin Finck     return E_NOTIMPL;
667c2c66affSColin Finck }
668c2c66affSColin Finck 
WebBrowser_get_ToolBar(IWebBrowser2 * iface,int * Value)669c2c66affSColin Finck static HRESULT WINAPI WebBrowser_get_ToolBar(IWebBrowser2 *iface, int *Value)
670c2c66affSColin Finck {
671c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
672c2c66affSColin Finck 
673c2c66affSColin Finck     TRACE("(%p)->(%p)\n", This, Value);
674c2c66affSColin Finck 
675c2c66affSColin Finck     *Value = This->tool_bar;
676c2c66affSColin Finck     return S_OK;
677c2c66affSColin Finck }
678c2c66affSColin Finck 
WebBrowser_put_ToolBar(IWebBrowser2 * iface,int Value)679c2c66affSColin Finck static HRESULT WINAPI WebBrowser_put_ToolBar(IWebBrowser2 *iface, int Value)
680c2c66affSColin Finck {
681c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
682c2c66affSColin Finck     VARIANTARG arg;
683c2c66affSColin Finck     DISPPARAMS dispparams = {&arg, NULL, 1, 0};
684c2c66affSColin Finck 
685c2c66affSColin Finck     TRACE("(%p)->(%x)\n", This, Value);
686c2c66affSColin Finck 
687c2c66affSColin Finck     This->tool_bar = Value ? VARIANT_TRUE : VARIANT_FALSE;
688c2c66affSColin Finck 
689c2c66affSColin Finck     /* In opposition to InternetExplorer, all we should do here is
690c2c66affSColin Finck      * inform the embedder about the tool bar change. */
691c2c66affSColin Finck 
692c2c66affSColin Finck     V_VT(&arg) = VT_BOOL;
693c2c66affSColin Finck     V_BOOL(&arg) = This->tool_bar;
694c2c66affSColin Finck     call_sink(This->doc_host.cps.wbe2, DISPID_ONTOOLBAR, &dispparams);
695c2c66affSColin Finck 
696c2c66affSColin Finck     return S_OK;
697c2c66affSColin Finck }
698c2c66affSColin Finck 
WebBrowser_get_MenuBar(IWebBrowser2 * iface,VARIANT_BOOL * Value)699c2c66affSColin Finck static HRESULT WINAPI WebBrowser_get_MenuBar(IWebBrowser2 *iface, VARIANT_BOOL *Value)
700c2c66affSColin Finck {
701c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
702c2c66affSColin Finck 
703c2c66affSColin Finck     TRACE("(%p)->(%p)\n", This, Value);
704c2c66affSColin Finck 
705c2c66affSColin Finck     *Value = This->menu_bar;
706c2c66affSColin Finck     return S_OK;
707c2c66affSColin Finck }
708c2c66affSColin Finck 
WebBrowser_put_MenuBar(IWebBrowser2 * iface,VARIANT_BOOL Value)709c2c66affSColin Finck static HRESULT WINAPI WebBrowser_put_MenuBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
710c2c66affSColin Finck {
711c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
712c2c66affSColin Finck     VARIANTARG arg;
713c2c66affSColin Finck     DISPPARAMS dispparams = {&arg, NULL, 1, 0};
714c2c66affSColin Finck 
715c2c66affSColin Finck     TRACE("(%p)->(%x)\n", This, Value);
716c2c66affSColin Finck 
717c2c66affSColin Finck     This->menu_bar = Value ? VARIANT_TRUE : VARIANT_FALSE;
718c2c66affSColin Finck 
719c2c66affSColin Finck     /* In opposition to InternetExplorer, all we should do here is
720c2c66affSColin Finck      * inform the embedder about the menu bar change. */
721c2c66affSColin Finck 
722c2c66affSColin Finck     V_VT(&arg) = VT_BOOL;
723c2c66affSColin Finck     V_BOOL(&arg) = Value;
724c2c66affSColin Finck     call_sink(This->doc_host.cps.wbe2, DISPID_ONMENUBAR, &dispparams);
725c2c66affSColin Finck 
726c2c66affSColin Finck     return S_OK;
727c2c66affSColin Finck }
728c2c66affSColin Finck 
WebBrowser_get_FullScreen(IWebBrowser2 * iface,VARIANT_BOOL * pbFullScreen)729c2c66affSColin Finck static HRESULT WINAPI WebBrowser_get_FullScreen(IWebBrowser2 *iface, VARIANT_BOOL *pbFullScreen)
730c2c66affSColin Finck {
731c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
732c2c66affSColin Finck 
733c2c66affSColin Finck     TRACE("(%p)->(%p)\n", This, pbFullScreen);
734c2c66affSColin Finck 
735c2c66affSColin Finck     *pbFullScreen = This->full_screen;
736c2c66affSColin Finck     return S_OK;
737c2c66affSColin Finck }
738c2c66affSColin Finck 
WebBrowser_put_FullScreen(IWebBrowser2 * iface,VARIANT_BOOL bFullScreen)739c2c66affSColin Finck static HRESULT WINAPI WebBrowser_put_FullScreen(IWebBrowser2 *iface, VARIANT_BOOL bFullScreen)
740c2c66affSColin Finck {
741c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
742c2c66affSColin Finck     VARIANTARG arg;
743c2c66affSColin Finck     DISPPARAMS dispparams = {&arg, NULL, 1, 0};
744c2c66affSColin Finck 
745c2c66affSColin Finck     /* In opposition to InternetExplorer, all we should do here is
746c2c66affSColin Finck      * inform the embedder about the fullscreen change. */
747c2c66affSColin Finck 
748c2c66affSColin Finck     TRACE("(%p)->(%x)\n", This, bFullScreen);
749c2c66affSColin Finck 
750c2c66affSColin Finck     This->full_screen = bFullScreen ? VARIANT_TRUE : VARIANT_FALSE;
751c2c66affSColin Finck 
752c2c66affSColin Finck     V_VT(&arg) = VT_BOOL;
753c2c66affSColin Finck     V_BOOL(&arg) = bFullScreen;
754c2c66affSColin Finck     call_sink(This->doc_host.cps.wbe2, DISPID_ONFULLSCREEN, &dispparams);
755c2c66affSColin Finck 
756c2c66affSColin Finck     return S_OK;
757c2c66affSColin Finck }
758c2c66affSColin Finck 
WebBrowser_Navigate2(IWebBrowser2 * iface,VARIANT * URL,VARIANT * Flags,VARIANT * TargetFrameName,VARIANT * PostData,VARIANT * Headers)759c2c66affSColin Finck static HRESULT WINAPI WebBrowser_Navigate2(IWebBrowser2 *iface, VARIANT *URL, VARIANT *Flags,
760c2c66affSColin Finck         VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
761c2c66affSColin Finck {
762c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
763c2c66affSColin Finck     LPCWSTR url;
764c2c66affSColin Finck 
765c2c66affSColin Finck     TRACE("(%p)->(%s %s %s %s %s)\n", This, debugstr_variant(URL), debugstr_variant(Flags),
766c2c66affSColin Finck           debugstr_variant(TargetFrameName), debugstr_variant(PostData), debugstr_variant(Headers));
767c2c66affSColin Finck 
768c2c66affSColin Finck     if(!This->client)
769c2c66affSColin Finck         return E_FAIL;
770c2c66affSColin Finck 
771c2c66affSColin Finck     if(!URL)
772c2c66affSColin Finck         return S_OK;
773c2c66affSColin Finck 
774c2c66affSColin Finck     switch (V_VT(URL))
775c2c66affSColin Finck     {
776c2c66affSColin Finck     case VT_BSTR:
777c2c66affSColin Finck         url = V_BSTR(URL);
778c2c66affSColin Finck         break;
779c2c66affSColin Finck     case VT_BSTR|VT_BYREF:
780c2c66affSColin Finck         url = *V_BSTRREF(URL);
781c2c66affSColin Finck         break;
782c2c66affSColin Finck     default:
783c2c66affSColin Finck         FIXME("Unsupported V_VT(URL) %d\n", V_VT(URL));
784c2c66affSColin Finck         return E_INVALIDARG;
785c2c66affSColin Finck     }
786c2c66affSColin Finck 
787c2c66affSColin Finck     return navigate_url(&This->doc_host, url, Flags, TargetFrameName, PostData, Headers);
788c2c66affSColin Finck }
789c2c66affSColin Finck 
WebBrowser_QueryStatusWB(IWebBrowser2 * iface,OLECMDID cmdID,OLECMDF * pcmdf)790c2c66affSColin Finck static HRESULT WINAPI WebBrowser_QueryStatusWB(IWebBrowser2 *iface, OLECMDID cmdID, OLECMDF *pcmdf)
791c2c66affSColin Finck {
792c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
793c2c66affSColin Finck     IOleCommandTarget *target = NULL;
794c2c66affSColin Finck     OLECMD ole_command[1];
795c2c66affSColin Finck     HRESULT hres;
796c2c66affSColin Finck 
797c2c66affSColin Finck     TRACE("(%p)->(%d %p)\n", This, cmdID, pcmdf);
798c2c66affSColin Finck 
799c2c66affSColin Finck     if (!pcmdf)
800c2c66affSColin Finck         return E_POINTER;
801c2c66affSColin Finck     ole_command[0].cmdID = cmdID;
802c2c66affSColin Finck     ole_command[0].cmdf = *pcmdf;
803c2c66affSColin Finck 
804c2c66affSColin Finck     if (This->container)
805c2c66affSColin Finck     {
806c2c66affSColin Finck         hres = IOleContainer_QueryInterface(This->container, &IID_IOleCommandTarget, (LPVOID*)&target);
807c2c66affSColin Finck         if(FAILED(hres))
808c2c66affSColin Finck             target = NULL;
809c2c66affSColin Finck     }
810c2c66affSColin Finck     if (!target && This->doc_host.document)
811c2c66affSColin Finck     {
812c2c66affSColin Finck         hres = IUnknown_QueryInterface(This->doc_host.document, &IID_IOleCommandTarget, (LPVOID*)&target);
813c2c66affSColin Finck         if(FAILED(hres))
814c2c66affSColin Finck             target = NULL;
815c2c66affSColin Finck     }
816c2c66affSColin Finck 
817c2c66affSColin Finck     if (!target)
818c2c66affSColin Finck         return E_UNEXPECTED;
819c2c66affSColin Finck 
820c2c66affSColin Finck     hres = IOleCommandTarget_QueryStatus(target, NULL, 1, ole_command, NULL);
821c2c66affSColin Finck     if (SUCCEEDED(hres))
822c2c66affSColin Finck         *pcmdf = ole_command[0].cmdf;
823c2c66affSColin Finck     if (hres == OLECMDERR_E_NOTSUPPORTED)
824c2c66affSColin Finck     {
825c2c66affSColin Finck         *pcmdf = 0;
826c2c66affSColin Finck         hres = S_OK;
827c2c66affSColin Finck     }
828c2c66affSColin Finck     IOleCommandTarget_Release(target);
829c2c66affSColin Finck 
830c2c66affSColin Finck     return hres;
831c2c66affSColin Finck }
832c2c66affSColin Finck 
WebBrowser_ExecWB(IWebBrowser2 * iface,OLECMDID cmdID,OLECMDEXECOPT cmdexecopt,VARIANT * pvaIn,VARIANT * pvaOut)833c2c66affSColin Finck static HRESULT WINAPI WebBrowser_ExecWB(IWebBrowser2 *iface, OLECMDID cmdID,
834c2c66affSColin Finck         OLECMDEXECOPT cmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
835c2c66affSColin Finck {
836c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
837c2c66affSColin Finck     IOleCommandTarget *target = NULL;
838c2c66affSColin Finck     HRESULT hres;
839c2c66affSColin Finck 
840c2c66affSColin Finck     TRACE("(%p)->(%d %d %s %p)\n", This, cmdID, cmdexecopt, debugstr_variant(pvaIn), pvaOut);
841c2c66affSColin Finck 
842c2c66affSColin Finck     if(This->container)
843c2c66affSColin Finck     {
844c2c66affSColin Finck         hres = IOleContainer_QueryInterface(This->container, &IID_IOleCommandTarget, (LPVOID*)&target);
845c2c66affSColin Finck         if(FAILED(hres))
846c2c66affSColin Finck             target = NULL;
847c2c66affSColin Finck     }
848c2c66affSColin Finck     if(!target && This->doc_host.document)
849c2c66affSColin Finck     {
850c2c66affSColin Finck         hres = IUnknown_QueryInterface(This->doc_host.document, &IID_IOleCommandTarget, (LPVOID*)&target);
851c2c66affSColin Finck         if(FAILED(hres))
852c2c66affSColin Finck             target = NULL;
853c2c66affSColin Finck     }
854c2c66affSColin Finck 
855c2c66affSColin Finck     if(!target)
856c2c66affSColin Finck         return E_UNEXPECTED;
857c2c66affSColin Finck 
858c2c66affSColin Finck     hres = IOleCommandTarget_Exec(target, NULL, cmdID, cmdexecopt, pvaIn, pvaOut);
859c2c66affSColin Finck     IOleCommandTarget_Release(target);
860c2c66affSColin Finck 
861c2c66affSColin Finck     return hres;
862c2c66affSColin Finck }
863c2c66affSColin Finck 
WebBrowser_ShowBrowserBar(IWebBrowser2 * iface,VARIANT * pvaClsid,VARIANT * pvarShow,VARIANT * pvarSize)864c2c66affSColin Finck static HRESULT WINAPI WebBrowser_ShowBrowserBar(IWebBrowser2 *iface, VARIANT *pvaClsid,
865c2c66affSColin Finck         VARIANT *pvarShow, VARIANT *pvarSize)
866c2c66affSColin Finck {
867c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
868c2c66affSColin Finck     FIXME("(%p)->(%s %s %s)\n", This, debugstr_variant(pvaClsid), debugstr_variant(pvarShow),
869c2c66affSColin Finck           debugstr_variant(pvarSize));
870c2c66affSColin Finck     return E_NOTIMPL;
871c2c66affSColin Finck }
872c2c66affSColin Finck 
WebBrowser_get_ReadyState(IWebBrowser2 * iface,READYSTATE * lpReadyState)873c2c66affSColin Finck static HRESULT WINAPI WebBrowser_get_ReadyState(IWebBrowser2 *iface, READYSTATE *lpReadyState)
874c2c66affSColin Finck {
875c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
876c2c66affSColin Finck 
877c2c66affSColin Finck     TRACE("(%p)->(%p)\n", This, lpReadyState);
878c2c66affSColin Finck 
879c2c66affSColin Finck     *lpReadyState = This->doc_host.ready_state;
880c2c66affSColin Finck     return S_OK;
881c2c66affSColin Finck }
882c2c66affSColin Finck 
WebBrowser_get_Offline(IWebBrowser2 * iface,VARIANT_BOOL * pbOffline)883c2c66affSColin Finck static HRESULT WINAPI WebBrowser_get_Offline(IWebBrowser2 *iface, VARIANT_BOOL *pbOffline)
884c2c66affSColin Finck {
885c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
886c2c66affSColin Finck 
887c2c66affSColin Finck     TRACE("(%p)->(%p)\n", This, pbOffline);
888c2c66affSColin Finck 
889c2c66affSColin Finck     *pbOffline = This->doc_host.offline;
890c2c66affSColin Finck     return S_OK;
891c2c66affSColin Finck }
892c2c66affSColin Finck 
WebBrowser_put_Offline(IWebBrowser2 * iface,VARIANT_BOOL bOffline)893c2c66affSColin Finck static HRESULT WINAPI WebBrowser_put_Offline(IWebBrowser2 *iface, VARIANT_BOOL bOffline)
894c2c66affSColin Finck {
895c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
896c2c66affSColin Finck 
897c2c66affSColin Finck     TRACE("(%p)->(%x)\n", This, bOffline);
898c2c66affSColin Finck 
899c2c66affSColin Finck     This->doc_host.offline = bOffline ? VARIANT_TRUE : VARIANT_FALSE;
900c2c66affSColin Finck     return S_OK;
901c2c66affSColin Finck }
902c2c66affSColin Finck 
WebBrowser_get_Silent(IWebBrowser2 * iface,VARIANT_BOOL * pbSilent)903c2c66affSColin Finck static HRESULT WINAPI WebBrowser_get_Silent(IWebBrowser2 *iface, VARIANT_BOOL *pbSilent)
904c2c66affSColin Finck {
905c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
906c2c66affSColin Finck 
907c2c66affSColin Finck     TRACE("(%p)->(%p)\n", This, pbSilent);
908c2c66affSColin Finck 
909c2c66affSColin Finck     *pbSilent = This->doc_host.silent;
910c2c66affSColin Finck     return S_OK;
911c2c66affSColin Finck }
912c2c66affSColin Finck 
WebBrowser_put_Silent(IWebBrowser2 * iface,VARIANT_BOOL bSilent)913c2c66affSColin Finck static HRESULT WINAPI WebBrowser_put_Silent(IWebBrowser2 *iface, VARIANT_BOOL bSilent)
914c2c66affSColin Finck {
915c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
916c2c66affSColin Finck 
917c2c66affSColin Finck     TRACE("(%p)->(%x)\n", This, bSilent);
918c2c66affSColin Finck 
919c2c66affSColin Finck     This->doc_host.silent = bSilent ? VARIANT_TRUE : VARIANT_FALSE;
920c2c66affSColin Finck     return S_OK;
921c2c66affSColin Finck }
922c2c66affSColin Finck 
WebBrowser_get_RegisterAsBrowser(IWebBrowser2 * iface,VARIANT_BOOL * pbRegister)923c2c66affSColin Finck static HRESULT WINAPI WebBrowser_get_RegisterAsBrowser(IWebBrowser2 *iface,
924c2c66affSColin Finck         VARIANT_BOOL *pbRegister)
925c2c66affSColin Finck {
926c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
927c2c66affSColin Finck 
928c2c66affSColin Finck     FIXME("(%p)->(%p)\n", This, pbRegister);
929c2c66affSColin Finck 
930c2c66affSColin Finck     *pbRegister = This->register_browser;
931c2c66affSColin Finck     return S_OK;
932c2c66affSColin Finck }
933c2c66affSColin Finck 
WebBrowser_put_RegisterAsBrowser(IWebBrowser2 * iface,VARIANT_BOOL bRegister)934c2c66affSColin Finck static HRESULT WINAPI WebBrowser_put_RegisterAsBrowser(IWebBrowser2 *iface,
935c2c66affSColin Finck         VARIANT_BOOL bRegister)
936c2c66affSColin Finck {
937c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
938c2c66affSColin Finck 
939c2c66affSColin Finck     FIXME("(%p)->(%x)\n", This, bRegister);
940c2c66affSColin Finck 
941c2c66affSColin Finck     This->register_browser = bRegister ? VARIANT_TRUE : VARIANT_FALSE;
942c2c66affSColin Finck     return S_OK;
943c2c66affSColin Finck }
944c2c66affSColin Finck 
WebBrowser_get_RegisterAsDropTarget(IWebBrowser2 * iface,VARIANT_BOOL * pbRegister)945c2c66affSColin Finck static HRESULT WINAPI WebBrowser_get_RegisterAsDropTarget(IWebBrowser2 *iface,
946c2c66affSColin Finck         VARIANT_BOOL *pbRegister)
947c2c66affSColin Finck {
948c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
949c2c66affSColin Finck 
950c2c66affSColin Finck     FIXME("(%p)->(%p)\n", This, pbRegister);
951c2c66affSColin Finck 
952c2c66affSColin Finck     if(!pbRegister)
953c2c66affSColin Finck         return E_INVALIDARG;
954c2c66affSColin Finck 
955c2c66affSColin Finck     *pbRegister=0;
956c2c66affSColin Finck     return S_OK;
957c2c66affSColin Finck }
958c2c66affSColin Finck 
WebBrowser_put_RegisterAsDropTarget(IWebBrowser2 * iface,VARIANT_BOOL bRegister)959c2c66affSColin Finck static HRESULT WINAPI WebBrowser_put_RegisterAsDropTarget(IWebBrowser2 *iface,
960c2c66affSColin Finck         VARIANT_BOOL bRegister)
961c2c66affSColin Finck {
962c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
963c2c66affSColin Finck     FIXME("(%p)->(%x)\n", This, bRegister);
964c2c66affSColin Finck     return S_OK;
965c2c66affSColin Finck }
966c2c66affSColin Finck 
WebBrowser_get_TheaterMode(IWebBrowser2 * iface,VARIANT_BOOL * pbRegister)967c2c66affSColin Finck static HRESULT WINAPI WebBrowser_get_TheaterMode(IWebBrowser2 *iface, VARIANT_BOOL *pbRegister)
968c2c66affSColin Finck {
969c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
970c2c66affSColin Finck 
971c2c66affSColin Finck     TRACE("(%p)->(%p)\n", This, pbRegister);
972c2c66affSColin Finck 
973c2c66affSColin Finck     *pbRegister = This->theater_mode;
974c2c66affSColin Finck     return S_OK;
975c2c66affSColin Finck }
976c2c66affSColin Finck 
WebBrowser_put_TheaterMode(IWebBrowser2 * iface,VARIANT_BOOL bRegister)977c2c66affSColin Finck static HRESULT WINAPI WebBrowser_put_TheaterMode(IWebBrowser2 *iface, VARIANT_BOOL bRegister)
978c2c66affSColin Finck {
979c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
980c2c66affSColin Finck     VARIANTARG arg;
981c2c66affSColin Finck     DISPPARAMS dispparams = {&arg, NULL, 1, 0};
982c2c66affSColin Finck 
983c2c66affSColin Finck     TRACE("(%p)->(%x)\n", This, bRegister);
984c2c66affSColin Finck 
985c2c66affSColin Finck     This->theater_mode = bRegister ? VARIANT_TRUE : VARIANT_FALSE;
986c2c66affSColin Finck 
987c2c66affSColin Finck     /* In opposition to InternetExplorer, all we should do here is
988c2c66affSColin Finck      * inform the embedder about the theater mode change. */
989c2c66affSColin Finck 
990c2c66affSColin Finck     V_VT(&arg) = VT_BOOL;
991c2c66affSColin Finck     V_BOOL(&arg) = bRegister;
992c2c66affSColin Finck     call_sink(This->doc_host.cps.wbe2, DISPID_ONTHEATERMODE, &dispparams);
993c2c66affSColin Finck 
994c2c66affSColin Finck     return S_OK;
995c2c66affSColin Finck }
996c2c66affSColin Finck 
WebBrowser_get_AddressBar(IWebBrowser2 * iface,VARIANT_BOOL * Value)997c2c66affSColin Finck static HRESULT WINAPI WebBrowser_get_AddressBar(IWebBrowser2 *iface, VARIANT_BOOL *Value)
998c2c66affSColin Finck {
999c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
1000c2c66affSColin Finck 
1001c2c66affSColin Finck     TRACE("(%p)->(%p)\n", This, Value);
1002c2c66affSColin Finck 
1003c2c66affSColin Finck     *Value = This->address_bar;
1004c2c66affSColin Finck     return S_OK;
1005c2c66affSColin Finck }
1006c2c66affSColin Finck 
WebBrowser_put_AddressBar(IWebBrowser2 * iface,VARIANT_BOOL Value)1007c2c66affSColin Finck static HRESULT WINAPI WebBrowser_put_AddressBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
1008c2c66affSColin Finck {
1009c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
1010c2c66affSColin Finck     VARIANTARG arg;
1011c2c66affSColin Finck     DISPPARAMS dispparams = {&arg, NULL, 1, 0};
1012c2c66affSColin Finck 
1013c2c66affSColin Finck     TRACE("(%p)->(%x)\n", This, Value);
1014c2c66affSColin Finck 
1015c2c66affSColin Finck     This->address_bar = Value ? VARIANT_TRUE : VARIANT_FALSE;
1016c2c66affSColin Finck 
1017c2c66affSColin Finck     /* In opposition to InternetExplorer, all we should do here is
1018c2c66affSColin Finck      * inform the embedder about the address bar change. */
1019c2c66affSColin Finck 
1020c2c66affSColin Finck     V_VT(&arg) = VT_BOOL;
1021c2c66affSColin Finck     V_BOOL(&arg) = Value;
1022c2c66affSColin Finck     call_sink(This->doc_host.cps.wbe2, DISPID_ONADDRESSBAR, &dispparams);
1023c2c66affSColin Finck 
1024c2c66affSColin Finck     return S_OK;
1025c2c66affSColin Finck }
1026c2c66affSColin Finck 
WebBrowser_get_Resizable(IWebBrowser2 * iface,VARIANT_BOOL * Value)1027c2c66affSColin Finck static HRESULT WINAPI WebBrowser_get_Resizable(IWebBrowser2 *iface, VARIANT_BOOL *Value)
1028c2c66affSColin Finck {
1029c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
1030c2c66affSColin Finck 
1031c2c66affSColin Finck     TRACE("(%p)->(%p)\n", This, Value);
1032c2c66affSColin Finck 
1033c2c66affSColin Finck     /* It's InternetExplorer object's method. We have nothing to do here. */
1034c2c66affSColin Finck     return E_NOTIMPL;
1035c2c66affSColin Finck }
1036c2c66affSColin Finck 
WebBrowser_put_Resizable(IWebBrowser2 * iface,VARIANT_BOOL Value)1037c2c66affSColin Finck static HRESULT WINAPI WebBrowser_put_Resizable(IWebBrowser2 *iface, VARIANT_BOOL Value)
1038c2c66affSColin Finck {
1039c2c66affSColin Finck     WebBrowser *This = impl_from_IWebBrowser2(iface);
1040c2c66affSColin Finck     VARIANTARG arg;
1041c2c66affSColin Finck     DISPPARAMS dispparams = {&arg, NULL, 1, 0};
1042c2c66affSColin Finck 
1043c2c66affSColin Finck     TRACE("(%p)->(%x)\n", This, Value);
1044c2c66affSColin Finck 
1045c2c66affSColin Finck     /* In opposition to InternetExplorer, all we should do here is
1046c2c66affSColin Finck      * inform the embedder about the resizable change. */
1047c2c66affSColin Finck 
1048c2c66affSColin Finck     V_VT(&arg) = VT_BOOL;
1049c2c66affSColin Finck     V_BOOL(&arg) = Value;
1050c2c66affSColin Finck     call_sink(This->doc_host.cps.wbe2, DISPID_WINDOWSETRESIZABLE, &dispparams);
1051c2c66affSColin Finck 
1052c2c66affSColin Finck     return S_OK;
1053c2c66affSColin Finck }
1054c2c66affSColin Finck 
1055c2c66affSColin Finck static const IWebBrowser2Vtbl WebBrowser2Vtbl =
1056c2c66affSColin Finck {
1057c2c66affSColin Finck     WebBrowser_QueryInterface,
1058c2c66affSColin Finck     WebBrowser_AddRef,
1059c2c66affSColin Finck     WebBrowser_Release,
1060c2c66affSColin Finck     WebBrowser_GetTypeInfoCount,
1061c2c66affSColin Finck     WebBrowser_GetTypeInfo,
1062c2c66affSColin Finck     WebBrowser_GetIDsOfNames,
1063c2c66affSColin Finck     WebBrowser_Invoke,
1064c2c66affSColin Finck     WebBrowser_GoBack,
1065c2c66affSColin Finck     WebBrowser_GoForward,
1066c2c66affSColin Finck     WebBrowser_GoHome,
1067c2c66affSColin Finck     WebBrowser_GoSearch,
1068c2c66affSColin Finck     WebBrowser_Navigate,
1069c2c66affSColin Finck     WebBrowser_Refresh,
1070c2c66affSColin Finck     WebBrowser_Refresh2,
1071c2c66affSColin Finck     WebBrowser_Stop,
1072c2c66affSColin Finck     WebBrowser_get_Application,
1073c2c66affSColin Finck     WebBrowser_get_Parent,
1074c2c66affSColin Finck     WebBrowser_get_Container,
1075c2c66affSColin Finck     WebBrowser_get_Document,
1076c2c66affSColin Finck     WebBrowser_get_TopLevelContainer,
1077c2c66affSColin Finck     WebBrowser_get_Type,
1078c2c66affSColin Finck     WebBrowser_get_Left,
1079c2c66affSColin Finck     WebBrowser_put_Left,
1080c2c66affSColin Finck     WebBrowser_get_Top,
1081c2c66affSColin Finck     WebBrowser_put_Top,
1082c2c66affSColin Finck     WebBrowser_get_Width,
1083c2c66affSColin Finck     WebBrowser_put_Width,
1084c2c66affSColin Finck     WebBrowser_get_Height,
1085c2c66affSColin Finck     WebBrowser_put_Height,
1086c2c66affSColin Finck     WebBrowser_get_LocationName,
1087c2c66affSColin Finck     WebBrowser_get_LocationURL,
1088c2c66affSColin Finck     WebBrowser_get_Busy,
1089c2c66affSColin Finck     WebBrowser_Quit,
1090c2c66affSColin Finck     WebBrowser_ClientToWindow,
1091c2c66affSColin Finck     WebBrowser_PutProperty,
1092c2c66affSColin Finck     WebBrowser_GetProperty,
1093c2c66affSColin Finck     WebBrowser_get_Name,
1094c2c66affSColin Finck     WebBrowser_get_HWND,
1095c2c66affSColin Finck     WebBrowser_get_FullName,
1096c2c66affSColin Finck     WebBrowser_get_Path,
1097c2c66affSColin Finck     WebBrowser_get_Visible,
1098c2c66affSColin Finck     WebBrowser_put_Visible,
1099c2c66affSColin Finck     WebBrowser_get_StatusBar,
1100c2c66affSColin Finck     WebBrowser_put_StatusBar,
1101c2c66affSColin Finck     WebBrowser_get_StatusText,
1102c2c66affSColin Finck     WebBrowser_put_StatusText,
1103c2c66affSColin Finck     WebBrowser_get_ToolBar,
1104c2c66affSColin Finck     WebBrowser_put_ToolBar,
1105c2c66affSColin Finck     WebBrowser_get_MenuBar,
1106c2c66affSColin Finck     WebBrowser_put_MenuBar,
1107c2c66affSColin Finck     WebBrowser_get_FullScreen,
1108c2c66affSColin Finck     WebBrowser_put_FullScreen,
1109c2c66affSColin Finck     WebBrowser_Navigate2,
1110c2c66affSColin Finck     WebBrowser_QueryStatusWB,
1111c2c66affSColin Finck     WebBrowser_ExecWB,
1112c2c66affSColin Finck     WebBrowser_ShowBrowserBar,
1113c2c66affSColin Finck     WebBrowser_get_ReadyState,
1114c2c66affSColin Finck     WebBrowser_get_Offline,
1115c2c66affSColin Finck     WebBrowser_put_Offline,
1116c2c66affSColin Finck     WebBrowser_get_Silent,
1117c2c66affSColin Finck     WebBrowser_put_Silent,
1118c2c66affSColin Finck     WebBrowser_get_RegisterAsBrowser,
1119c2c66affSColin Finck     WebBrowser_put_RegisterAsBrowser,
1120c2c66affSColin Finck     WebBrowser_get_RegisterAsDropTarget,
1121c2c66affSColin Finck     WebBrowser_put_RegisterAsDropTarget,
1122c2c66affSColin Finck     WebBrowser_get_TheaterMode,
1123c2c66affSColin Finck     WebBrowser_put_TheaterMode,
1124c2c66affSColin Finck     WebBrowser_get_AddressBar,
1125c2c66affSColin Finck     WebBrowser_put_AddressBar,
1126c2c66affSColin Finck     WebBrowser_get_Resizable,
1127c2c66affSColin Finck     WebBrowser_put_Resizable
1128c2c66affSColin Finck };
1129c2c66affSColin Finck 
impl_from_IServiceProvider(IServiceProvider * iface)1130c2c66affSColin Finck static inline WebBrowser *impl_from_IServiceProvider(IServiceProvider *iface)
1131c2c66affSColin Finck {
1132c2c66affSColin Finck     return CONTAINING_RECORD(iface, WebBrowser, IServiceProvider_iface);
1133c2c66affSColin Finck }
1134c2c66affSColin Finck 
WBServiceProvider_QueryInterface(IServiceProvider * iface,REFIID riid,LPVOID * ppv)1135c2c66affSColin Finck static HRESULT WINAPI WBServiceProvider_QueryInterface(IServiceProvider *iface,
1136c2c66affSColin Finck             REFIID riid, LPVOID *ppv)
1137c2c66affSColin Finck {
1138c2c66affSColin Finck     WebBrowser *This = impl_from_IServiceProvider(iface);
1139c2c66affSColin Finck     return IWebBrowser2_QueryInterface(&This->IWebBrowser2_iface, riid, ppv);
1140c2c66affSColin Finck }
1141c2c66affSColin Finck 
WBServiceProvider_AddRef(IServiceProvider * iface)1142c2c66affSColin Finck static ULONG WINAPI WBServiceProvider_AddRef(IServiceProvider *iface)
1143c2c66affSColin Finck {
1144c2c66affSColin Finck     WebBrowser *This = impl_from_IServiceProvider(iface);
1145c2c66affSColin Finck     return IWebBrowser2_AddRef(&This->IWebBrowser2_iface);
1146c2c66affSColin Finck }
1147c2c66affSColin Finck 
WBServiceProvider_Release(IServiceProvider * iface)1148c2c66affSColin Finck static ULONG WINAPI WBServiceProvider_Release(IServiceProvider *iface)
1149c2c66affSColin Finck {
1150c2c66affSColin Finck     WebBrowser *This = impl_from_IServiceProvider(iface);
1151c2c66affSColin Finck     return IWebBrowser2_Release(&This->IWebBrowser2_iface);
1152c2c66affSColin Finck }
1153c2c66affSColin Finck 
WBServiceProvider_QueryService(IServiceProvider * iface,REFGUID guidService,REFIID riid,void ** ppv)1154c2c66affSColin Finck static HRESULT STDMETHODCALLTYPE WBServiceProvider_QueryService(IServiceProvider *iface,
1155c2c66affSColin Finck             REFGUID guidService, REFIID riid, void **ppv)
1156c2c66affSColin Finck {
1157c2c66affSColin Finck     WebBrowser *This = impl_from_IServiceProvider(iface);
1158c2c66affSColin Finck 
1159c2c66affSColin Finck     if(IsEqualGUID(&SID_SHTMLWindow, riid)) {
1160c2c66affSColin Finck         TRACE("(%p)->(SID_SHTMLWindow)\n", This);
1161c2c66affSColin Finck         return IHTMLWindow2_QueryInterface(&This->doc_host.html_window.IHTMLWindow2_iface, riid, ppv);
1162c2c66affSColin Finck     }
1163c2c66affSColin Finck 
1164c2c66affSColin Finck     if(IsEqualGUID(&IID_IBrowserService2, riid)) {
1165c2c66affSColin Finck         TRACE("(%p)->(IID_IBrowserService2 return E_FAIL)\n", This);
1166c2c66affSColin Finck         *ppv = NULL;
1167c2c66affSColin Finck         return E_FAIL;
1168c2c66affSColin Finck     }
1169c2c66affSColin Finck 
1170c2c66affSColin Finck     FIXME("(%p)->(%s, %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv);
1171c2c66affSColin Finck     *ppv = NULL;
1172c2c66affSColin Finck     return E_NOINTERFACE;
1173c2c66affSColin Finck }
1174c2c66affSColin Finck 
1175c2c66affSColin Finck static const IServiceProviderVtbl ServiceProviderVtbl =
1176c2c66affSColin Finck {
1177c2c66affSColin Finck     WBServiceProvider_QueryInterface,
1178c2c66affSColin Finck     WBServiceProvider_AddRef,
1179c2c66affSColin Finck     WBServiceProvider_Release,
1180c2c66affSColin Finck     WBServiceProvider_QueryService
1181c2c66affSColin Finck };
1182c2c66affSColin Finck 
impl_from_DocHost(DocHost * iface)1183c2c66affSColin Finck static inline WebBrowser *impl_from_DocHost(DocHost *iface)
1184c2c66affSColin Finck {
1185c2c66affSColin Finck     return CONTAINING_RECORD(iface, WebBrowser, doc_host);
1186c2c66affSColin Finck }
1187c2c66affSColin Finck 
WebBrowser_addref(DocHost * iface)1188c2c66affSColin Finck static ULONG WebBrowser_addref(DocHost *iface)
1189c2c66affSColin Finck {
1190c2c66affSColin Finck     WebBrowser *This = impl_from_DocHost(iface);
1191c2c66affSColin Finck     return IWebBrowser2_AddRef(&This->IWebBrowser2_iface);
1192c2c66affSColin Finck }
1193c2c66affSColin Finck 
WebBrowser_release(DocHost * iface)1194c2c66affSColin Finck static ULONG WebBrowser_release(DocHost *iface)
1195c2c66affSColin Finck {
1196c2c66affSColin Finck     WebBrowser *This = impl_from_DocHost(iface);
1197c2c66affSColin Finck     return IWebBrowser2_Release(&This->IWebBrowser2_iface);
1198c2c66affSColin Finck }
1199c2c66affSColin Finck 
DocHostContainer_get_docobj_rect(DocHost * This,RECT * rc)1200c2c66affSColin Finck static void DocHostContainer_get_docobj_rect(DocHost *This, RECT *rc)
1201c2c66affSColin Finck {
1202c2c66affSColin Finck     GetClientRect(This->frame_hwnd, rc);
1203c2c66affSColin Finck }
1204c2c66affSColin Finck 
DocHostContainer_set_status_text(DocHost * This,const WCHAR * text)1205c2c66affSColin Finck static HRESULT DocHostContainer_set_status_text(DocHost *This, const WCHAR *text)
1206c2c66affSColin Finck {
1207c2c66affSColin Finck     return E_NOTIMPL;
1208c2c66affSColin Finck }
1209c2c66affSColin Finck 
DocHostContainer_on_command_state_change(DocHost * This,LONG command,BOOL enable)1210c2c66affSColin Finck static void DocHostContainer_on_command_state_change(DocHost *This, LONG command, BOOL enable)
1211c2c66affSColin Finck {
1212c2c66affSColin Finck }
1213c2c66affSColin Finck 
DocHostContainer_set_url(DocHost * This,const WCHAR * url)1214c2c66affSColin Finck static void DocHostContainer_set_url(DocHost *This, const WCHAR *url)
1215c2c66affSColin Finck {
1216c2c66affSColin Finck }
1217c2c66affSColin Finck 
1218c2c66affSColin Finck static const IDocHostContainerVtbl DocHostContainerVtbl = {
1219c2c66affSColin Finck     WebBrowser_addref,
1220c2c66affSColin Finck     WebBrowser_release,
1221c2c66affSColin Finck     DocHostContainer_get_docobj_rect,
1222c2c66affSColin Finck     DocHostContainer_set_status_text,
1223c2c66affSColin Finck     DocHostContainer_on_command_state_change,
1224c2c66affSColin Finck     DocHostContainer_set_url
1225c2c66affSColin Finck };
1226c2c66affSColin Finck 
create_webbrowser(int version,IUnknown * outer,REFIID riid,void ** ppv)1227c2c66affSColin Finck static HRESULT create_webbrowser(int version, IUnknown *outer, REFIID riid, void **ppv)
1228c2c66affSColin Finck {
1229c2c66affSColin Finck     WebBrowser *ret;
1230c2c66affSColin Finck     HRESULT hres;
1231c2c66affSColin Finck 
1232c2c66affSColin Finck     TRACE("(%p %s %p) version=%d\n", outer, debugstr_guid(riid), ppv, version);
1233c2c66affSColin Finck 
1234c2c66affSColin Finck     ret = heap_alloc_zero(sizeof(WebBrowser));
1235c2c66affSColin Finck 
1236c2c66affSColin Finck     ret->IWebBrowser2_iface.lpVtbl = &WebBrowser2Vtbl;
1237c2c66affSColin Finck     ret->IServiceProvider_iface.lpVtbl = &ServiceProviderVtbl;
1238c2c66affSColin Finck     ret->ref = 1;
1239c2c66affSColin Finck     ret->version = version;
1240c2c66affSColin Finck 
1241c2c66affSColin Finck     DocHost_Init(&ret->doc_host, &ret->IWebBrowser2_iface, &DocHostContainerVtbl);
1242c2c66affSColin Finck 
1243c2c66affSColin Finck     ret->visible = VARIANT_TRUE;
1244c2c66affSColin Finck     ret->menu_bar = VARIANT_TRUE;
1245c2c66affSColin Finck     ret->address_bar = VARIANT_TRUE;
1246c2c66affSColin Finck     ret->status_bar = VARIANT_TRUE;
1247c2c66affSColin Finck     ret->tool_bar = VARIANT_TRUE;
1248c2c66affSColin Finck 
1249c2c66affSColin Finck     WebBrowser_OleObject_Init(ret);
1250c2c66affSColin Finck     WebBrowser_ViewObject_Init(ret);
1251c2c66affSColin Finck     WebBrowser_Persist_Init(ret);
1252c2c66affSColin Finck     WebBrowser_ClassInfo_Init(ret);
1253c2c66affSColin Finck 
1254c2c66affSColin Finck     HlinkFrame_Init(&ret->hlink_frame, (IUnknown*)&ret->IWebBrowser2_iface, &ret->doc_host);
1255c2c66affSColin Finck 
1256c2c66affSColin Finck     lock_module();
1257c2c66affSColin Finck 
1258c2c66affSColin Finck     hres = IWebBrowser2_QueryInterface(&ret->IWebBrowser2_iface, riid, ppv);
1259c2c66affSColin Finck 
1260c2c66affSColin Finck     IWebBrowser2_Release(&ret->IWebBrowser2_iface);
1261c2c66affSColin Finck     return hres;
1262c2c66affSColin Finck }
1263c2c66affSColin Finck 
WebBrowserV1_Create(IClassFactory * iface,IUnknown * pOuter,REFIID riid,void ** ppv)1264c2c66affSColin Finck HRESULT WINAPI WebBrowserV1_Create(IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **ppv)
1265c2c66affSColin Finck {
1266c2c66affSColin Finck     return create_webbrowser(1, pOuter, riid, ppv);
1267c2c66affSColin Finck }
1268c2c66affSColin Finck 
WebBrowser_Create(IClassFactory * iface,IUnknown * pOuter,REFIID riid,void ** ppv)1269c2c66affSColin Finck HRESULT WINAPI WebBrowser_Create(IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **ppv)
1270c2c66affSColin Finck {
1271c2c66affSColin Finck     return create_webbrowser(2, pOuter, riid, ppv);
1272c2c66affSColin Finck }
1273