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