1 /*
2 * This library is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU Lesser General Public
4 * License as published by the Free Software Foundation; either
5 * version 2 of the License, or (at your option) any later version.
6 *
7 * This library is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 * Lesser General Public License for more details.
11 *
12 * You should have received a copy of the GNU Lesser General Public
13 * License along with this library; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15 */
16
17 #include "config.h"
18 #include "CookieJar.h"
19
20 #include "Cookie.h"
21 #include "Document.h"
22 #include "KURL.h"
23 #include "PlatformString.h"
24 #include <wtf/HashMap.h>
25 #include <wtf/text/StringHash.h>
26
27 namespace WebCore {
28
29 static HashMap<String, String> cookieJar;
30
setCookies(Document *,const KURL & url,const String & value)31 void setCookies(Document* /*document*/, const KURL& url, const String& value)
32 {
33 cookieJar.set(url.string(), value);
34 }
35
cookies(const Document *,const KURL & url)36 String cookies(const Document* /*document*/, const KURL& url)
37 {
38 return cookieJar.get(url.string());
39 }
40
cookieRequestHeaderFieldValue(const Document *,const KURL & url)41 String cookieRequestHeaderFieldValue(const Document* /*document*/, const KURL& url)
42 {
43 // FIXME: include HttpOnly cookie.
44 return cookieJar.get(url.string());
45 }
46
cookiesEnabled(const Document *)47 bool cookiesEnabled(const Document* /*document*/)
48 {
49 return true;
50 }
51
getRawCookies(const Document *,const KURL &,Vector<Cookie> & rawCookies)52 bool getRawCookies(const Document*, const KURL&, Vector<Cookie>& rawCookies)
53 {
54 // FIXME: Not yet implemented
55 rawCookies.clear();
56 return false; // return true when implemented
57 }
58
deleteCookie(const Document *,const KURL &,const String &)59 void deleteCookie(const Document*, const KURL&, const String&)
60 {
61 // FIXME: Not yet implemented
62 }
63
64 #if !PLATFORM(EFL)
setCookieStoragePrivateBrowsingEnabled(bool enabled)65 void setCookieStoragePrivateBrowsingEnabled(bool enabled)
66 {
67 // FIXME: Not yet implemented
68 }
69 #endif
70
getHostnamesWithCookies(HashSet<String> & hostnames)71 void getHostnamesWithCookies(HashSet<String>& hostnames)
72 {
73 // FIXME: Not yet implemented
74 }
75
deleteCookiesForHostname(const String & hostname)76 void deleteCookiesForHostname(const String& hostname)
77 {
78 // FIXME: Not yet implemented
79 }
80
deleteAllCookies()81 void deleteAllCookies()
82 {
83 // FIXME: Not yet implemented
84 }
85
86 }
87