classinfo.c 3.14 KB
Newer Older
1
/*
2
 * Implementation of IProvideClassInfo interfaces for WebBrowser control
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
 *
 * Copyright 2001 John R. Sheets (for CodeWeavers)
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 20
 */

21
#include "ieframe.h"
22 23

#include "wine/debug.h"
24

25
WINE_DEFAULT_DEBUG_CHANNEL(ieframe);
26 27

/**********************************************************************
28
 * Implement the IProvideClassInfo2 interface
29 30
 */

31 32
static inline WebBrowser *impl_from_IProvideClassInfo2(IProvideClassInfo2 *iface)
{
33
    return CONTAINING_RECORD(iface, WebBrowser, IProvideClassInfo2_iface);
34
}
35

36 37
static HRESULT WINAPI ProvideClassInfo_QueryInterface(IProvideClassInfo2 *iface,
        REFIID riid, LPVOID *ppobj)
38
{
39
    WebBrowser *This = impl_from_IProvideClassInfo2(iface);
40
    return IWebBrowser_QueryInterface(&This->IWebBrowser2_iface, riid, ppobj);
41 42
}

43
static ULONG WINAPI ProvideClassInfo_AddRef(IProvideClassInfo2 *iface)
44
{
45
    WebBrowser *This = impl_from_IProvideClassInfo2(iface);
46
    return IWebBrowser_AddRef(&This->IWebBrowser2_iface);
47 48
}

49
static ULONG WINAPI ProvideClassInfo_Release(IProvideClassInfo2 *iface)
50
{
51
    WebBrowser *This = impl_from_IProvideClassInfo2(iface);
52
    return IWebBrowser_Release(&This->IWebBrowser2_iface);
53 54
}

55
static HRESULT WINAPI ProvideClassInfo_GetClassInfo(IProvideClassInfo2 *iface, ITypeInfo **ppTI)
56
{
57
    WebBrowser *This = impl_from_IProvideClassInfo2(iface);
58 59 60 61 62 63 64 65 66 67
    HRESULT hres;

    TRACE("(%p)->(%p)\n", This, ppTI);

    hres = get_typeinfo(This->version > 1 ? WebBrowser_tid : WebBrowser_V1_tid, ppTI);
    if(FAILED(hres))
        return hres;

    ITypeInfo_AddRef(*ppTI);
    return S_OK;
68 69
}

70 71
static HRESULT WINAPI ProvideClassInfo_GetGUID(IProvideClassInfo2 *iface,
        DWORD dwGuidKind, GUID *pGUID)
72
{
73
    WebBrowser *This = impl_from_IProvideClassInfo2(iface);
74

75
    TRACE("(%p)->(%d %p)\n", This, dwGuidKind, pGUID);
76

77 78
    if(!pGUID)
        return E_POINTER;
79

80
    if (dwGuidKind != GUIDKIND_DEFAULT_SOURCE_DISP_IID) {
81
        WARN("Wrong GUID type: %d\n", dwGuidKind);
82
        *pGUID = IID_NULL;
83 84
        return E_FAIL;
    }
85

86 87
    memcpy(pGUID, This->version == 1 ? &DIID_DWebBrowserEvents : &DIID_DWebBrowserEvents2,
           sizeof(GUID));
88 89 90
    return S_OK;
}

91
static const IProvideClassInfo2Vtbl ProvideClassInfoVtbl =
92
{
93 94 95 96 97
    ProvideClassInfo_QueryInterface,
    ProvideClassInfo_AddRef,
    ProvideClassInfo_Release,
    ProvideClassInfo_GetClassInfo,
    ProvideClassInfo_GetGUID
98 99
};

100 101
void WebBrowser_ClassInfo_Init(WebBrowser *This)
{
102
    This->IProvideClassInfo2_iface.lpVtbl = &ProvideClassInfoVtbl;
103
}