2 * Copyright 2008 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
28 #include "wine/debug.h"
30 #include "mshtml_private.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
34 typedef struct HTMLPluginsCollection HTMLPluginsCollection
;
35 typedef struct HTMLMimeTypesCollection HTMLMimeTypesCollection
;
39 IOmNavigator IOmNavigator_iface
;
43 HTMLPluginsCollection
*plugins
;
44 HTMLMimeTypesCollection
*mime_types
;
49 IHTMLDOMImplementation IHTMLDOMImplementation_iface
;
52 } HTMLDOMImplementation
;
54 static inline HTMLDOMImplementation
*impl_from_IHTMLDOMImplementation(IHTMLDOMImplementation
*iface
)
56 return CONTAINING_RECORD(iface
, HTMLDOMImplementation
, IHTMLDOMImplementation_iface
);
59 static HRESULT WINAPI
HTMLDOMImplementation_QueryInterface(IHTMLDOMImplementation
*iface
, REFIID riid
, void **ppv
)
61 HTMLDOMImplementation
*This
= impl_from_IHTMLDOMImplementation(iface
);
63 TRACE("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
65 if(IsEqualGUID(&IID_IUnknown
, riid
) || IsEqualGUID(&IID_IHTMLDOMImplementation
, riid
)) {
66 *ppv
= &This
->IHTMLDOMImplementation_iface
;
67 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
68 return *ppv
? S_OK
: E_NOINTERFACE
;
70 WARN("Unsupported interface %s\n", debugstr_mshtml_guid(riid
));
75 IUnknown_AddRef((IUnknown
*)*ppv
);
79 static ULONG WINAPI
HTMLDOMImplementation_AddRef(IHTMLDOMImplementation
*iface
)
81 HTMLDOMImplementation
*This
= impl_from_IHTMLDOMImplementation(iface
);
82 LONG ref
= InterlockedIncrement(&This
->ref
);
84 TRACE("(%p) ref=%d\n", This
, ref
);
89 static ULONG WINAPI
HTMLDOMImplementation_Release(IHTMLDOMImplementation
*iface
)
91 HTMLDOMImplementation
*This
= impl_from_IHTMLDOMImplementation(iface
);
92 LONG ref
= InterlockedDecrement(&This
->ref
);
94 TRACE("(%p) ref=%d\n", This
, ref
);
97 release_dispex(&This
->dispex
);
104 static HRESULT WINAPI
HTMLDOMImplementation_GetTypeInfoCount(IHTMLDOMImplementation
*iface
, UINT
*pctinfo
)
106 HTMLDOMImplementation
*This
= impl_from_IHTMLDOMImplementation(iface
);
108 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
111 static HRESULT WINAPI
HTMLDOMImplementation_GetTypeInfo(IHTMLDOMImplementation
*iface
, UINT iTInfo
,
112 LCID lcid
, ITypeInfo
**ppTInfo
)
114 HTMLDOMImplementation
*This
= impl_from_IHTMLDOMImplementation(iface
);
116 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
119 static HRESULT WINAPI
HTMLDOMImplementation_GetIDsOfNames(IHTMLDOMImplementation
*iface
, REFIID riid
,
120 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
122 HTMLDOMImplementation
*This
= impl_from_IHTMLDOMImplementation(iface
);
124 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
,
125 cNames
, lcid
, rgDispId
);
128 static HRESULT WINAPI
HTMLDOMImplementation_Invoke(IHTMLDOMImplementation
*iface
, DISPID dispIdMember
,
129 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
130 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
132 HTMLDOMImplementation
*This
= impl_from_IHTMLDOMImplementation(iface
);
134 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
,
135 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
138 static HRESULT WINAPI
HTMLDOMImplementation_hasFeature(IHTMLDOMImplementation
*iface
, BSTR feature
,
139 VARIANT version
, VARIANT_BOOL
*pfHasFeature
)
141 HTMLDOMImplementation
*This
= impl_from_IHTMLDOMImplementation(iface
);
143 FIXME("(%p)->(%s %s %p) returning false\n", This
, debugstr_w(feature
), debugstr_variant(&version
), pfHasFeature
);
145 *pfHasFeature
= VARIANT_FALSE
;
149 static const IHTMLDOMImplementationVtbl HTMLDOMImplementationVtbl
= {
150 HTMLDOMImplementation_QueryInterface
,
151 HTMLDOMImplementation_AddRef
,
152 HTMLDOMImplementation_Release
,
153 HTMLDOMImplementation_GetTypeInfoCount
,
154 HTMLDOMImplementation_GetTypeInfo
,
155 HTMLDOMImplementation_GetIDsOfNames
,
156 HTMLDOMImplementation_Invoke
,
157 HTMLDOMImplementation_hasFeature
160 static const tid_t HTMLDOMImplementation_iface_tids
[] = {
161 IHTMLDOMImplementation_tid
,
164 static dispex_static_data_t HTMLDOMImplementation_dispex
= {
166 IHTMLDOMImplementation_tid
,
168 HTMLDOMImplementation_iface_tids
171 HRESULT
create_dom_implementation(IHTMLDOMImplementation
**ret
)
173 HTMLDOMImplementation
*dom_implementation
;
175 dom_implementation
= heap_alloc_zero(sizeof(*dom_implementation
));
176 if(!dom_implementation
)
177 return E_OUTOFMEMORY
;
179 dom_implementation
->IHTMLDOMImplementation_iface
.lpVtbl
= &HTMLDOMImplementationVtbl
;
180 dom_implementation
->ref
= 1;
182 init_dispex(&dom_implementation
->dispex
, (IUnknown
*)&dom_implementation
->IHTMLDOMImplementation_iface
,
183 &HTMLDOMImplementation_dispex
);
185 *ret
= &dom_implementation
->IHTMLDOMImplementation_iface
;
189 static inline OmHistory
*impl_from_IOmHistory(IOmHistory
*iface
)
191 return CONTAINING_RECORD(iface
, OmHistory
, IOmHistory_iface
);
194 static HRESULT WINAPI
OmHistory_QueryInterface(IOmHistory
*iface
, REFIID riid
, void **ppv
)
196 OmHistory
*This
= impl_from_IOmHistory(iface
);
198 TRACE("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
200 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
201 *ppv
= &This
->IOmHistory_iface
;
202 }else if(IsEqualGUID(&IID_IOmHistory
, riid
)) {
203 *ppv
= &This
->IOmHistory_iface
;
204 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
205 return *ppv
? S_OK
: E_NOINTERFACE
;
207 WARN("Unsupported interface %s\n", debugstr_mshtml_guid(riid
));
209 return E_NOINTERFACE
;
212 IUnknown_AddRef((IUnknown
*)*ppv
);
216 static ULONG WINAPI
OmHistory_AddRef(IOmHistory
*iface
)
218 OmHistory
*This
= impl_from_IOmHistory(iface
);
219 LONG ref
= InterlockedIncrement(&This
->ref
);
221 TRACE("(%p) ref=%d\n", This
, ref
);
226 static ULONG WINAPI
OmHistory_Release(IOmHistory
*iface
)
228 OmHistory
*This
= impl_from_IOmHistory(iface
);
229 LONG ref
= InterlockedDecrement(&This
->ref
);
231 TRACE("(%p) ref=%d\n", This
, ref
);
234 release_dispex(&This
->dispex
);
241 static HRESULT WINAPI
OmHistory_GetTypeInfoCount(IOmHistory
*iface
, UINT
*pctinfo
)
243 OmHistory
*This
= impl_from_IOmHistory(iface
);
244 FIXME("(%p)->(%p)\n", This
, pctinfo
);
248 static HRESULT WINAPI
OmHistory_GetTypeInfo(IOmHistory
*iface
, UINT iTInfo
,
249 LCID lcid
, ITypeInfo
**ppTInfo
)
251 OmHistory
*This
= impl_from_IOmHistory(iface
);
253 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
256 static HRESULT WINAPI
OmHistory_GetIDsOfNames(IOmHistory
*iface
, REFIID riid
, LPOLESTR
*rgszNames
, UINT cNames
,
257 LCID lcid
, DISPID
*rgDispId
)
259 OmHistory
*This
= impl_from_IOmHistory(iface
);
261 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
265 static HRESULT WINAPI
OmHistory_Invoke(IOmHistory
*iface
, DISPID dispIdMember
, REFIID riid
, LCID lcid
,
266 WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
268 OmHistory
*This
= impl_from_IOmHistory(iface
);
270 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
271 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
274 static HRESULT WINAPI
OmHistory_get_length(IOmHistory
*iface
, short *p
)
276 OmHistory
*This
= impl_from_IOmHistory(iface
);
278 TRACE("(%p)->(%p)\n", This
, p
);
280 if(!This
->window
|| !This
->window
->base
.outer_window
->doc_obj
281 || !This
->window
->base
.outer_window
->doc_obj
->travel_log
) {
284 *p
= ITravelLog_CountEntries(This
->window
->base
.outer_window
->doc_obj
->travel_log
,
285 This
->window
->base
.outer_window
->doc_obj
->browser_service
);
290 static HRESULT WINAPI
OmHistory_back(IOmHistory
*iface
, VARIANT
*pvargdistance
)
292 OmHistory
*This
= impl_from_IOmHistory(iface
);
293 FIXME("(%p)->(%s)\n", This
, debugstr_variant(pvargdistance
));
297 static HRESULT WINAPI
OmHistory_forward(IOmHistory
*iface
, VARIANT
*pvargdistance
)
299 OmHistory
*This
= impl_from_IOmHistory(iface
);
300 FIXME("(%p)->(%s)\n", This
, debugstr_variant(pvargdistance
));
304 static HRESULT WINAPI
OmHistory_go(IOmHistory
*iface
, VARIANT
*pvargdistance
)
306 OmHistory
*This
= impl_from_IOmHistory(iface
);
307 FIXME("(%p)->(%s)\n", This
, debugstr_variant(pvargdistance
));
311 static const IOmHistoryVtbl OmHistoryVtbl
= {
312 OmHistory_QueryInterface
,
315 OmHistory_GetTypeInfoCount
,
316 OmHistory_GetTypeInfo
,
317 OmHistory_GetIDsOfNames
,
319 OmHistory_get_length
,
325 static const tid_t OmHistory_iface_tids
[] = {
329 static dispex_static_data_t OmHistory_dispex
= {
337 HRESULT
create_history(HTMLInnerWindow
*window
, OmHistory
**ret
)
341 history
= heap_alloc_zero(sizeof(*history
));
343 return E_OUTOFMEMORY
;
345 init_dispex(&history
->dispex
, (IUnknown
*)&history
->IOmHistory_iface
, &OmHistory_dispex
);
346 history
->IOmHistory_iface
.lpVtbl
= &OmHistoryVtbl
;
349 history
->window
= window
;
355 struct HTMLPluginsCollection
{
357 IHTMLPluginsCollection IHTMLPluginsCollection_iface
;
361 OmNavigator
*navigator
;
364 static inline HTMLPluginsCollection
*impl_from_IHTMLPluginsCollection(IHTMLPluginsCollection
*iface
)
366 return CONTAINING_RECORD(iface
, HTMLPluginsCollection
, IHTMLPluginsCollection_iface
);
369 static HRESULT WINAPI
HTMLPluginsCollection_QueryInterface(IHTMLPluginsCollection
*iface
, REFIID riid
, void **ppv
)
371 HTMLPluginsCollection
*This
= impl_from_IHTMLPluginsCollection(iface
);
373 TRACE("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
375 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
376 *ppv
= &This
->IHTMLPluginsCollection_iface
;
377 }else if(IsEqualGUID(&IID_IHTMLPluginsCollection
, riid
)) {
378 *ppv
= &This
->IHTMLPluginsCollection_iface
;
379 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
380 return *ppv
? S_OK
: E_NOINTERFACE
;
383 WARN("Unsupported interface %s\n", debugstr_mshtml_guid(riid
));
384 return E_NOINTERFACE
;
387 IUnknown_AddRef((IUnknown
*)*ppv
);
391 static ULONG WINAPI
HTMLPluginsCollection_AddRef(IHTMLPluginsCollection
*iface
)
393 HTMLPluginsCollection
*This
= impl_from_IHTMLPluginsCollection(iface
);
394 LONG ref
= InterlockedIncrement(&This
->ref
);
396 TRACE("(%p) ref=%d\n", This
, ref
);
401 static ULONG WINAPI
HTMLPluginsCollection_Release(IHTMLPluginsCollection
*iface
)
403 HTMLPluginsCollection
*This
= impl_from_IHTMLPluginsCollection(iface
);
404 LONG ref
= InterlockedDecrement(&This
->ref
);
406 TRACE("(%p) ref=%d\n", This
, ref
);
410 This
->navigator
->plugins
= NULL
;
411 release_dispex(&This
->dispex
);
418 static HRESULT WINAPI
HTMLPluginsCollection_GetTypeInfoCount(IHTMLPluginsCollection
*iface
, UINT
*pctinfo
)
420 HTMLPluginsCollection
*This
= impl_from_IHTMLPluginsCollection(iface
);
421 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
424 static HRESULT WINAPI
HTMLPluginsCollection_GetTypeInfo(IHTMLPluginsCollection
*iface
, UINT iTInfo
,
425 LCID lcid
, ITypeInfo
**ppTInfo
)
427 HTMLPluginsCollection
*This
= impl_from_IHTMLPluginsCollection(iface
);
428 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
431 static HRESULT WINAPI
HTMLPluginsCollection_GetIDsOfNames(IHTMLPluginsCollection
*iface
, REFIID riid
,
432 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
434 HTMLPluginsCollection
*This
= impl_from_IHTMLPluginsCollection(iface
);
435 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
439 static HRESULT WINAPI
HTMLPluginsCollection_Invoke(IHTMLPluginsCollection
*iface
, DISPID dispIdMember
,
440 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
441 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
443 HTMLPluginsCollection
*This
= impl_from_IHTMLPluginsCollection(iface
);
444 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
445 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
448 static HRESULT WINAPI
HTMLPluginsCollection_get_length(IHTMLPluginsCollection
*iface
, LONG
*p
)
450 HTMLPluginsCollection
*This
= impl_from_IHTMLPluginsCollection(iface
);
452 TRACE("(%p)->(%p)\n", This
, p
);
454 /* IE always returns 0 here */
459 static HRESULT WINAPI
HTMLPluginsCollection_refresh(IHTMLPluginsCollection
*iface
, VARIANT_BOOL reload
)
461 HTMLPluginsCollection
*This
= impl_from_IHTMLPluginsCollection(iface
);
463 TRACE("(%p)->(%x)\n", This
, reload
);
465 /* Nothing to do here. */
469 static const IHTMLPluginsCollectionVtbl HTMLPluginsCollectionVtbl
= {
470 HTMLPluginsCollection_QueryInterface
,
471 HTMLPluginsCollection_AddRef
,
472 HTMLPluginsCollection_Release
,
473 HTMLPluginsCollection_GetTypeInfoCount
,
474 HTMLPluginsCollection_GetTypeInfo
,
475 HTMLPluginsCollection_GetIDsOfNames
,
476 HTMLPluginsCollection_Invoke
,
477 HTMLPluginsCollection_get_length
,
478 HTMLPluginsCollection_refresh
481 static const tid_t HTMLPluginsCollection_iface_tids
[] = {
482 IHTMLPluginsCollection_tid
,
485 static dispex_static_data_t HTMLPluginsCollection_dispex
= {
489 HTMLPluginsCollection_iface_tids
492 static HRESULT
create_plugins_collection(OmNavigator
*navigator
, HTMLPluginsCollection
**ret
)
494 HTMLPluginsCollection
*col
;
496 col
= heap_alloc_zero(sizeof(*col
));
498 return E_OUTOFMEMORY
;
500 col
->IHTMLPluginsCollection_iface
.lpVtbl
= &HTMLPluginsCollectionVtbl
;
502 col
->navigator
= navigator
;
504 init_dispex(&col
->dispex
, (IUnknown
*)&col
->IHTMLPluginsCollection_iface
,
505 &HTMLPluginsCollection_dispex
);
511 struct HTMLMimeTypesCollection
{
513 IHTMLMimeTypesCollection IHTMLMimeTypesCollection_iface
;
517 OmNavigator
*navigator
;
520 static inline HTMLMimeTypesCollection
*impl_from_IHTMLMimeTypesCollection(IHTMLMimeTypesCollection
*iface
)
522 return CONTAINING_RECORD(iface
, HTMLMimeTypesCollection
, IHTMLMimeTypesCollection_iface
);
525 static HRESULT WINAPI
HTMLMimeTypesCollection_QueryInterface(IHTMLMimeTypesCollection
*iface
, REFIID riid
, void **ppv
)
527 HTMLMimeTypesCollection
*This
= impl_from_IHTMLMimeTypesCollection(iface
);
529 TRACE("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
531 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
532 *ppv
= &This
->IHTMLMimeTypesCollection_iface
;
533 }else if(IsEqualGUID(&IID_IHTMLMimeTypesCollection
, riid
)) {
534 *ppv
= &This
->IHTMLMimeTypesCollection_iface
;
535 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
536 return *ppv
? S_OK
: E_NOINTERFACE
;
538 WARN("Unsupported interface %s\n", debugstr_mshtml_guid(riid
));
540 return E_NOINTERFACE
;
543 IUnknown_AddRef((IUnknown
*)*ppv
);
547 static ULONG WINAPI
HTMLMimeTypesCollection_AddRef(IHTMLMimeTypesCollection
*iface
)
549 HTMLMimeTypesCollection
*This
= impl_from_IHTMLMimeTypesCollection(iface
);
550 LONG ref
= InterlockedIncrement(&This
->ref
);
552 TRACE("(%p) ref=%d\n", This
, ref
);
557 static ULONG WINAPI
HTMLMimeTypesCollection_Release(IHTMLMimeTypesCollection
*iface
)
559 HTMLMimeTypesCollection
*This
= impl_from_IHTMLMimeTypesCollection(iface
);
560 LONG ref
= InterlockedDecrement(&This
->ref
);
562 TRACE("(%p) ref=%d\n", This
, ref
);
566 This
->navigator
->mime_types
= NULL
;
567 release_dispex(&This
->dispex
);
574 static HRESULT WINAPI
HTMLMimeTypesCollection_GetTypeInfoCount(IHTMLMimeTypesCollection
*iface
, UINT
*pctinfo
)
576 HTMLMimeTypesCollection
*This
= impl_from_IHTMLMimeTypesCollection(iface
);
577 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
580 static HRESULT WINAPI
HTMLMimeTypesCollection_GetTypeInfo(IHTMLMimeTypesCollection
*iface
, UINT iTInfo
,
581 LCID lcid
, ITypeInfo
**ppTInfo
)
583 HTMLMimeTypesCollection
*This
= impl_from_IHTMLMimeTypesCollection(iface
);
584 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
587 static HRESULT WINAPI
HTMLMimeTypesCollection_GetIDsOfNames(IHTMLMimeTypesCollection
*iface
, REFIID riid
,
588 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
590 HTMLMimeTypesCollection
*This
= impl_from_IHTMLMimeTypesCollection(iface
);
591 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
595 static HRESULT WINAPI
HTMLMimeTypesCollection_Invoke(IHTMLMimeTypesCollection
*iface
, DISPID dispIdMember
,
596 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
597 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
599 HTMLMimeTypesCollection
*This
= impl_from_IHTMLMimeTypesCollection(iface
);
600 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
601 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
604 static HRESULT WINAPI
HTMLMimeTypesCollection_get_length(IHTMLMimeTypesCollection
*iface
, LONG
*p
)
606 HTMLMimeTypesCollection
*This
= impl_from_IHTMLMimeTypesCollection(iface
);
608 TRACE("(%p)->(%p)\n", This
, p
);
610 /* This is just a stub for compatibility with other browser in IE */
615 static const IHTMLMimeTypesCollectionVtbl HTMLMimeTypesCollectionVtbl
= {
616 HTMLMimeTypesCollection_QueryInterface
,
617 HTMLMimeTypesCollection_AddRef
,
618 HTMLMimeTypesCollection_Release
,
619 HTMLMimeTypesCollection_GetTypeInfoCount
,
620 HTMLMimeTypesCollection_GetTypeInfo
,
621 HTMLMimeTypesCollection_GetIDsOfNames
,
622 HTMLMimeTypesCollection_Invoke
,
623 HTMLMimeTypesCollection_get_length
626 static const tid_t HTMLMimeTypesCollection_iface_tids
[] = {
627 IHTMLMimeTypesCollection_tid
,
630 static dispex_static_data_t HTMLMimeTypesCollection_dispex
= {
632 IHTMLMimeTypesCollection_tid
,
634 HTMLMimeTypesCollection_iface_tids
637 static HRESULT
create_mime_types_collection(OmNavigator
*navigator
, HTMLMimeTypesCollection
**ret
)
639 HTMLMimeTypesCollection
*col
;
641 col
= heap_alloc_zero(sizeof(*col
));
643 return E_OUTOFMEMORY
;
645 col
->IHTMLMimeTypesCollection_iface
.lpVtbl
= &HTMLMimeTypesCollectionVtbl
;
647 col
->navigator
= navigator
;
649 init_dispex(&col
->dispex
, (IUnknown
*)&col
->IHTMLMimeTypesCollection_iface
,
650 &HTMLMimeTypesCollection_dispex
);
656 static inline OmNavigator
*impl_from_IOmNavigator(IOmNavigator
*iface
)
658 return CONTAINING_RECORD(iface
, OmNavigator
, IOmNavigator_iface
);
661 static HRESULT WINAPI
OmNavigator_QueryInterface(IOmNavigator
*iface
, REFIID riid
, void **ppv
)
663 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
665 TRACE("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
667 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
668 *ppv
= &This
->IOmNavigator_iface
;
669 }else if(IsEqualGUID(&IID_IOmNavigator
, riid
)) {
670 *ppv
= &This
->IOmNavigator_iface
;
671 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
672 return *ppv
? S_OK
: E_NOINTERFACE
;
674 WARN("Unsupported interface %s\n", debugstr_mshtml_guid(riid
));
676 return E_NOINTERFACE
;
679 IUnknown_AddRef((IUnknown
*)*ppv
);
683 static ULONG WINAPI
OmNavigator_AddRef(IOmNavigator
*iface
)
685 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
686 LONG ref
= InterlockedIncrement(&This
->ref
);
688 TRACE("(%p) ref=%d\n", This
, ref
);
693 static ULONG WINAPI
OmNavigator_Release(IOmNavigator
*iface
)
695 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
696 LONG ref
= InterlockedDecrement(&This
->ref
);
698 TRACE("(%p) ref=%d\n", This
, ref
);
702 This
->plugins
->navigator
= NULL
;
704 This
->mime_types
->navigator
= NULL
;
705 release_dispex(&This
->dispex
);
712 static HRESULT WINAPI
OmNavigator_GetTypeInfoCount(IOmNavigator
*iface
, UINT
*pctinfo
)
714 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
715 FIXME("(%p)->(%p)\n", This
, pctinfo
);
719 static HRESULT WINAPI
OmNavigator_GetTypeInfo(IOmNavigator
*iface
, UINT iTInfo
,
720 LCID lcid
, ITypeInfo
**ppTInfo
)
722 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
724 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
727 static HRESULT WINAPI
OmNavigator_GetIDsOfNames(IOmNavigator
*iface
, REFIID riid
,
728 LPOLESTR
*rgszNames
, UINT cNames
,
729 LCID lcid
, DISPID
*rgDispId
)
731 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
733 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
737 static HRESULT WINAPI
OmNavigator_Invoke(IOmNavigator
*iface
, DISPID dispIdMember
,
738 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
739 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
741 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
743 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
744 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
747 static HRESULT WINAPI
OmNavigator_get_appCodeName(IOmNavigator
*iface
, BSTR
*p
)
749 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
751 static const WCHAR mozillaW
[] = {'M','o','z','i','l','l','a',0};
753 TRACE("(%p)->(%p)\n", This
, p
);
755 *p
= SysAllocString(mozillaW
);
759 static HRESULT WINAPI
OmNavigator_get_appName(IOmNavigator
*iface
, BSTR
*p
)
761 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
763 static const WCHAR app_nameW
[] =
764 {'M','i','c','r','o','s','o','f','t',' ',
765 'I','n','t','e','r','n','e','t',' ',
766 'E','x','p','l','o','r','e','r',0};
768 TRACE("(%p)->(%p)\n", This
, p
);
770 *p
= SysAllocString(app_nameW
);
772 return E_OUTOFMEMORY
;
777 static HRESULT WINAPI
OmNavigator_get_appVersion(IOmNavigator
*iface
, BSTR
*p
)
779 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
781 char user_agent
[512];
785 TRACE("(%p)->(%p)\n", This
, p
);
787 size
= sizeof(user_agent
);
788 hres
= ObtainUserAgentString(0, user_agent
, &size
);
792 if(strncmp(user_agent
, "Mozilla/", 8)) {
793 FIXME("Unsupported user agent\n");
797 size
= MultiByteToWideChar(CP_ACP
, 0, user_agent
+8, -1, NULL
, 0);
798 *p
= SysAllocStringLen(NULL
, size
-1);
800 return E_OUTOFMEMORY
;
802 MultiByteToWideChar(CP_ACP
, 0, user_agent
+8, -1, *p
, size
);
806 static HRESULT WINAPI
OmNavigator_get_userAgent(IOmNavigator
*iface
, BSTR
*p
)
808 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
809 char user_agent
[512];
813 TRACE("(%p)->(%p)\n", This
, p
);
815 size
= sizeof(user_agent
);
816 hres
= ObtainUserAgentString(0, user_agent
, &size
);
820 size
= MultiByteToWideChar(CP_ACP
, 0, user_agent
, -1, NULL
, 0);
821 *p
= SysAllocStringLen(NULL
, size
-1);
823 return E_OUTOFMEMORY
;
825 MultiByteToWideChar(CP_ACP
, 0, user_agent
, -1, *p
, size
);
829 static HRESULT WINAPI
OmNavigator_javaEnabled(IOmNavigator
*iface
, VARIANT_BOOL
*enabled
)
831 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
833 FIXME("(%p)->(%p) semi-stub\n", This
, enabled
);
835 *enabled
= VARIANT_TRUE
;
839 static HRESULT WINAPI
OmNavigator_taintEnabled(IOmNavigator
*iface
, VARIANT_BOOL
*enabled
)
841 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
842 FIXME("(%p)->(%p)\n", This
, enabled
);
846 static HRESULT WINAPI
OmNavigator_get_mimeTypes(IOmNavigator
*iface
, IHTMLMimeTypesCollection
**p
)
848 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
850 TRACE("(%p)->(%p)\n", This
, p
);
852 if(!This
->mime_types
) {
855 hres
= create_mime_types_collection(This
, &This
->mime_types
);
859 IHTMLMimeTypesCollection_AddRef(&This
->mime_types
->IHTMLMimeTypesCollection_iface
);
862 *p
= &This
->mime_types
->IHTMLMimeTypesCollection_iface
;
866 static HRESULT WINAPI
OmNavigator_get_plugins(IOmNavigator
*iface
, IHTMLPluginsCollection
**p
)
868 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
870 TRACE("(%p)->(%p)\n", This
, p
);
875 hres
= create_plugins_collection(This
, &This
->plugins
);
879 IHTMLPluginsCollection_AddRef(&This
->plugins
->IHTMLPluginsCollection_iface
);
882 *p
= &This
->plugins
->IHTMLPluginsCollection_iface
;
886 static HRESULT WINAPI
OmNavigator_get_cookieEnabled(IOmNavigator
*iface
, VARIANT_BOOL
*p
)
888 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
890 WARN("(%p)->(%p) semi-stub\n", This
, p
);
896 static HRESULT WINAPI
OmNavigator_get_opsProfile(IOmNavigator
*iface
, IHTMLOpsProfile
**p
)
898 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
899 FIXME("(%p)->(%p)\n", This
, p
);
903 static HRESULT WINAPI
OmNavigator_toString(IOmNavigator
*iface
, BSTR
*String
)
905 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
907 static const WCHAR objectW
[] = {'[','o','b','j','e','c','t',']',0};
909 TRACE("(%p)->(%p)\n", This
, String
);
914 *String
= SysAllocString(objectW
);
915 return *String
? S_OK
: E_OUTOFMEMORY
;
918 static HRESULT WINAPI
OmNavigator_get_cpuClass(IOmNavigator
*iface
, BSTR
*p
)
920 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
922 static const WCHAR cpu_classW
[] =
929 TRACE("(%p)->(%p)\n", This
, p
);
931 *p
= SysAllocString(cpu_classW
);
932 return *p
? S_OK
: E_OUTOFMEMORY
;
935 static HRESULT
get_language_string(LCID lcid
, BSTR
*p
)
940 len
= LCIDToLocaleName(lcid
, NULL
, 0, 0);
942 WARN("LCIDToLocaleName failed: %u\n", GetLastError());
946 ret
= SysAllocStringLen(NULL
, len
-1);
948 return E_OUTOFMEMORY
;
950 len
= LCIDToLocaleName(lcid
, ret
, len
, 0);
952 WARN("LCIDToLocaleName failed: %u\n", GetLastError());
961 static HRESULT WINAPI
OmNavigator_get_systemLanguage(IOmNavigator
*iface
, BSTR
*p
)
963 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
965 TRACE("(%p)->(%p)\n", This
, p
);
967 return get_language_string(LOCALE_SYSTEM_DEFAULT
, p
);
970 static HRESULT WINAPI
OmNavigator_get_browserLanguage(IOmNavigator
*iface
, BSTR
*p
)
972 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
974 TRACE("(%p)->(%p)\n", This
, p
);
976 return get_language_string(GetUserDefaultUILanguage(), p
);
979 static HRESULT WINAPI
OmNavigator_get_userLanguage(IOmNavigator
*iface
, BSTR
*p
)
981 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
983 TRACE("(%p)->(%p)\n", This
, p
);
985 return get_language_string(LOCALE_USER_DEFAULT
, p
);
988 static HRESULT WINAPI
OmNavigator_get_platform(IOmNavigator
*iface
, BSTR
*p
)
990 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
993 static const WCHAR platformW
[] = {'W','i','n','6','4',0};
995 static const WCHAR platformW
[] = {'W','i','n','3','2',0};
998 TRACE("(%p)->(%p)\n", This
, p
);
1000 *p
= SysAllocString(platformW
);
1004 static HRESULT WINAPI
OmNavigator_get_appMinorVersion(IOmNavigator
*iface
, BSTR
*p
)
1006 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
1008 static const WCHAR zeroW
[] = {'0',0};
1010 TRACE("(%p)->(%p)\n", This
, p
);
1012 /* NOTE: MSIE returns "0" or values like ";SP2;". Returning "0" should be enough. */
1013 *p
= SysAllocString(zeroW
);
1017 static HRESULT WINAPI
OmNavigator_get_connectionSpeed(IOmNavigator
*iface
, LONG
*p
)
1019 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
1020 FIXME("(%p)->(%p)\n", This
, p
);
1024 static HRESULT WINAPI
OmNavigator_get_onLine(IOmNavigator
*iface
, VARIANT_BOOL
*p
)
1026 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
1028 WARN("(%p)->(%p) semi-stub, returning true\n", This
, p
);
1034 static HRESULT WINAPI
OmNavigator_get_userProfile(IOmNavigator
*iface
, IHTMLOpsProfile
**p
)
1036 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
1037 FIXME("(%p)->(%p)\n", This
, p
);
1041 static const IOmNavigatorVtbl OmNavigatorVtbl
= {
1042 OmNavigator_QueryInterface
,
1044 OmNavigator_Release
,
1045 OmNavigator_GetTypeInfoCount
,
1046 OmNavigator_GetTypeInfo
,
1047 OmNavigator_GetIDsOfNames
,
1049 OmNavigator_get_appCodeName
,
1050 OmNavigator_get_appName
,
1051 OmNavigator_get_appVersion
,
1052 OmNavigator_get_userAgent
,
1053 OmNavigator_javaEnabled
,
1054 OmNavigator_taintEnabled
,
1055 OmNavigator_get_mimeTypes
,
1056 OmNavigator_get_plugins
,
1057 OmNavigator_get_cookieEnabled
,
1058 OmNavigator_get_opsProfile
,
1059 OmNavigator_toString
,
1060 OmNavigator_get_cpuClass
,
1061 OmNavigator_get_systemLanguage
,
1062 OmNavigator_get_browserLanguage
,
1063 OmNavigator_get_userLanguage
,
1064 OmNavigator_get_platform
,
1065 OmNavigator_get_appMinorVersion
,
1066 OmNavigator_get_connectionSpeed
,
1067 OmNavigator_get_onLine
,
1068 OmNavigator_get_userProfile
1071 static const tid_t OmNavigator_iface_tids
[] = {
1075 static dispex_static_data_t OmNavigator_dispex
= {
1077 DispHTMLNavigator_tid
,
1079 OmNavigator_iface_tids
1082 IOmNavigator
*OmNavigator_Create(void)
1086 ret
= heap_alloc_zero(sizeof(*ret
));
1090 ret
->IOmNavigator_iface
.lpVtbl
= &OmNavigatorVtbl
;
1093 init_dispex(&ret
->dispex
, (IUnknown
*)&ret
->IOmNavigator_iface
, &OmNavigator_dispex
);
1095 return &ret
->IOmNavigator_iface
;