winemac: Consolidate mouse move handling into -[WineApplicationController handleMouse...
[wine.git] / dlls / mshtml / htmlstorage.c
blobe0c4a53d09367808b1a0e90bc96f7d76e92400e2
1 /*
2 * Copyright 2012 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
19 #include <stdarg.h>
21 #define COBJMACROS
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winuser.h"
26 #include "ole2.h"
28 #include "wine/debug.h"
30 #include "mshtml_private.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
34 typedef struct {
35 DispatchEx dispex;
36 IHTMLStorage IHTMLStorage_iface;
37 LONG ref;
38 } HTMLStorage;
40 static inline HTMLStorage *impl_from_IHTMLStorage(IHTMLStorage *iface)
42 return CONTAINING_RECORD(iface, HTMLStorage, IHTMLStorage_iface);
45 static HRESULT WINAPI HTMLStorage_QueryInterface(IHTMLStorage *iface, REFIID riid, void **ppv)
47 HTMLStorage *This = impl_from_IHTMLStorage(iface);
49 *ppv = NULL;
51 if(IsEqualGUID(&IID_IUnknown, riid)) {
52 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
53 *ppv = &This->IHTMLStorage_iface;
54 }else if(IsEqualGUID(&IID_IHTMLStorage, riid)) {
55 TRACE("(%p)->(IID_IHTMLStorage %p)\n", This, ppv);
56 *ppv = &This->IHTMLStorage_iface;
57 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
58 return *ppv ? S_OK : E_NOINTERFACE;
61 if(*ppv) {
62 IUnknown_AddRef((IUnknown*)*ppv);
63 return S_OK;
66 WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
67 return E_NOINTERFACE;
70 static ULONG WINAPI HTMLStorage_AddRef(IHTMLStorage *iface)
72 HTMLStorage *This = impl_from_IHTMLStorage(iface);
73 LONG ref = InterlockedIncrement(&This->ref);
75 TRACE("(%p) ref=%d\n", This, ref);
77 return ref;
80 static ULONG WINAPI HTMLStorage_Release(IHTMLStorage *iface)
82 HTMLStorage *This = impl_from_IHTMLStorage(iface);
83 LONG ref = InterlockedDecrement(&This->ref);
85 TRACE("(%p) ref=%d\n", This, ref);
87 if(!ref) {
88 release_dispex(&This->dispex);
89 heap_free(This);
92 return ref;
95 static HRESULT WINAPI HTMLStorage_GetTypeInfoCount(IHTMLStorage *iface, UINT *pctinfo)
97 HTMLStorage *This = impl_from_IHTMLStorage(iface);
98 FIXME("(%p)->(%p)\n", This, pctinfo);
99 return E_NOTIMPL;
102 static HRESULT WINAPI HTMLStorage_GetTypeInfo(IHTMLStorage *iface, UINT iTInfo,
103 LCID lcid, ITypeInfo **ppTInfo)
105 HTMLStorage *This = impl_from_IHTMLStorage(iface);
107 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
110 static HRESULT WINAPI HTMLStorage_GetIDsOfNames(IHTMLStorage *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames,
111 LCID lcid, DISPID *rgDispId)
113 HTMLStorage *This = impl_from_IHTMLStorage(iface);
115 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
116 lcid, rgDispId);
119 static HRESULT WINAPI HTMLStorage_Invoke(IHTMLStorage *iface, DISPID dispIdMember, REFIID riid, LCID lcid,
120 WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
122 HTMLStorage *This = impl_from_IHTMLStorage(iface);
124 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
125 pDispParams, pVarResult, pExcepInfo, puArgErr);
128 static HRESULT WINAPI HTMLStorage_get_length(IHTMLStorage *iface, LONG *p)
130 HTMLStorage *This = impl_from_IHTMLStorage(iface);
131 FIXME("(%p)->(%p)\n", This, p);
132 return E_NOTIMPL;
135 static HRESULT WINAPI HTMLStorage_get_remainingSpace(IHTMLStorage *iface, LONG *p)
137 HTMLStorage *This = impl_from_IHTMLStorage(iface);
138 FIXME("(%p)->(%p)\n", This, p);
139 return E_NOTIMPL;
142 static HRESULT WINAPI HTMLStorage_key(IHTMLStorage *iface, LONG lIndex, BSTR *p)
144 HTMLStorage *This = impl_from_IHTMLStorage(iface);
145 FIXME("(%p)->(%d %p)\n", This, lIndex, p);
146 return E_NOTIMPL;
149 static HRESULT WINAPI HTMLStorage_getItem(IHTMLStorage *iface, BSTR bstrKey, VARIANT *p)
151 HTMLStorage *This = impl_from_IHTMLStorage(iface);
152 FIXME("(%p)->(%s %p)\n", This, debugstr_w(bstrKey), p);
153 return E_NOTIMPL;
156 static HRESULT WINAPI HTMLStorage_setItem(IHTMLStorage *iface, BSTR bstrKey, BSTR bstrValue)
158 HTMLStorage *This = impl_from_IHTMLStorage(iface);
159 FIXME("(%p)->(%s %s)\n", This, debugstr_w(bstrKey), debugstr_w(bstrValue));
160 return E_NOTIMPL;
163 static HRESULT WINAPI HTMLStorage_removeItem(IHTMLStorage *iface, BSTR bstrKey)
165 HTMLStorage *This = impl_from_IHTMLStorage(iface);
166 FIXME("(%p)->(%s)\n", This, debugstr_w(bstrKey));
167 return E_NOTIMPL;
170 static HRESULT WINAPI HTMLStorage_clear(IHTMLStorage *iface)
172 HTMLStorage *This = impl_from_IHTMLStorage(iface);
173 FIXME("(%p)->()\n", This);
174 return E_NOTIMPL;
177 static const IHTMLStorageVtbl HTMLStorageVtbl = {
178 HTMLStorage_QueryInterface,
179 HTMLStorage_AddRef,
180 HTMLStorage_Release,
181 HTMLStorage_GetTypeInfoCount,
182 HTMLStorage_GetTypeInfo,
183 HTMLStorage_GetIDsOfNames,
184 HTMLStorage_Invoke,
185 HTMLStorage_get_length,
186 HTMLStorage_get_remainingSpace,
187 HTMLStorage_key,
188 HTMLStorage_getItem,
189 HTMLStorage_setItem,
190 HTMLStorage_removeItem,
191 HTMLStorage_clear
194 static const tid_t HTMLStorage_iface_tids[] = {
195 IHTMLStorage_tid,
198 static dispex_static_data_t HTMLStorage_dispex = {
199 NULL,
200 IHTMLStorage_tid,
201 NULL,
202 HTMLStorage_iface_tids
205 HRESULT create_storage(IHTMLStorage **p)
207 HTMLStorage *storage;
209 storage = heap_alloc_zero(sizeof(*storage));
210 if(!storage)
211 return E_OUTOFMEMORY;
213 storage->IHTMLStorage_iface.lpVtbl = &HTMLStorageVtbl;
214 storage->ref = 1;
215 init_dispex(&storage->dispex, (IUnknown*)&storage->IHTMLStorage_iface, &HTMLStorage_dispex);
217 *p = &storage->IHTMLStorage_iface;
218 return S_OK;