Modified: trunk/Source/WebCore/platform/network/curl/CookieJarCurl.cpp (220350 => 220351)
--- trunk/Source/WebCore/platform/network/curl/CookieJarCurl.cpp 2017-08-07 20:30:24 UTC (rev 220350)
+++ trunk/Source/WebCore/platform/network/curl/CookieJarCurl.cpp 2017-08-07 20:58:50 UTC (rev 220351)
@@ -17,10 +17,9 @@
*/
#include "config.h"
-#include "PlatformCookieJar.h"
+#include "CookieJarCurl.h"
#if USE(CURL)
-
#include "Cookie.h"
#include "CurlContext.h"
#include "NotImplemented.h"
@@ -240,7 +239,7 @@
return cookieStr.toString();
}
-void setCookiesFromDOM(const NetworkStorageSession&, const URL&, const URL& url, const String& value)
+void CookieJarCurlFileSystem::setCookiesFromDOM(const NetworkStorageSession&, const URL& firstParty, const URL& url, const String& value)
{
CurlHandle curlHandle;
@@ -288,22 +287,22 @@
return cookies;
}
-String cookiesForDOM(const NetworkStorageSession& session, const URL& firstParty, const URL& url)
+String CookieJarCurlFileSystem::cookiesForDOM(const NetworkStorageSession& session, const URL& firstParty, const URL& url)
{
return cookiesForSession(session, firstParty, url, false);
}
-String cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const URL& firstParty, const URL& url)
+String CookieJarCurlFileSystem::cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const URL& firstParty, const URL& url)
{
return cookiesForSession(session, firstParty, url, true);
}
-bool cookiesEnabled(const NetworkStorageSession&, const URL& /*firstParty*/, const URL& /*url*/)
+bool CookieJarCurlFileSystem::cookiesEnabled(const NetworkStorageSession&, const URL& firstParty, const URL&)
{
return true;
}
-bool getRawCookies(const NetworkStorageSession&, const URL& /*firstParty*/, const URL& /*url*/, Vector<Cookie>& rawCookies)
+bool CookieJarCurlFileSystem::getRawCookies(const NetworkStorageSession&, const URL& firstParty, const URL&, Vector<Cookie>& rawCookies)
{
// FIXME: Not yet implemented
rawCookies.clear();
@@ -310,31 +309,83 @@
return false; // return true when implemented
}
-void deleteCookie(const NetworkStorageSession&, const URL&, const String&)
+void CookieJarCurlFileSystem::deleteCookie(const NetworkStorageSession&, const URL&, const String&)
{
// FIXME: Not yet implemented
}
-void getHostnamesWithCookies(const NetworkStorageSession&, HashSet<String>&)
+void CookieJarCurlFileSystem::getHostnamesWithCookies(const NetworkStorageSession&, HashSet<String>& hostnames)
{
// FIXME: Not yet implemented
}
-void deleteCookiesForHostnames(const NetworkStorageSession&, const Vector<String>&)
+void CookieJarCurlFileSystem::deleteCookiesForHostnames(const NetworkStorageSession&, const Vector<String>& cookieHostNames)
{
// FIXME: Not yet implemented
}
-void deleteAllCookies(const NetworkStorageSession&)
+void CookieJarCurlFileSystem::deleteAllCookies(const NetworkStorageSession&)
{
// FIXME: Not yet implemented
}
-void deleteAllCookiesModifiedSince(const NetworkStorageSession&, std::chrono::system_clock::time_point)
+void CookieJarCurlFileSystem::deleteAllCookiesModifiedSince(const NetworkStorageSession&, std::chrono::system_clock::time_point)
{
// FIXME: Not yet implemented
}
+// dispatcher functions
+
+String cookiesForDOM(const NetworkStorageSession& session, const URL& firstParty, const URL& url)
+{
+ return CurlContext::singleton().cookieJar().cookiesForDOM(session, firstParty, url);
}
+void setCookiesFromDOM(const NetworkStorageSession& session, const URL& firstParty, const URL& url, const String& value)
+{
+ CurlContext::singleton().cookieJar().setCookiesFromDOM(session, firstParty, url, value);
+}
+
+String cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const URL& firstParty, const URL& url)
+{
+ return CurlContext::singleton().cookieJar().cookieRequestHeaderFieldValue(session, firstParty, url);
+}
+
+bool cookiesEnabled(const NetworkStorageSession& session, const URL& firstParty, const URL& url)
+{
+ return CurlContext::singleton().cookieJar().cookiesEnabled(session, firstParty, url);
+}
+
+bool getRawCookies(const NetworkStorageSession& session, const URL& firstParty, const URL& url, Vector<Cookie>& rawCookies)
+{
+ return CurlContext::singleton().cookieJar().getRawCookies(session, firstParty, url, rawCookies);
+}
+
+void deleteCookie(const NetworkStorageSession& session, const URL& url, const String& cookie)
+{
+ CurlContext::singleton().cookieJar().deleteCookie(session, url, cookie);
+}
+
+void getHostnamesWithCookies(const NetworkStorageSession& session, HashSet<String>& hostnames)
+{
+ CurlContext::singleton().cookieJar().getHostnamesWithCookies(session, hostnames);
+}
+
+void deleteCookiesForHostnames(const NetworkStorageSession& session, const Vector<String>& cookieHostNames)
+{
+ CurlContext::singleton().cookieJar().deleteCookiesForHostnames(session, cookieHostNames);
+}
+
+void deleteAllCookies(const NetworkStorageSession& session)
+{
+ CurlContext::singleton().cookieJar().deleteAllCookies(session);
+}
+
+void deleteAllCookiesModifiedSince(const NetworkStorageSession& session, std::chrono::system_clock::time_point since)
+{
+ CurlContext::singleton().cookieJar().deleteAllCookiesModifiedSince(session, since);
+}
+
+}
+
#endif
Added: trunk/Source/WebCore/platform/network/curl/CookieJarCurl.h (0 => 220351)
--- trunk/Source/WebCore/platform/network/curl/CookieJarCurl.h (rev 0)
+++ trunk/Source/WebCore/platform/network/curl/CookieJarCurl.h 2017-08-07 20:58:50 UTC (rev 220351)
@@ -0,0 +1,56 @@
+/*
+* Copyright (C) 2017 Sony Interactive Entertainment Inc.
+*
+* 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
+*/
+
+#pragma once
+
+#include "PlatformCookieJar.h"
+
+namespace WebCore {
+
+class Cookie;
+class NetworkStorageSession;
+class URL;
+
+class CookieJarCurl {
+public:
+ virtual String cookiesForDOM(const NetworkStorageSession&, const URL& firstParty, const URL&) = 0;
+ virtual void setCookiesFromDOM(const NetworkStorageSession&, const URL& firstParty, const URL&, const String&) = 0;
+ virtual bool cookiesEnabled(const NetworkStorageSession&, const URL& firstParty, const URL&) = 0;
+ virtual String cookieRequestHeaderFieldValue(const NetworkStorageSession&, const URL& firstParty, const URL&) = 0;
+ virtual bool getRawCookies(const NetworkStorageSession&, const URL& firstParty, const URL&, Vector<Cookie>&) = 0;
+ virtual void deleteCookie(const NetworkStorageSession&, const URL&, const String&) = 0;
+ virtual void getHostnamesWithCookies(const NetworkStorageSession&, HashSet<String>& hostnames) = 0;
+ virtual void deleteCookiesForHostnames(const NetworkStorageSession&, const Vector<String>& cookieHostNames) = 0;
+ virtual void deleteAllCookies(const NetworkStorageSession&) = 0;
+ virtual void deleteAllCookiesModifiedSince(const NetworkStorageSession&, std::chrono::system_clock::time_point) = 0;
+};
+
+class CookieJarCurlFileSystem : public CookieJarCurl {
+ String cookiesForDOM(const NetworkStorageSession&, const URL& firstParty, const URL&) override;
+ void setCookiesFromDOM(const NetworkStorageSession&, const URL& firstParty, const URL&, const String&) override;
+ bool cookiesEnabled(const NetworkStorageSession&, const URL& firstParty, const URL&) override;
+ String cookieRequestHeaderFieldValue(const NetworkStorageSession&, const URL& firstParty, const URL&) override;
+ bool getRawCookies(const NetworkStorageSession&, const URL& firstParty, const URL&, Vector<Cookie>&) override;
+ void deleteCookie(const NetworkStorageSession&, const URL&, const String&) override;
+ void getHostnamesWithCookies(const NetworkStorageSession&, HashSet<String>& hostnames) override;
+ void deleteCookiesForHostnames(const NetworkStorageSession&, const Vector<String>& cookieHostNames) override;
+ void deleteAllCookies(const NetworkStorageSession&) override;
+ void deleteAllCookiesModifiedSince(const NetworkStorageSession&, std::chrono::system_clock::time_point) override;
+};
+
+}