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
;
47 static inline OmHistory
*impl_from_IOmHistory(IOmHistory
*iface
)
49 return CONTAINING_RECORD(iface
, OmHistory
, IOmHistory_iface
);
52 static HRESULT WINAPI
OmHistory_QueryInterface(IOmHistory
*iface
, REFIID riid
, void **ppv
)
54 OmHistory
*This
= impl_from_IOmHistory(iface
);
58 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
59 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
60 *ppv
= &This
->IOmHistory_iface
;
61 }else if(IsEqualGUID(&IID_IOmHistory
, riid
)) {
62 TRACE("(%p)->(IID_IOmHistory %p)\n", This
, ppv
);
63 *ppv
= &This
->IOmHistory_iface
;
64 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
65 return *ppv
? S_OK
: E_NOINTERFACE
;
69 IUnknown_AddRef((IUnknown
*)*ppv
);
73 WARN("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
77 static ULONG WINAPI
OmHistory_AddRef(IOmHistory
*iface
)
79 OmHistory
*This
= impl_from_IOmHistory(iface
);
80 LONG ref
= InterlockedIncrement(&This
->ref
);
82 TRACE("(%p) ref=%d\n", This
, ref
);
87 static ULONG WINAPI
OmHistory_Release(IOmHistory
*iface
)
89 OmHistory
*This
= impl_from_IOmHistory(iface
);
90 LONG ref
= InterlockedDecrement(&This
->ref
);
92 TRACE("(%p) ref=%d\n", This
, ref
);
95 release_dispex(&This
->dispex
);
102 static HRESULT WINAPI
OmHistory_GetTypeInfoCount(IOmHistory
*iface
, UINT
*pctinfo
)
104 OmHistory
*This
= impl_from_IOmHistory(iface
);
105 FIXME("(%p)->(%p)\n", This
, pctinfo
);
109 static HRESULT WINAPI
OmHistory_GetTypeInfo(IOmHistory
*iface
, UINT iTInfo
,
110 LCID lcid
, ITypeInfo
**ppTInfo
)
112 OmHistory
*This
= impl_from_IOmHistory(iface
);
114 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
117 static HRESULT WINAPI
OmHistory_GetIDsOfNames(IOmHistory
*iface
, REFIID riid
, LPOLESTR
*rgszNames
, UINT cNames
,
118 LCID lcid
, DISPID
*rgDispId
)
120 OmHistory
*This
= impl_from_IOmHistory(iface
);
122 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
126 static HRESULT WINAPI
OmHistory_Invoke(IOmHistory
*iface
, DISPID dispIdMember
, REFIID riid
, LCID lcid
,
127 WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
129 OmHistory
*This
= impl_from_IOmHistory(iface
);
131 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
132 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
135 static HRESULT WINAPI
OmHistory_get_length(IOmHistory
*iface
, short *p
)
137 OmHistory
*This
= impl_from_IOmHistory(iface
);
139 TRACE("(%p)->(%p)\n", This
, p
);
141 if(!This
->window
|| !This
->window
->base
.outer_window
->doc_obj
142 || !This
->window
->base
.outer_window
->doc_obj
->travel_log
) {
145 *p
= ITravelLog_CountEntries(This
->window
->base
.outer_window
->doc_obj
->travel_log
,
146 This
->window
->base
.outer_window
->doc_obj
->browser_service
);
151 static HRESULT WINAPI
OmHistory_back(IOmHistory
*iface
, VARIANT
*pvargdistance
)
153 OmHistory
*This
= impl_from_IOmHistory(iface
);
154 FIXME("(%p)->(%s)\n", This
, debugstr_variant(pvargdistance
));
158 static HRESULT WINAPI
OmHistory_forward(IOmHistory
*iface
, VARIANT
*pvargdistance
)
160 OmHistory
*This
= impl_from_IOmHistory(iface
);
161 FIXME("(%p)->(%s)\n", This
, debugstr_variant(pvargdistance
));
165 static HRESULT WINAPI
OmHistory_go(IOmHistory
*iface
, VARIANT
*pvargdistance
)
167 OmHistory
*This
= impl_from_IOmHistory(iface
);
168 FIXME("(%p)->(%s)\n", This
, debugstr_variant(pvargdistance
));
172 static const IOmHistoryVtbl OmHistoryVtbl
= {
173 OmHistory_QueryInterface
,
176 OmHistory_GetTypeInfoCount
,
177 OmHistory_GetTypeInfo
,
178 OmHistory_GetIDsOfNames
,
180 OmHistory_get_length
,
186 static const tid_t OmHistory_iface_tids
[] = {
190 static dispex_static_data_t OmHistory_dispex
= {
198 HRESULT
create_history(HTMLInnerWindow
*window
, OmHistory
**ret
)
202 history
= heap_alloc_zero(sizeof(*history
));
204 return E_OUTOFMEMORY
;
206 init_dispex(&history
->dispex
, (IUnknown
*)&history
->IOmHistory_iface
, &OmHistory_dispex
);
207 history
->IOmHistory_iface
.lpVtbl
= &OmHistoryVtbl
;
210 history
->window
= window
;
216 struct HTMLPluginsCollection
{
218 IHTMLPluginsCollection IHTMLPluginsCollection_iface
;
222 OmNavigator
*navigator
;
225 static inline HTMLPluginsCollection
*impl_from_IHTMLPluginsCollection(IHTMLPluginsCollection
*iface
)
227 return CONTAINING_RECORD(iface
, HTMLPluginsCollection
, IHTMLPluginsCollection_iface
);
230 static HRESULT WINAPI
HTMLPluginsCollection_QueryInterface(IHTMLPluginsCollection
*iface
, REFIID riid
, void **ppv
)
232 HTMLPluginsCollection
*This
= impl_from_IHTMLPluginsCollection(iface
);
234 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
235 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
236 *ppv
= &This
->IHTMLPluginsCollection_iface
;
237 }else if(IsEqualGUID(&IID_IHTMLPluginsCollection
, riid
)) {
238 TRACE("(%p)->(IID_IHTMLPluginCollection %p)\n", This
, ppv
);
239 *ppv
= &This
->IHTMLPluginsCollection_iface
;
240 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
241 return *ppv
? S_OK
: E_NOINTERFACE
;
244 WARN("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
245 return E_NOINTERFACE
;
248 IUnknown_AddRef((IUnknown
*)*ppv
);
252 static ULONG WINAPI
HTMLPluginsCollection_AddRef(IHTMLPluginsCollection
*iface
)
254 HTMLPluginsCollection
*This
= impl_from_IHTMLPluginsCollection(iface
);
255 LONG ref
= InterlockedIncrement(&This
->ref
);
257 TRACE("(%p) ref=%d\n", This
, ref
);
262 static ULONG WINAPI
HTMLPluginsCollection_Release(IHTMLPluginsCollection
*iface
)
264 HTMLPluginsCollection
*This
= impl_from_IHTMLPluginsCollection(iface
);
265 LONG ref
= InterlockedDecrement(&This
->ref
);
267 TRACE("(%p) ref=%d\n", This
, ref
);
271 This
->navigator
->plugins
= NULL
;
272 release_dispex(&This
->dispex
);
279 static HRESULT WINAPI
HTMLPluginsCollection_GetTypeInfoCount(IHTMLPluginsCollection
*iface
, UINT
*pctinfo
)
281 HTMLPluginsCollection
*This
= impl_from_IHTMLPluginsCollection(iface
);
282 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
285 static HRESULT WINAPI
HTMLPluginsCollection_GetTypeInfo(IHTMLPluginsCollection
*iface
, UINT iTInfo
,
286 LCID lcid
, ITypeInfo
**ppTInfo
)
288 HTMLPluginsCollection
*This
= impl_from_IHTMLPluginsCollection(iface
);
289 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
292 static HRESULT WINAPI
HTMLPluginsCollection_GetIDsOfNames(IHTMLPluginsCollection
*iface
, REFIID riid
,
293 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
295 HTMLPluginsCollection
*This
= impl_from_IHTMLPluginsCollection(iface
);
296 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
300 static HRESULT WINAPI
HTMLPluginsCollection_Invoke(IHTMLPluginsCollection
*iface
, DISPID dispIdMember
,
301 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
302 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
304 HTMLPluginsCollection
*This
= impl_from_IHTMLPluginsCollection(iface
);
305 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
306 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
309 static HRESULT WINAPI
HTMLPluginsCollection_get_length(IHTMLPluginsCollection
*iface
, LONG
*p
)
311 HTMLPluginsCollection
*This
= impl_from_IHTMLPluginsCollection(iface
);
313 TRACE("(%p)->(%p)\n", This
, p
);
315 /* IE always returns 0 here */
320 static HRESULT WINAPI
HTMLPluginsCollection_refresh(IHTMLPluginsCollection
*iface
, VARIANT_BOOL reload
)
322 HTMLPluginsCollection
*This
= impl_from_IHTMLPluginsCollection(iface
);
323 FIXME("(%p)->(%x)\n", This
, reload
);
327 static const IHTMLPluginsCollectionVtbl HTMLPluginsCollectionVtbl
= {
328 HTMLPluginsCollection_QueryInterface
,
329 HTMLPluginsCollection_AddRef
,
330 HTMLPluginsCollection_Release
,
331 HTMLPluginsCollection_GetTypeInfoCount
,
332 HTMLPluginsCollection_GetTypeInfo
,
333 HTMLPluginsCollection_GetIDsOfNames
,
334 HTMLPluginsCollection_Invoke
,
335 HTMLPluginsCollection_get_length
,
336 HTMLPluginsCollection_refresh
339 static const tid_t HTMLPluginsCollection_iface_tids
[] = {
340 IHTMLPluginsCollection_tid
,
343 static dispex_static_data_t HTMLPluginsCollection_dispex
= {
347 HTMLPluginsCollection_iface_tids
350 static HRESULT
create_plugins_collection(OmNavigator
*navigator
, HTMLPluginsCollection
**ret
)
352 HTMLPluginsCollection
*col
;
354 col
= heap_alloc_zero(sizeof(*col
));
356 return E_OUTOFMEMORY
;
358 col
->IHTMLPluginsCollection_iface
.lpVtbl
= &HTMLPluginsCollectionVtbl
;
360 col
->navigator
= navigator
;
362 init_dispex(&col
->dispex
, (IUnknown
*)&col
->IHTMLPluginsCollection_iface
,
363 &HTMLPluginsCollection_dispex
);
369 struct HTMLMimeTypesCollection
{
371 IHTMLMimeTypesCollection IHTMLMimeTypesCollection_iface
;
375 OmNavigator
*navigator
;
378 static inline HTMLMimeTypesCollection
*impl_from_IHTMLMimeTypesCollection(IHTMLMimeTypesCollection
*iface
)
380 return CONTAINING_RECORD(iface
, HTMLMimeTypesCollection
, IHTMLMimeTypesCollection_iface
);
383 static HRESULT WINAPI
HTMLMimeTypesCollection_QueryInterface(IHTMLMimeTypesCollection
*iface
, REFIID riid
, void **ppv
)
385 HTMLMimeTypesCollection
*This
= impl_from_IHTMLMimeTypesCollection(iface
);
387 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
388 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
389 *ppv
= &This
->IHTMLMimeTypesCollection_iface
;
390 }else if(IsEqualGUID(&IID_IHTMLMimeTypesCollection
, riid
)) {
391 TRACE("(%p)->(IID_IHTMLMimeTypesCollection %p)\n", This
, ppv
);
392 *ppv
= &This
->IHTMLMimeTypesCollection_iface
;
393 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
394 return *ppv
? S_OK
: E_NOINTERFACE
;
397 WARN("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
398 return E_NOINTERFACE
;
401 IUnknown_AddRef((IUnknown
*)*ppv
);
405 static ULONG WINAPI
HTMLMimeTypesCollection_AddRef(IHTMLMimeTypesCollection
*iface
)
407 HTMLMimeTypesCollection
*This
= impl_from_IHTMLMimeTypesCollection(iface
);
408 LONG ref
= InterlockedIncrement(&This
->ref
);
410 TRACE("(%p) ref=%d\n", This
, ref
);
415 static ULONG WINAPI
HTMLMimeTypesCollection_Release(IHTMLMimeTypesCollection
*iface
)
417 HTMLMimeTypesCollection
*This
= impl_from_IHTMLMimeTypesCollection(iface
);
418 LONG ref
= InterlockedDecrement(&This
->ref
);
420 TRACE("(%p) ref=%d\n", This
, ref
);
424 This
->navigator
->mime_types
= NULL
;
425 release_dispex(&This
->dispex
);
432 static HRESULT WINAPI
HTMLMimeTypesCollection_GetTypeInfoCount(IHTMLMimeTypesCollection
*iface
, UINT
*pctinfo
)
434 HTMLMimeTypesCollection
*This
= impl_from_IHTMLMimeTypesCollection(iface
);
435 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
438 static HRESULT WINAPI
HTMLMimeTypesCollection_GetTypeInfo(IHTMLMimeTypesCollection
*iface
, UINT iTInfo
,
439 LCID lcid
, ITypeInfo
**ppTInfo
)
441 HTMLMimeTypesCollection
*This
= impl_from_IHTMLMimeTypesCollection(iface
);
442 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
445 static HRESULT WINAPI
HTMLMimeTypesCollection_GetIDsOfNames(IHTMLMimeTypesCollection
*iface
, REFIID riid
,
446 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
448 HTMLMimeTypesCollection
*This
= impl_from_IHTMLMimeTypesCollection(iface
);
449 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
453 static HRESULT WINAPI
HTMLMimeTypesCollection_Invoke(IHTMLMimeTypesCollection
*iface
, DISPID dispIdMember
,
454 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
455 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
457 HTMLMimeTypesCollection
*This
= impl_from_IHTMLMimeTypesCollection(iface
);
458 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
459 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
462 static HRESULT WINAPI
HTMLMimeTypesCollection_get_length(IHTMLMimeTypesCollection
*iface
, LONG
*p
)
464 HTMLMimeTypesCollection
*This
= impl_from_IHTMLMimeTypesCollection(iface
);
466 TRACE("(%p)->(%p)\n", This
, p
);
468 /* This is just a stub for compatibility with other browser in IE */
473 static const IHTMLMimeTypesCollectionVtbl HTMLMimeTypesCollectionVtbl
= {
474 HTMLMimeTypesCollection_QueryInterface
,
475 HTMLMimeTypesCollection_AddRef
,
476 HTMLMimeTypesCollection_Release
,
477 HTMLMimeTypesCollection_GetTypeInfoCount
,
478 HTMLMimeTypesCollection_GetTypeInfo
,
479 HTMLMimeTypesCollection_GetIDsOfNames
,
480 HTMLMimeTypesCollection_Invoke
,
481 HTMLMimeTypesCollection_get_length
484 static const tid_t HTMLMimeTypesCollection_iface_tids
[] = {
485 IHTMLMimeTypesCollection_tid
,
488 static dispex_static_data_t HTMLMimeTypesCollection_dispex
= {
490 IHTMLMimeTypesCollection_tid
,
492 HTMLMimeTypesCollection_iface_tids
495 static HRESULT
create_mime_types_collection(OmNavigator
*navigator
, HTMLMimeTypesCollection
**ret
)
497 HTMLMimeTypesCollection
*col
;
499 col
= heap_alloc_zero(sizeof(*col
));
501 return E_OUTOFMEMORY
;
503 col
->IHTMLMimeTypesCollection_iface
.lpVtbl
= &HTMLMimeTypesCollectionVtbl
;
505 col
->navigator
= navigator
;
507 init_dispex(&col
->dispex
, (IUnknown
*)&col
->IHTMLMimeTypesCollection_iface
,
508 &HTMLMimeTypesCollection_dispex
);
514 static inline OmNavigator
*impl_from_IOmNavigator(IOmNavigator
*iface
)
516 return CONTAINING_RECORD(iface
, OmNavigator
, IOmNavigator_iface
);
519 static HRESULT WINAPI
OmNavigator_QueryInterface(IOmNavigator
*iface
, REFIID riid
, void **ppv
)
521 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
525 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
526 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
527 *ppv
= &This
->IOmNavigator_iface
;
528 }else if(IsEqualGUID(&IID_IOmNavigator
, riid
)) {
529 TRACE("(%p)->(IID_IOmNavigator %p)\n", This
, ppv
);
530 *ppv
= &This
->IOmNavigator_iface
;
531 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
532 return *ppv
? S_OK
: E_NOINTERFACE
;
536 IUnknown_AddRef((IUnknown
*)*ppv
);
540 WARN("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
541 return E_NOINTERFACE
;
544 static ULONG WINAPI
OmNavigator_AddRef(IOmNavigator
*iface
)
546 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
547 LONG ref
= InterlockedIncrement(&This
->ref
);
549 TRACE("(%p) ref=%d\n", This
, ref
);
554 static ULONG WINAPI
OmNavigator_Release(IOmNavigator
*iface
)
556 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
557 LONG ref
= InterlockedDecrement(&This
->ref
);
559 TRACE("(%p) ref=%d\n", This
, ref
);
563 This
->plugins
->navigator
= NULL
;
565 This
->mime_types
->navigator
= NULL
;
566 release_dispex(&This
->dispex
);
573 static HRESULT WINAPI
OmNavigator_GetTypeInfoCount(IOmNavigator
*iface
, UINT
*pctinfo
)
575 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
576 FIXME("(%p)->(%p)\n", This
, pctinfo
);
580 static HRESULT WINAPI
OmNavigator_GetTypeInfo(IOmNavigator
*iface
, UINT iTInfo
,
581 LCID lcid
, ITypeInfo
**ppTInfo
)
583 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
585 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
588 static HRESULT WINAPI
OmNavigator_GetIDsOfNames(IOmNavigator
*iface
, REFIID riid
,
589 LPOLESTR
*rgszNames
, UINT cNames
,
590 LCID lcid
, DISPID
*rgDispId
)
592 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
594 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
598 static HRESULT WINAPI
OmNavigator_Invoke(IOmNavigator
*iface
, DISPID dispIdMember
,
599 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
600 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
602 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
604 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
605 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
608 static HRESULT WINAPI
OmNavigator_get_appCodeName(IOmNavigator
*iface
, BSTR
*p
)
610 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
612 static const WCHAR mozillaW
[] = {'M','o','z','i','l','l','a',0};
614 TRACE("(%p)->(%p)\n", This
, p
);
616 *p
= SysAllocString(mozillaW
);
620 static HRESULT WINAPI
OmNavigator_get_appName(IOmNavigator
*iface
, BSTR
*p
)
622 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
624 static const WCHAR app_nameW
[] =
625 {'M','i','c','r','o','s','o','f','t',' ',
626 'I','n','t','e','r','n','e','t',' ',
627 'E','x','p','l','o','r','e','r',0};
629 TRACE("(%p)->(%p)\n", This
, p
);
631 *p
= SysAllocString(app_nameW
);
633 return E_OUTOFMEMORY
;
638 static HRESULT WINAPI
OmNavigator_get_appVersion(IOmNavigator
*iface
, BSTR
*p
)
640 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
642 char user_agent
[512];
646 TRACE("(%p)->(%p)\n", This
, p
);
648 size
= sizeof(user_agent
);
649 hres
= ObtainUserAgentString(0, user_agent
, &size
);
653 if(strncmp(user_agent
, "Mozilla/", 8)) {
654 FIXME("Unsupported user agent\n");
658 size
= MultiByteToWideChar(CP_ACP
, 0, user_agent
+8, -1, NULL
, 0);
659 *p
= SysAllocStringLen(NULL
, size
-1);
661 return E_OUTOFMEMORY
;
663 MultiByteToWideChar(CP_ACP
, 0, user_agent
+8, -1, *p
, size
);
667 static HRESULT WINAPI
OmNavigator_get_userAgent(IOmNavigator
*iface
, BSTR
*p
)
669 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
670 char user_agent
[512];
674 TRACE("(%p)->(%p)\n", This
, p
);
676 size
= sizeof(user_agent
);
677 hres
= ObtainUserAgentString(0, user_agent
, &size
);
681 size
= MultiByteToWideChar(CP_ACP
, 0, user_agent
, -1, NULL
, 0);
682 *p
= SysAllocStringLen(NULL
, size
-1);
684 return E_OUTOFMEMORY
;
686 MultiByteToWideChar(CP_ACP
, 0, user_agent
, -1, *p
, size
);
690 static HRESULT WINAPI
OmNavigator_javaEnabled(IOmNavigator
*iface
, VARIANT_BOOL
*enabled
)
692 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
694 FIXME("(%p)->(%p) semi-stub\n", This
, enabled
);
696 *enabled
= VARIANT_TRUE
;
700 static HRESULT WINAPI
OmNavigator_taintEnabled(IOmNavigator
*iface
, VARIANT_BOOL
*enabled
)
702 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
703 FIXME("(%p)->(%p)\n", This
, enabled
);
707 static HRESULT WINAPI
OmNavigator_get_mimeTypes(IOmNavigator
*iface
, IHTMLMimeTypesCollection
**p
)
709 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
711 TRACE("(%p)->(%p)\n", This
, p
);
713 if(!This
->mime_types
) {
716 hres
= create_mime_types_collection(This
, &This
->mime_types
);
720 IHTMLMimeTypesCollection_AddRef(&This
->mime_types
->IHTMLMimeTypesCollection_iface
);
723 *p
= &This
->mime_types
->IHTMLMimeTypesCollection_iface
;
727 static HRESULT WINAPI
OmNavigator_get_plugins(IOmNavigator
*iface
, IHTMLPluginsCollection
**p
)
729 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
731 TRACE("(%p)->(%p)\n", This
, p
);
736 hres
= create_plugins_collection(This
, &This
->plugins
);
740 IHTMLPluginsCollection_AddRef(&This
->plugins
->IHTMLPluginsCollection_iface
);
743 *p
= &This
->plugins
->IHTMLPluginsCollection_iface
;
747 static HRESULT WINAPI
OmNavigator_get_cookieEnabled(IOmNavigator
*iface
, VARIANT_BOOL
*p
)
749 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
751 WARN("(%p)->(%p) semi-stub\n", This
, p
);
757 static HRESULT WINAPI
OmNavigator_get_opsProfile(IOmNavigator
*iface
, IHTMLOpsProfile
**p
)
759 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
760 FIXME("(%p)->(%p)\n", This
, p
);
764 static HRESULT WINAPI
OmNavigator_toString(IOmNavigator
*iface
, BSTR
*String
)
766 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
768 static const WCHAR objectW
[] = {'[','o','b','j','e','c','t',']',0};
770 TRACE("(%p)->(%p)\n", This
, String
);
775 *String
= SysAllocString(objectW
);
776 return *String
? S_OK
: E_OUTOFMEMORY
;
779 static HRESULT WINAPI
OmNavigator_get_cpuClass(IOmNavigator
*iface
, BSTR
*p
)
781 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
783 static const WCHAR cpu_classW
[] =
790 TRACE("(%p)->(%p)\n", This
, p
);
792 *p
= SysAllocString(cpu_classW
);
793 return *p
? S_OK
: E_OUTOFMEMORY
;
796 static HRESULT
get_language_string(LCID lcid
, BSTR
*p
)
801 len
= LCIDToLocaleName(lcid
, NULL
, 0, 0);
803 WARN("LCIDToLocaleName failed: %u\n", GetLastError());
807 ret
= SysAllocStringLen(NULL
, len
-1);
809 return E_OUTOFMEMORY
;
811 len
= LCIDToLocaleName(lcid
, ret
, len
, 0);
813 WARN("LCIDToLocaleName failed: %u\n", GetLastError());
822 static HRESULT WINAPI
OmNavigator_get_systemLanguage(IOmNavigator
*iface
, BSTR
*p
)
824 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
826 TRACE("(%p)->(%p)\n", This
, p
);
828 return get_language_string(LOCALE_SYSTEM_DEFAULT
, p
);
831 static HRESULT WINAPI
OmNavigator_get_browserLanguage(IOmNavigator
*iface
, BSTR
*p
)
833 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
835 TRACE("(%p)->(%p)\n", This
, p
);
837 return get_language_string(GetUserDefaultUILanguage(), p
);
840 static HRESULT WINAPI
OmNavigator_get_userLanguage(IOmNavigator
*iface
, BSTR
*p
)
842 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
844 TRACE("(%p)->(%p)\n", This
, p
);
846 return get_language_string(LOCALE_USER_DEFAULT
, p
);
849 static HRESULT WINAPI
OmNavigator_get_platform(IOmNavigator
*iface
, BSTR
*p
)
851 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
854 static const WCHAR platformW
[] = {'W','i','n','6','4',0};
856 static const WCHAR platformW
[] = {'W','i','n','3','2',0};
859 TRACE("(%p)->(%p)\n", This
, p
);
861 *p
= SysAllocString(platformW
);
865 static HRESULT WINAPI
OmNavigator_get_appMinorVersion(IOmNavigator
*iface
, BSTR
*p
)
867 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
869 static const WCHAR zeroW
[] = {'0',0};
871 TRACE("(%p)->(%p)\n", This
, p
);
873 /* NOTE: MSIE returns "0" or values like ";SP2;". Returning "0" should be enough. */
874 *p
= SysAllocString(zeroW
);
878 static HRESULT WINAPI
OmNavigator_get_connectionSpeed(IOmNavigator
*iface
, LONG
*p
)
880 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
881 FIXME("(%p)->(%p)\n", This
, p
);
885 static HRESULT WINAPI
OmNavigator_get_onLine(IOmNavigator
*iface
, VARIANT_BOOL
*p
)
887 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
889 WARN("(%p)->(%p) semi-stub, returning true\n", This
, p
);
895 static HRESULT WINAPI
OmNavigator_get_userProfile(IOmNavigator
*iface
, IHTMLOpsProfile
**p
)
897 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
898 FIXME("(%p)->(%p)\n", This
, p
);
902 static const IOmNavigatorVtbl OmNavigatorVtbl
= {
903 OmNavigator_QueryInterface
,
906 OmNavigator_GetTypeInfoCount
,
907 OmNavigator_GetTypeInfo
,
908 OmNavigator_GetIDsOfNames
,
910 OmNavigator_get_appCodeName
,
911 OmNavigator_get_appName
,
912 OmNavigator_get_appVersion
,
913 OmNavigator_get_userAgent
,
914 OmNavigator_javaEnabled
,
915 OmNavigator_taintEnabled
,
916 OmNavigator_get_mimeTypes
,
917 OmNavigator_get_plugins
,
918 OmNavigator_get_cookieEnabled
,
919 OmNavigator_get_opsProfile
,
920 OmNavigator_toString
,
921 OmNavigator_get_cpuClass
,
922 OmNavigator_get_systemLanguage
,
923 OmNavigator_get_browserLanguage
,
924 OmNavigator_get_userLanguage
,
925 OmNavigator_get_platform
,
926 OmNavigator_get_appMinorVersion
,
927 OmNavigator_get_connectionSpeed
,
928 OmNavigator_get_onLine
,
929 OmNavigator_get_userProfile
932 static const tid_t OmNavigator_iface_tids
[] = {
936 static dispex_static_data_t OmNavigator_dispex
= {
938 DispHTMLNavigator_tid
,
940 OmNavigator_iface_tids
943 IOmNavigator
*OmNavigator_Create(void)
947 ret
= heap_alloc_zero(sizeof(*ret
));
951 ret
->IOmNavigator_iface
.lpVtbl
= &OmNavigatorVtbl
;
954 init_dispex(&ret
->dispex
, (IUnknown
*)&ret
->IOmNavigator_iface
, &OmNavigator_dispex
);
956 return &ret
->IOmNavigator_iface
;