shdocvw: Added more tests.
[wine] / dlls / shdocvw / urlhist.c
1 /*
2  * Copyright 2006 Jacek Caban for CodeWeavers
3  *
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.
8  *
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.
13  *
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
17  */
18
19 #include "wine/debug.h"
20 #include "shdocvw.h"
21 #include "urlhist.h"
22
23 WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
24
25 static HRESULT WINAPI UrlHistoryStg_QueryInterface(IUrlHistoryStg2 *iface, REFIID riid, void **ppv)
26 {
27     *ppv = NULL;
28
29     if(IsEqualGUID(&IID_IUnknown, riid)) {
30         TRACE("(IID_IUnknown %p)\n", ppv);
31         *ppv = iface;
32     }else if(IsEqualGUID(&IID_IUrlHistoryStg, riid)) {
33         TRACE("(IID_IUrlHistoryStg %p)\n", ppv);
34         *ppv = iface;
35     }else if(IsEqualGUID(&IID_IUrlHistoryStg2, riid)) {
36         TRACE("(IID_IUrlHistoryStg2 %p)\n", ppv);
37         *ppv = iface;
38     }
39
40     if(*ppv)
41         return S_OK;
42
43
44     WARN("(%s %p)\n", debugstr_guid(riid), ppv);
45     return E_NOINTERFACE;
46 }
47
48 static ULONG WINAPI UrlHistoryStg_AddRef(IUrlHistoryStg2 *iface)
49 {
50     return 2;
51 }
52
53 static ULONG WINAPI UrlHistoryStg_Release(IUrlHistoryStg2 *iface)
54 {
55     return 1;
56 }
57
58 static HRESULT WINAPI UrlHistoryStg_AddUrl(IUrlHistoryStg2 *iface, LPCOLESTR lpcsUrl,
59         LPCOLESTR pocsTitle, DWORD dwFlags)
60 {
61     FIXME("(%s %s %08x)\n", debugstr_w(lpcsUrl), debugstr_w(pocsTitle), dwFlags);
62     return E_NOTIMPL;
63 }
64
65 static HRESULT WINAPI UrlHistoryStg_DeleteUrl(IUrlHistoryStg2 *iface, LPCOLESTR lpcsUrl,
66         DWORD dwFlags)
67 {
68     FIXME("(%s %08x)\n", debugstr_w(lpcsUrl), dwFlags);
69     return E_NOTIMPL;
70 }
71
72 static HRESULT WINAPI UrlHistoryStg_QueryUrl(IUrlHistoryStg2 *iface, LPCOLESTR lpcsUrl,
73         DWORD dwFlags, LPSTATURL lpSTATURL)
74 {
75     FIXME("(%s %08x %p)\n", debugstr_w(lpcsUrl), dwFlags, lpSTATURL);
76     return E_NOTIMPL;
77 }
78
79 static HRESULT WINAPI UrlHistoryStg_BindToObject(IUrlHistoryStg2 *iface, LPCOLESTR lpcsUrl,
80         REFIID riid, void **ppv)
81 {
82     FIXME("(%s %s %p)\n", debugstr_w(lpcsUrl), debugstr_guid(riid), ppv);
83     return E_NOTIMPL;
84 }
85
86 static HRESULT WINAPI UrlHistoryStg_EnumUrls(IUrlHistoryStg2 *iface, IEnumSTATURL **ppEnum)
87 {
88     FIXME("(%p)\n", ppEnum);
89     return E_NOTIMPL;
90 }
91
92 static HRESULT WINAPI UrlHistoryStg_AddUrlAndNotify(IUrlHistoryStg2 *iface, LPCOLESTR pocsUrl,
93         LPCOLESTR pocsTitle, DWORD dwFlags, BOOL fWriteHistory, IOleCommandTarget *poctNotify,
94         IUnknown *punkISFolder)
95 {
96     FIXME("(%s %s %08x %x %p %p)\n", debugstr_w(pocsUrl), debugstr_w(pocsTitle),
97           dwFlags, fWriteHistory, poctNotify, punkISFolder);
98     return E_NOTIMPL;
99 }
100
101 static HRESULT WINAPI UrlHistoryStg_ClearHistory(IUrlHistoryStg2 *iface)
102 {
103     FIXME("()\n");
104     return E_NOTIMPL;
105 }
106
107 static const IUrlHistoryStg2Vtbl UrlHistoryStg2Vtbl = {
108     UrlHistoryStg_QueryInterface,
109     UrlHistoryStg_AddRef,
110     UrlHistoryStg_Release,
111     UrlHistoryStg_AddUrl,
112     UrlHistoryStg_DeleteUrl,
113     UrlHistoryStg_QueryUrl,
114     UrlHistoryStg_BindToObject,
115     UrlHistoryStg_EnumUrls,
116     UrlHistoryStg_AddUrlAndNotify,
117     UrlHistoryStg_ClearHistory
118 };
119
120 static IUrlHistoryStg2 UrlHistoryStg2 = { &UrlHistoryStg2Vtbl };
121
122 HRESULT CUrlHistory_Create(IUnknown *pOuter, REFIID riid, void **ppv)
123 {
124     if(pOuter)
125         return CLASS_E_NOAGGREGATION;
126
127     return IUrlHistoryStg_QueryInterface(&UrlHistoryStg2, riid, ppv);
128 }