2 * Implementation of IPersist interfaces for WebBrowser control
4 * Copyright 2001 John R. Sheets (for CodeWeavers)
5 * Copyright 2005 Jacek Caban
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * 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
24 #include "wine/debug.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(ieframe
);
28 /**********************************************************************
29 * Implement the IPersistStorage interface
32 static inline WebBrowser
*impl_from_IPersistStorage(IPersistStorage
*iface
)
34 return CONTAINING_RECORD(iface
, WebBrowser
, IPersistStorage_iface
);
37 static HRESULT WINAPI
PersistStorage_QueryInterface(IPersistStorage
*iface
,
38 REFIID riid
, LPVOID
*ppobj
)
40 WebBrowser
*This
= impl_from_IPersistStorage(iface
);
41 return IUnknown_QueryInterface(This
->hlink_frame
.outer
, riid
, ppobj
);
44 static ULONG WINAPI
PersistStorage_AddRef(IPersistStorage
*iface
)
46 WebBrowser
*This
= impl_from_IPersistStorage(iface
);
47 return IUnknown_AddRef(This
->hlink_frame
.outer
);
50 static ULONG WINAPI
PersistStorage_Release(IPersistStorage
*iface
)
52 WebBrowser
*This
= impl_from_IPersistStorage(iface
);
53 return IUnknown_Release(This
->hlink_frame
.outer
);
56 static HRESULT WINAPI
PersistStorage_GetClassID(IPersistStorage
*iface
, CLSID
*pClassID
)
58 WebBrowser
*This
= impl_from_IPersistStorage(iface
);
60 TRACE("(%p)->(%p)\n", This
, pClassID
);
65 *pClassID
= This
->version
== 1 ? CLSID_WebBrowser_V1
: CLSID_WebBrowser
;
69 static HRESULT WINAPI
PersistStorage_IsDirty(IPersistStorage
*iface
)
71 WebBrowser
*This
= impl_from_IPersistStorage(iface
);
72 FIXME("(%p)\n", This
);
76 static HRESULT WINAPI
PersistStorage_InitNew(IPersistStorage
*iface
, LPSTORAGE pStg
)
78 WebBrowser
*This
= impl_from_IPersistStorage(iface
);
79 FIXME("(%p)->(%p)\n", This
, pStg
);
83 static HRESULT WINAPI
PersistStorage_Load(IPersistStorage
*iface
, LPSTORAGE pStg
)
85 WebBrowser
*This
= impl_from_IPersistStorage(iface
);
86 FIXME("(%p)->(%p)\n", This
, pStg
);
90 static HRESULT WINAPI
PersistStorage_Save(IPersistStorage
*iface
, LPSTORAGE pStg
,
93 WebBrowser
*This
= impl_from_IPersistStorage(iface
);
94 FIXME("(%p)->(%p %x)\n", This
, pStg
, fSameAsLoad
);
98 static HRESULT WINAPI
PersistStorage_SaveCompleted(IPersistStorage
*iface
, LPSTORAGE pStgNew
)
100 WebBrowser
*This
= impl_from_IPersistStorage(iface
);
101 FIXME("(%p)->(%p)\n", This
, pStgNew
);
105 static const IPersistStorageVtbl PersistStorageVtbl
=
107 PersistStorage_QueryInterface
,
108 PersistStorage_AddRef
,
109 PersistStorage_Release
,
110 PersistStorage_GetClassID
,
111 PersistStorage_IsDirty
,
112 PersistStorage_InitNew
,
115 PersistStorage_SaveCompleted
118 /**********************************************************************
119 * Implement the IPersistMemory interface
122 static inline WebBrowser
*impl_from_IPersistMemory(IPersistMemory
*iface
)
124 return CONTAINING_RECORD(iface
, WebBrowser
, IPersistMemory_iface
);
127 static HRESULT WINAPI
PersistMemory_QueryInterface(IPersistMemory
*iface
,
128 REFIID riid
, LPVOID
*ppobj
)
130 WebBrowser
*This
= impl_from_IPersistMemory(iface
);
131 return IUnknown_QueryInterface(This
->hlink_frame
.outer
, riid
, ppobj
);
134 static ULONG WINAPI
PersistMemory_AddRef(IPersistMemory
*iface
)
136 WebBrowser
*This
= impl_from_IPersistMemory(iface
);
137 return IUnknown_AddRef(This
->hlink_frame
.outer
);
140 static ULONG WINAPI
PersistMemory_Release(IPersistMemory
*iface
)
142 WebBrowser
*This
= impl_from_IPersistMemory(iface
);
143 return IUnknown_Release(This
->hlink_frame
.outer
);
146 static HRESULT WINAPI
PersistMemory_GetClassID(IPersistMemory
*iface
, CLSID
*pClassID
)
148 WebBrowser
*This
= impl_from_IPersistMemory(iface
);
149 FIXME("(%p)->(%p)\n", This
, pClassID
);
153 static HRESULT WINAPI
PersistMemory_IsDirty(IPersistMemory
*iface
)
155 WebBrowser
*This
= impl_from_IPersistMemory(iface
);
156 FIXME("(%p)\n", This
);
160 static HRESULT WINAPI
PersistMemory_InitNew(IPersistMemory
*iface
)
162 WebBrowser
*This
= impl_from_IPersistMemory(iface
);
163 FIXME("(%p)\n", This
);
167 static HRESULT WINAPI
PersistMemory_Load(IPersistMemory
*iface
, LPVOID pMem
, ULONG cbSize
)
169 WebBrowser
*This
= impl_from_IPersistMemory(iface
);
170 FIXME("(%p)->(%p %lx)\n", This
, pMem
, cbSize
);
174 static HRESULT WINAPI
PersistMemory_Save(IPersistMemory
*iface
, LPVOID pMem
,
175 BOOL fClearDirty
, ULONG cbSize
)
177 WebBrowser
*This
= impl_from_IPersistMemory(iface
);
178 FIXME("(%p)->(%p %x %lx)\n", This
, pMem
, fClearDirty
, cbSize
);
182 static HRESULT WINAPI
PersistMemory_GetSizeMax(IPersistMemory
*iface
, ULONG
*pCbSize
)
184 WebBrowser
*This
= impl_from_IPersistMemory(iface
);
185 FIXME("(%p)->(%p)\n", This
, pCbSize
);
189 static const IPersistMemoryVtbl PersistMemoryVtbl
=
191 PersistMemory_QueryInterface
,
192 PersistMemory_AddRef
,
193 PersistMemory_Release
,
194 PersistMemory_GetClassID
,
195 PersistMemory_IsDirty
,
198 PersistMemory_GetSizeMax
,
199 PersistMemory_InitNew
202 /**********************************************************************
203 * Implement the IPersistStreamInit interface
206 static inline WebBrowser
*impl_from_IPersistStreamInit(IPersistStreamInit
*iface
)
208 return CONTAINING_RECORD(iface
, WebBrowser
, IPersistStreamInit_iface
);
211 static HRESULT WINAPI
PersistStreamInit_QueryInterface(IPersistStreamInit
*iface
,
212 REFIID riid
, LPVOID
*ppobj
)
214 WebBrowser
*This
= impl_from_IPersistStreamInit(iface
);
215 return IUnknown_QueryInterface(This
->hlink_frame
.outer
, riid
, ppobj
);
218 static ULONG WINAPI
PersistStreamInit_AddRef(IPersistStreamInit
*iface
)
220 WebBrowser
*This
= impl_from_IPersistStreamInit(iface
);
221 return IUnknown_AddRef(This
->hlink_frame
.outer
);
224 static ULONG WINAPI
PersistStreamInit_Release(IPersistStreamInit
*iface
)
226 WebBrowser
*This
= impl_from_IPersistStreamInit(iface
);
227 return IUnknown_Release(This
->hlink_frame
.outer
);
230 static HRESULT WINAPI
PersistStreamInit_GetClassID(IPersistStreamInit
*iface
, CLSID
*pClassID
)
232 WebBrowser
*This
= impl_from_IPersistStreamInit(iface
);
233 return IPersistStorage_GetClassID(&This
->IPersistStorage_iface
, pClassID
);
236 static HRESULT WINAPI
PersistStreamInit_IsDirty(IPersistStreamInit
*iface
)
238 WebBrowser
*This
= impl_from_IPersistStreamInit(iface
);
239 return IPersistStorage_IsDirty(&This
->IPersistStorage_iface
);
242 static HRESULT WINAPI
PersistStreamInit_Load(IPersistStreamInit
*iface
, LPSTREAM pStg
)
244 WebBrowser
*This
= impl_from_IPersistStreamInit(iface
);
245 FIXME("(%p)->(%p)\n", This
, pStg
);
249 static HRESULT WINAPI
PersistStreamInit_Save(IPersistStreamInit
*iface
, LPSTREAM pStg
,
252 WebBrowser
*This
= impl_from_IPersistStreamInit(iface
);
253 FIXME("(%p)->(%p %x)\n", This
, pStg
, fSameAsLoad
);
257 static HRESULT WINAPI
PersistStreamInit_GetSizeMax(IPersistStreamInit
*iface
,
258 ULARGE_INTEGER
*pcbSize
)
260 WebBrowser
*This
= impl_from_IPersistStreamInit(iface
);
261 FIXME("(%p)->(%p)\n", This
, pcbSize
);
265 static HRESULT WINAPI
PersistStreamInit_InitNew(IPersistStreamInit
*iface
)
267 WebBrowser
*This
= impl_from_IPersistStreamInit(iface
);
268 FIXME("(%p)\n", This
);
272 static const IPersistStreamInitVtbl PersistStreamInitVtbl
=
274 PersistStreamInit_QueryInterface
,
275 PersistStreamInit_AddRef
,
276 PersistStreamInit_Release
,
277 PersistStreamInit_GetClassID
,
278 PersistStreamInit_IsDirty
,
279 PersistStreamInit_Load
,
280 PersistStreamInit_Save
,
281 PersistStreamInit_GetSizeMax
,
282 PersistStreamInit_InitNew
285 void WebBrowser_Persist_Init(WebBrowser
*This
)
287 This
->IPersistStorage_iface
.lpVtbl
= &PersistStorageVtbl
;
288 This
->IPersistMemory_iface
.lpVtbl
= &PersistMemoryVtbl
;
289 This
->IPersistStreamInit_iface
.lpVtbl
= &PersistStreamInitVtbl
;