[SOUP][WK2] Add initial WebCookieManagerSoup.cpp for webkit2
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Nov 2011 00:26:15 +0000 (00:26 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Nov 2011 00:26:15 +0000 (00:26 +0000)
https://bugs.webkit.org/show_bug.cgi?id=72235

Patch by Jongseok Yang <js45.yang@samsung.com> on 2011-11-15
Reviewed by Gustavo Noronha Silva.

Add WebCookieManagerSoup.cpp and implement functions for the cookie accept policy.
It's required when using the soup network backend.
Remove WebCookieManagerEfl.cpp and WebCookieManagerGtk.cpp because GTK port and
EFL port use soup network backend without a network backend of their own.

* GNUmakefile.am:
* WebProcess/Cookies/efl/WebCookieManagerEfl.cpp: Removed.
* WebProcess/Cookies/gtk/WebCookieManagerGtk.cpp: Removed.
* WebProcess/Cookies/soup/WebCookieManagerSoup.cpp: Added.
(WebKit::WebCookieManager::platformSetHTTPCookieAcceptPolicy):
(WebKit::WebCookieManager::platformGetHTTPCookieAcceptPolicy):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@100362 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/GNUmakefile.am
Source/WebKit2/WebProcess/Cookies/gtk/WebCookieManagerGtk.cpp [deleted file]
Source/WebKit2/WebProcess/Cookies/soup/WebCookieManagerSoup.cpp [moved from Source/WebKit2/WebProcess/Cookies/efl/WebCookieManagerEfl.cpp with 54% similarity]

index 74cc470e907e12155d325da94d60ddbf90c46190..a21f1ae3319e1667dc33b74602e4cec745d647ab 100644 (file)
@@ -1,3 +1,22 @@
+2011-11-15  Jongseok Yang  <js45.yang@samsung.com>
+
+        [SOUP][WK2] Add initial WebCookieManagerSoup.cpp for webkit2
+        https://bugs.webkit.org/show_bug.cgi?id=72235
+
+        Reviewed by Gustavo Noronha Silva.
+
+        Add WebCookieManagerSoup.cpp and implement functions for the cookie accept policy.
+        It's required when using the soup network backend.
+        Remove WebCookieManagerEfl.cpp and WebCookieManagerGtk.cpp because GTK port and
+        EFL port use soup network backend without a network backend of their own.
+
+        * GNUmakefile.am:
+        * WebProcess/Cookies/efl/WebCookieManagerEfl.cpp: Removed.
+        * WebProcess/Cookies/gtk/WebCookieManagerGtk.cpp: Removed.
+        * WebProcess/Cookies/soup/WebCookieManagerSoup.cpp: Added.
+        (WebKit::WebCookieManager::platformSetHTTPCookieAcceptPolicy):
+        (WebKit::WebCookieManager::platformGetHTTPCookieAcceptPolicy):
+
 2011-11-15  Jochen Eisinger  <jochen@chromium.org>
 
         Rename ReferrerPolicy to clarify its meaning
index 9a1e5bc989b66db596418be32276eec6af478f79..926e6f8a12bf0ce23b20b0b6c72f3941b99f465c 100644 (file)
@@ -669,7 +669,7 @@ libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_SOU
        Source/WebKit2/WebProcess/Authentication/AuthenticationManager.h \
        Source/WebKit2/WebProcess/Cookies/WebCookieManager.h \
        Source/WebKit2/WebProcess/Cookies/WebCookieManager.cpp \
-       Source/WebKit2/WebProcess/Cookies/gtk/WebCookieManagerGtk.cpp \
+       Source/WebKit2/WebProcess/Cookies/soup/WebCookieManagerSoup.cpp \
        Source/WebKit2/WebProcess/Downloads/Download.cpp \
        Source/WebKit2/WebProcess/Downloads/Download.h \
        Source/WebKit2/WebProcess/Downloads/DownloadAuthenticationClient.h \
diff --git a/Source/WebKit2/WebProcess/Cookies/gtk/WebCookieManagerGtk.cpp b/Source/WebKit2/WebProcess/Cookies/gtk/WebCookieManagerGtk.cpp
deleted file mode 100644 (file)
index acdd608..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "WebCookieManager.h"
-
-namespace WebKit {
-
-void WebCookieManager::platformSetHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy)
-{
-    // FIXME: Not implemented.
-}
-
-HTTPCookieAcceptPolicy WebCookieManager::platformGetHTTPCookieAcceptPolicy()
-{
-    // FIXME: Not implemented.
-    return HTTPCookieAcceptPolicyAlways;
-}
-
-} // namespace WebKit
similarity index 54%
rename from Source/WebKit2/WebProcess/Cookies/efl/WebCookieManagerEfl.cpp
rename to Source/WebKit2/WebProcess/Cookies/soup/WebCookieManagerSoup.cpp
index f79c94c3102837b463bb38c7e3777df27100b588..be5421b434a10dfa0fbbbe5bc1a8247451fcecad 100644 (file)
 #include "config.h"
 #include "WebCookieManager.h"
 
-#include <WebCore/NotImplemented.h>
+#include <WebCore/CookieJarSoup.h>
+#include <libsoup/soup.h>
+
+using namespace WebCore;
 
 namespace WebKit {
 
-void WebCookieManager::platformSetHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy)
+void WebCookieManager::platformSetHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy policy)
 {
-    notImplemented();
+    SoupCookieJar* cookieJar = WebCore::defaultCookieJar();
+    SoupCookieJarAcceptPolicy soupPolicy;
+
+    soupPolicy = SOUP_COOKIE_JAR_ACCEPT_ALWAYS;
+    switch (policy) {
+    case HTTPCookieAcceptPolicyAlways:
+        soupPolicy = SOUP_COOKIE_JAR_ACCEPT_ALWAYS;
+        break;
+    case HTTPCookieAcceptPolicyNever:
+        soupPolicy = SOUP_COOKIE_JAR_ACCEPT_NEVER;
+        break;
+    case HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain:
+        soupPolicy = SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY;
+        break;
+    }
+    soup_cookie_jar_set_accept_policy(cookieJar, soupPolicy);
 }
 
 HTTPCookieAcceptPolicy WebCookieManager::platformGetHTTPCookieAcceptPolicy()
 {
-    notImplemented();
-    return HTTPCookieAcceptPolicyAlways;
+    SoupCookieJar* cookieJar = WebCore::defaultCookieJar();
+    SoupCookieJarAcceptPolicy soupPolicy;
+
+    HTTPCookieAcceptPolicy policy;
+
+    soupPolicy = soup_cookie_jar_get_accept_policy(cookieJar);
+    switch (soupPolicy) {
+    case SOUP_COOKIE_JAR_ACCEPT_ALWAYS:
+        policy = HTTPCookieAcceptPolicyAlways;
+        break;
+    case SOUP_COOKIE_JAR_ACCEPT_NEVER:
+        policy = HTTPCookieAcceptPolicyNever;
+        break;
+    case SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY:
+        policy = HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain;
+        break;
+    default:
+        policy = HTTPCookieAcceptPolicyAlways;
+    }
+    return policy;
 }
 
 } // namespace WebKit