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"
33 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
35 #define HTMLLOCATION_THIS(iface) DEFINE_THIS(HTMLLocation, HTMLLocation, iface)
37 static HRESULT WINAPI
HTMLLocation_QueryInterface(IHTMLLocation
*iface
, REFIID riid
, void **ppv
)
39 HTMLLocation
*This
= HTMLLOCATION_THIS(iface
);
43 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
44 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
45 *ppv
= HTMLLOCATION(This
);
46 }else if(IsEqualGUID(&IID_IHTMLLocation
, riid
)) {
47 TRACE("(%p)->(IID_IHTMLLocation %p)\n", This
, ppv
);
48 *ppv
= HTMLLOCATION(This
);
49 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
50 return *ppv
? S_OK
: E_NOINTERFACE
;
54 IUnknown_AddRef((IUnknown
*)*ppv
);
58 WARN("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
62 static ULONG WINAPI
HTMLLocation_AddRef(IHTMLLocation
*iface
)
64 HTMLLocation
*This
= HTMLLOCATION_THIS(iface
);
65 LONG ref
= InterlockedIncrement(&This
->ref
);
67 TRACE("(%p) ref=%d\n", This
, ref
);
72 static ULONG WINAPI
HTMLLocation_Release(IHTMLLocation
*iface
)
74 HTMLLocation
*This
= HTMLLOCATION_THIS(iface
);
75 LONG ref
= InterlockedDecrement(&This
->ref
);
77 TRACE("(%p) ref=%d\n", This
, ref
);
80 if(This
->doc
&& This
->doc
->location
== This
)
81 This
->doc
->location
= NULL
;
88 static HRESULT WINAPI
HTMLLocation_GetTypeInfoCount(IHTMLLocation
*iface
, UINT
*pctinfo
)
90 HTMLLocation
*This
= HTMLLOCATION_THIS(iface
);
91 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This
->dispex
), pctinfo
);
94 static HRESULT WINAPI
HTMLLocation_GetTypeInfo(IHTMLLocation
*iface
, UINT iTInfo
,
95 LCID lcid
, ITypeInfo
**ppTInfo
)
97 HTMLLocation
*This
= HTMLLOCATION_THIS(iface
);
98 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This
->dispex
), iTInfo
, lcid
, ppTInfo
);
101 static HRESULT WINAPI
HTMLLocation_GetIDsOfNames(IHTMLLocation
*iface
, REFIID riid
,
102 LPOLESTR
*rgszNames
, UINT cNames
,
103 LCID lcid
, DISPID
*rgDispId
)
105 HTMLLocation
*This
= HTMLLOCATION_THIS(iface
);
106 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This
->dispex
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
109 static HRESULT WINAPI
HTMLLocation_Invoke(IHTMLLocation
*iface
, DISPID dispIdMember
,
110 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
111 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
113 HTMLLocation
*This
= HTMLLOCATION_THIS(iface
);
114 return IDispatchEx_Invoke(DISPATCHEX(&This
->dispex
), dispIdMember
, riid
, lcid
,
115 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
118 static HRESULT WINAPI
HTMLLocation_put_href(IHTMLLocation
*iface
, BSTR v
)
120 HTMLLocation
*This
= HTMLLOCATION_THIS(iface
);
121 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
125 static HRESULT WINAPI
HTMLLocation_get_href(IHTMLLocation
*iface
, BSTR
*p
)
127 HTMLLocation
*This
= HTMLLOCATION_THIS(iface
);
128 FIXME("(%p)->(%p)\n", This
, p
);
132 static HRESULT WINAPI
HTMLLocation_put_protocol(IHTMLLocation
*iface
, BSTR v
)
134 HTMLLocation
*This
= HTMLLOCATION_THIS(iface
);
135 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
139 static HRESULT WINAPI
HTMLLocation_get_protocol(IHTMLLocation
*iface
, BSTR
*p
)
141 HTMLLocation
*This
= HTMLLOCATION_THIS(iface
);
142 FIXME("(%p)->(%p)\n", This
, p
);
146 static HRESULT WINAPI
HTMLLocation_put_host(IHTMLLocation
*iface
, BSTR v
)
148 HTMLLocation
*This
= HTMLLOCATION_THIS(iface
);
149 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
153 static HRESULT WINAPI
HTMLLocation_get_host(IHTMLLocation
*iface
, BSTR
*p
)
155 HTMLLocation
*This
= HTMLLOCATION_THIS(iface
);
156 FIXME("(%p)->(%p)\n", This
, p
);
160 static HRESULT WINAPI
HTMLLocation_put_hostname(IHTMLLocation
*iface
, BSTR v
)
162 HTMLLocation
*This
= HTMLLOCATION_THIS(iface
);
163 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
167 static HRESULT WINAPI
HTMLLocation_get_hostname(IHTMLLocation
*iface
, BSTR
*p
)
169 HTMLLocation
*This
= HTMLLOCATION_THIS(iface
);
170 FIXME("(%p)->(%p)\n", This
, p
);
174 static HRESULT WINAPI
HTMLLocation_put_port(IHTMLLocation
*iface
, BSTR v
)
176 HTMLLocation
*This
= HTMLLOCATION_THIS(iface
);
177 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
181 static HRESULT WINAPI
HTMLLocation_get_port(IHTMLLocation
*iface
, BSTR
*p
)
183 HTMLLocation
*This
= HTMLLOCATION_THIS(iface
);
184 FIXME("(%p)->(%p)\n", This
, p
);
188 static HRESULT WINAPI
HTMLLocation_put_pathname(IHTMLLocation
*iface
, BSTR v
)
190 HTMLLocation
*This
= HTMLLOCATION_THIS(iface
);
191 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
195 static HRESULT WINAPI
HTMLLocation_get_pathname(IHTMLLocation
*iface
, BSTR
*p
)
197 HTMLLocation
*This
= HTMLLOCATION_THIS(iface
);
198 FIXME("(%p)->(%p)\n", This
, p
);
202 static HRESULT WINAPI
HTMLLocation_put_search(IHTMLLocation
*iface
, BSTR v
)
204 HTMLLocation
*This
= HTMLLOCATION_THIS(iface
);
205 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
209 static HRESULT WINAPI
HTMLLocation_get_search(IHTMLLocation
*iface
, BSTR
*p
)
211 HTMLLocation
*This
= HTMLLOCATION_THIS(iface
);
212 FIXME("(%p)->(%p)\n", This
, p
);
216 static HRESULT WINAPI
HTMLLocation_put_hash(IHTMLLocation
*iface
, BSTR v
)
218 HTMLLocation
*This
= HTMLLOCATION_THIS(iface
);
219 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
223 static HRESULT WINAPI
HTMLLocation_get_hash(IHTMLLocation
*iface
, BSTR
*p
)
225 HTMLLocation
*This
= HTMLLOCATION_THIS(iface
);
226 FIXME("(%p)->(%p)\n", This
, p
);
230 static HRESULT WINAPI
HTMLLocation_reload(IHTMLLocation
*iface
, VARIANT_BOOL flag
)
232 HTMLLocation
*This
= HTMLLOCATION_THIS(iface
);
233 FIXME("(%p)->(%x)\n", This
, flag
);
237 static HRESULT WINAPI
HTMLLocation_replace(IHTMLLocation
*iface
, BSTR bstr
)
239 HTMLLocation
*This
= HTMLLOCATION_THIS(iface
);
240 FIXME("(%p)->(%s)\n", This
, debugstr_w(bstr
));
244 static HRESULT WINAPI
HTMLLocation_assign(IHTMLLocation
*iface
, BSTR bstr
)
246 HTMLLocation
*This
= HTMLLOCATION_THIS(iface
);
247 FIXME("(%p)->(%s)\n", This
, debugstr_w(bstr
));
251 static HRESULT WINAPI
HTMLLocation_toString(IHTMLLocation
*iface
, BSTR
*String
)
253 HTMLLocation
*This
= HTMLLOCATION_THIS(iface
);
254 FIXME("(%p)->(%p)\n", This
, String
);
258 #undef HTMLLOCATION_THIS
260 static const IHTMLLocationVtbl HTMLLocationVtbl
= {
261 HTMLLocation_QueryInterface
,
263 HTMLLocation_Release
,
264 HTMLLocation_GetTypeInfoCount
,
265 HTMLLocation_GetTypeInfo
,
266 HTMLLocation_GetIDsOfNames
,
268 HTMLLocation_put_href
,
269 HTMLLocation_get_href
,
270 HTMLLocation_put_protocol
,
271 HTMLLocation_get_protocol
,
272 HTMLLocation_put_host
,
273 HTMLLocation_get_host
,
274 HTMLLocation_put_hostname
,
275 HTMLLocation_get_hostname
,
276 HTMLLocation_put_port
,
277 HTMLLocation_get_port
,
278 HTMLLocation_put_pathname
,
279 HTMLLocation_get_pathname
,
280 HTMLLocation_put_search
,
281 HTMLLocation_get_search
,
282 HTMLLocation_put_hash
,
283 HTMLLocation_get_hash
,
285 HTMLLocation_replace
,
287 HTMLLocation_toString
290 static const tid_t HTMLLocation_iface_tids
[] = {
294 static dispex_static_data_t HTMLLocation_dispex
= {
298 HTMLLocation_iface_tids
302 HTMLLocation
*HTMLLocation_Create(HTMLDocument
*doc
)
304 HTMLLocation
*ret
= heap_alloc(sizeof(*ret
));
306 ret
->lpHTMLLocationVtbl
= &HTMLLocationVtbl
;
310 init_dispex(&ret
->dispex
, (IUnknown
*)HTMLLOCATION(ret
), &HTMLLocation_dispex
);