From 3e1fb9526199fc05fdb2266189e71728299745c0 Mon Sep 17 00:00:00 2001 From: Kristian Monsen Date: Thu, 22 Jul 2010 11:59:32 +0100 Subject: Connecting cookies set from WebCore to the chromium cookies Change-Id: Id6c9cfc92ba2aeaae15724e789e9531a451e04fa --- Android.mk | 2 +- WebCore/config.h | 4 ++++ WebKit/android/WebCoreSupport/PlatformBridge.cpp | 14 ++++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Android.mk b/Android.mk index d4a46db..df2344a 100644 --- a/Android.mk +++ b/Android.mk @@ -257,7 +257,7 @@ LOCAL_CFLAGS += -include "WebCorePrefix.h" LOCAL_CFLAGS += -fvisibility=hidden ifeq ($(HTTP_STACK),chrome) LOCAL_CFLAGS += -DGOOGLEURL -LOCAL_CFLAGS += -DCHROME_HTTP_STACK +LOCAL_CFLAGS += -DWTF_USE_CHROME_NETWORK_STACK LOCAL_CFLAGS += -include "assert.h" endif # HTTP_STACK == chrome diff --git a/WebCore/config.h b/WebCore/config.h index d9a5899..d2977b9 100644 --- a/WebCore/config.h +++ b/WebCore/config.h @@ -206,6 +206,10 @@ // webkit.org but for now, it is just an Android feature. #define ENABLE_ANDROID_OVERFLOW_SCROLL 1 +#if !defined(WTF_USE_CHROME_NETWORK_STACK) +#define WTF_USE_CHROME_NETWORK_STACK 0 +#endif /* !defined(WTF_USE_CHROME_NETWORK_STACK) */ + #endif /* PLATFORM(ANDROID) */ #ifdef __cplusplus diff --git a/WebKit/android/WebCoreSupport/PlatformBridge.cpp b/WebKit/android/WebCoreSupport/PlatformBridge.cpp index 833deb5..31e3101 100644 --- a/WebKit/android/WebCoreSupport/PlatformBridge.cpp +++ b/WebKit/android/WebCoreSupport/PlatformBridge.cpp @@ -33,6 +33,7 @@ #include "KeyGeneratorClient.h" #include "PluginView.h" #include "WebCoreFrameBridge.h" +#include "WebRequestContext.h" #include "WebViewCore.h" #include "npruntime.h" #include @@ -62,20 +63,33 @@ String PlatformBridge::getSignedPublicKeyAndChallengeString(unsigned index, cons void PlatformBridge::setCookies(const KURL& url, const String& value) { +#if USE(CHROME_NETWORK_STACK) + std::string cookieValue(value.utf8().data()); + GURL cookieGurl(url.string().utf8().data()); + WebRequestContext::GetAndroidContext()->cookie_store()->SetCookie(cookieGurl ,cookieValue); +#else CookieClient* client = JavaSharedClient::GetCookieClient(); if (!client) return; client->setCookies(url, value); +#endif } String PlatformBridge::cookies(const KURL& url) { +#if USE(CHROME_NETWORK_STACK) + GURL cookieGurl(url.string().utf8().data()); + std::string cookies = WebRequestContext::GetAndroidContext()->cookie_store()->GetCookies(cookieGurl); + String cookieString(cookies.c_str()); + return cookieString; +#else CookieClient* client = JavaSharedClient::GetCookieClient(); if (!client) return String(); return client->cookies(url); +#endif } bool PlatformBridge::cookiesEnabled() -- cgit v1.1