persist.c 8.59 KB
Newer Older
1
/*
2
 * Implementation of IPersist interfaces for WebBrowser control
3 4
 *
 * Copyright 2001 John R. Sheets (for CodeWeavers)
5
 * Copyright 2005 Jacek Caban
6 7 8 9 10 11 12 13 14 15 16 17 18
 *
 * 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
19
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 21
 */

22 23
#include "ieframe.h"

24 25
#include "wine/debug.h"

26
WINE_DEFAULT_DEBUG_CHANNEL(ieframe);
27 28 29 30 31

/**********************************************************************
 * Implement the IPersistStorage interface
 */

32 33
static inline WebBrowser *impl_from_IPersistStorage(IPersistStorage *iface)
{
34
    return CONTAINING_RECORD(iface, WebBrowser, IPersistStorage_iface);
35
}
36

37 38 39
static HRESULT WINAPI PersistStorage_QueryInterface(IPersistStorage *iface,
        REFIID riid, LPVOID *ppobj)
{
40
    WebBrowser *This = impl_from_IPersistStorage(iface);
41
    return IWebBrowser2_QueryInterface(&This->IWebBrowser2_iface, riid, ppobj);
42 43
}

44
static ULONG WINAPI PersistStorage_AddRef(IPersistStorage *iface)
45
{
46
    WebBrowser *This = impl_from_IPersistStorage(iface);
47
    return IWebBrowser2_AddRef(&This->IWebBrowser2_iface);
48 49
}

50
static ULONG WINAPI PersistStorage_Release(IPersistStorage *iface)
51
{
52
    WebBrowser *This = impl_from_IPersistStorage(iface);
53
    return IWebBrowser2_Release(&This->IWebBrowser2_iface);
54 55
}

56
static HRESULT WINAPI PersistStorage_GetClassID(IPersistStorage *iface, CLSID *pClassID)
57
{
58
    WebBrowser *This = impl_from_IPersistStorage(iface);
59 60
    FIXME("(%p)->(%p)\n", This, pClassID);
    return E_NOTIMPL;
61 62
}

63
static HRESULT WINAPI PersistStorage_IsDirty(IPersistStorage *iface)
64
{
65
    WebBrowser *This = impl_from_IPersistStorage(iface);
66 67
    FIXME("(%p)\n", This);
    return E_NOTIMPL;
68 69
}

70
static HRESULT WINAPI PersistStorage_InitNew(IPersistStorage *iface, LPSTORAGE pStg)
71
{
72
    WebBrowser *This = impl_from_IPersistStorage(iface);
73
    FIXME("(%p)->(%p)\n", This, pStg);
74
    return S_OK;
75 76
}

77
static HRESULT WINAPI PersistStorage_Load(IPersistStorage *iface, LPSTORAGE pStg)
78
{
79
    WebBrowser *This = impl_from_IPersistStorage(iface);
80 81
    FIXME("(%p)->(%p)\n", This, pStg);
    return E_NOTIMPL;
82 83
}

84 85
static HRESULT WINAPI PersistStorage_Save(IPersistStorage *iface, LPSTORAGE pStg,
        BOOL fSameAsLoad)
86
{
87
    WebBrowser *This = impl_from_IPersistStorage(iface);
88 89
    FIXME("(%p)->(%p %x)\n", This, pStg, fSameAsLoad);
    return E_NOTIMPL;
90 91
}

92
static HRESULT WINAPI PersistStorage_SaveCompleted(IPersistStorage *iface, LPSTORAGE pStgNew)
93
{
94
    WebBrowser *This = impl_from_IPersistStorage(iface);
95 96
    FIXME("(%p)->(%p)\n", This, pStgNew);
    return E_NOTIMPL;
97 98
}

99 100 101 102 103 104 105 106 107 108 109
static const IPersistStorageVtbl PersistStorageVtbl =
{
    PersistStorage_QueryInterface,
    PersistStorage_AddRef,
    PersistStorage_Release,
    PersistStorage_GetClassID,
    PersistStorage_IsDirty,
    PersistStorage_InitNew,
    PersistStorage_Load,
    PersistStorage_Save,
    PersistStorage_SaveCompleted
110 111
};

112 113 114 115
/**********************************************************************
 * Implement the IPersistMemory interface
 */

116 117
static inline WebBrowser *impl_from_IPersistMemory(IPersistMemory *iface)
{
118
    return CONTAINING_RECORD(iface, WebBrowser, IPersistMemory_iface);
119
}
120 121 122 123

static HRESULT WINAPI PersistMemory_QueryInterface(IPersistMemory *iface,
        REFIID riid, LPVOID *ppobj)
{
124
    WebBrowser *This = impl_from_IPersistMemory(iface);
125
    return IWebBrowser2_QueryInterface(&This->IWebBrowser2_iface, riid, ppobj);
126 127 128 129
}

static ULONG WINAPI PersistMemory_AddRef(IPersistMemory *iface)
{
130
    WebBrowser *This = impl_from_IPersistMemory(iface);
131
    return IWebBrowser2_AddRef(&This->IWebBrowser2_iface);
132 133 134 135
}

static ULONG WINAPI PersistMemory_Release(IPersistMemory *iface)
{
136
    WebBrowser *This = impl_from_IPersistMemory(iface);
137
    return IWebBrowser2_Release(&This->IWebBrowser2_iface);
138 139 140 141
}

static HRESULT WINAPI PersistMemory_GetClassID(IPersistMemory *iface, CLSID *pClassID)
{
142
    WebBrowser *This = impl_from_IPersistMemory(iface);
143 144 145 146 147 148
    FIXME("(%p)->(%p)\n", This, pClassID);
    return E_NOTIMPL;
}

static HRESULT WINAPI PersistMemory_IsDirty(IPersistMemory *iface)
{
149
    WebBrowser *This = impl_from_IPersistMemory(iface);
150 151 152 153 154 155
    FIXME("(%p)\n", This);
    return E_NOTIMPL;
}

static HRESULT WINAPI PersistMemory_InitNew(IPersistMemory *iface)
{
156
    WebBrowser *This = impl_from_IPersistMemory(iface);
157 158 159 160 161 162
    FIXME("(%p)\n", This);
    return S_OK;
}

static HRESULT WINAPI PersistMemory_Load(IPersistMemory *iface, LPVOID pMem, ULONG cbSize)
{
163
    WebBrowser *This = impl_from_IPersistMemory(iface);
164
    FIXME("(%p)->(%p %x)\n", This, pMem, cbSize);
165
    return S_OK;
166 167 168 169 170
}

static HRESULT WINAPI PersistMemory_Save(IPersistMemory *iface, LPVOID pMem,
        BOOL fClearDirty, ULONG cbSize)
{
171
    WebBrowser *This = impl_from_IPersistMemory(iface);
172 173 174 175 176 177
    FIXME("(%p)->(%p %x %x)\n", This, pMem, fClearDirty, cbSize);
    return E_NOTIMPL;
}

static HRESULT WINAPI PersistMemory_GetSizeMax(IPersistMemory *iface, ULONG *pCbSize)
{
178
    WebBrowser *This = impl_from_IPersistMemory(iface);
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
    FIXME("(%p)->(%p)\n", This, pCbSize);
    return E_NOTIMPL;
}

static const IPersistMemoryVtbl PersistMemoryVtbl =
{
    PersistMemory_QueryInterface,
    PersistMemory_AddRef,
    PersistMemory_Release,
    PersistMemory_GetClassID,
    PersistMemory_IsDirty,
    PersistMemory_Load,
    PersistMemory_Save,
    PersistMemory_GetSizeMax,
    PersistMemory_InitNew
};

196 197 198 199
/**********************************************************************
 * Implement the IPersistStreamInit interface
 */

200 201
static inline WebBrowser *impl_from_IPersistStreamInit(IPersistStreamInit *iface)
{
202
    return CONTAINING_RECORD(iface, WebBrowser, IPersistStreamInit_iface);
203
}
204

205 206 207
static HRESULT WINAPI PersistStreamInit_QueryInterface(IPersistStreamInit *iface,
        REFIID riid, LPVOID *ppobj)
{
208
    WebBrowser *This = impl_from_IPersistStreamInit(iface);
209
    return IWebBrowser2_QueryInterface(&This->IWebBrowser2_iface, riid, ppobj);
210 211
}

212
static ULONG WINAPI PersistStreamInit_AddRef(IPersistStreamInit *iface)
213
{
214
    WebBrowser *This = impl_from_IPersistStreamInit(iface);
215
    return IWebBrowser2_AddRef(&This->IWebBrowser2_iface);
216 217
}

218
static ULONG WINAPI PersistStreamInit_Release(IPersistStreamInit *iface)
219
{
220
    WebBrowser *This = impl_from_IPersistStreamInit(iface);
221
    return IWebBrowser2_Release(&This->IWebBrowser2_iface);
222 223
}

224
static HRESULT WINAPI PersistStreamInit_GetClassID(IPersistStreamInit *iface, CLSID *pClassID)
225
{
226 227
    WebBrowser *This = impl_from_IPersistStreamInit(iface);
    return IPersistStorage_GetClassID(&This->IPersistStorage_iface, pClassID);
228 229
}

230
static HRESULT WINAPI PersistStreamInit_IsDirty(IPersistStreamInit *iface)
231
{
232 233
    WebBrowser *This = impl_from_IPersistStreamInit(iface);
    return IPersistStorage_IsDirty(&This->IPersistStorage_iface);
234 235
}

236
static HRESULT WINAPI PersistStreamInit_Load(IPersistStreamInit *iface, LPSTREAM pStg)
237
{
238
    WebBrowser *This = impl_from_IPersistStreamInit(iface);
239
    FIXME("(%p)->(%p)\n", This, pStg);
240
    return S_OK;
241 242
}

243 244
static HRESULT WINAPI PersistStreamInit_Save(IPersistStreamInit *iface, LPSTREAM pStg,
        BOOL fSameAsLoad)
245
{
246
    WebBrowser *This = impl_from_IPersistStreamInit(iface);
247 248
    FIXME("(%p)->(%p %x)\n", This, pStg, fSameAsLoad);
    return E_NOTIMPL;
249 250
}

251 252
static HRESULT WINAPI PersistStreamInit_GetSizeMax(IPersistStreamInit *iface,
        ULARGE_INTEGER *pcbSize)
253
{
254
    WebBrowser *This = impl_from_IPersistStreamInit(iface);
255 256
    FIXME("(%p)->(%p)\n", This, pcbSize);
    return E_NOTIMPL;
257 258
}

259
static HRESULT WINAPI PersistStreamInit_InitNew(IPersistStreamInit *iface)
260
{
261
    WebBrowser *This = impl_from_IPersistStreamInit(iface);
262
    FIXME("(%p)\n", This);
263
    return S_OK;
264 265
}

266 267 268 269 270 271 272 273 274 275 276
static const IPersistStreamInitVtbl PersistStreamInitVtbl =
{
    PersistStreamInit_QueryInterface,
    PersistStreamInit_AddRef,
    PersistStreamInit_Release,
    PersistStreamInit_GetClassID,
    PersistStreamInit_IsDirty,
    PersistStreamInit_Load,
    PersistStreamInit_Save,
    PersistStreamInit_GetSizeMax,
    PersistStreamInit_InitNew
277 278
};

279 280
void WebBrowser_Persist_Init(WebBrowser *This)
{
281 282 283
    This->IPersistStorage_iface.lpVtbl    = &PersistStorageVtbl;
    This->IPersistMemory_iface.lpVtbl     = &PersistMemoryVtbl;
    This->IPersistStreamInit_iface.lpVtbl = &PersistStreamInitVtbl;
284
}