summaryrefslogtreecommitdiffstats
path: root/WebKit/android/jni/CookieManager.cpp
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-10-25 12:20:52 +0100
committerSteve Block <steveblock@google.com>2010-10-27 19:46:29 +0100
commit965d128a2f803da81a8a6d04c3d79382ff827bb9 (patch)
treed5912955a57cbfd3d43229c4c9848f9bd525862e /WebKit/android/jni/CookieManager.cpp
parent43d943757c6b39710fa65034351bc2e84946e8ce (diff)
downloadexternal_webkit-965d128a2f803da81a8a6d04c3d79382ff827bb9.zip
external_webkit-965d128a2f803da81a8a6d04c3d79382ff827bb9.tar.gz
external_webkit-965d128a2f803da81a8a6d04c3d79382ff827bb9.tar.bz2
Hook up CookieManager.acceptCookie() and setAcceptCookie() for the Chromium HTTP stack
We also update PlatformBridge::cookiesEnabled() to query the Chromium HTTP stack directly. This avoids calling CookieClient::cookiesEnabled(), which calls the Java CookieManager::acceptCookie() which in turns calls back to native code. Also requires a change to frameworks/base ... https://android-git.corp.google.com/g/76065 Bug: 3116410 Change-Id: Id853463f3bcef76b220e8c44dd2b30c0d6752624
Diffstat (limited to 'WebKit/android/jni/CookieManager.cpp')
-rw-r--r--WebKit/android/jni/CookieManager.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/WebKit/android/jni/CookieManager.cpp b/WebKit/android/jni/CookieManager.cpp
index 7139286..e1e139e 100644
--- a/WebKit/android/jni/CookieManager.cpp
+++ b/WebKit/android/jni/CookieManager.cpp
@@ -44,6 +44,21 @@ static bool useChromiumHttpStack(JNIEnv*, jobject) {
#endif
}
+static bool acceptCookie(JNIEnv*, jobject) {
+#if USE(CHROME_NETWORK_STACK)
+ // This is a static method which gets the cookie policy for all WebViews. We
+ // always apply the same configuration to the contexts for both regular and
+ // private browsing, so expect the same result here.
+ bool regularAcceptCookies = WebRequestContext::get(false)->allowCookies();
+ ASSERT(regularAcceptCookies == WebRequestContext::get(true)->allowCookies());
+ return regularAcceptCookies;
+#else
+ // The Android HTTP stack is implemented Java-side.
+ ASSERT_NOT_REACHED();
+ return false;
+#endif
+}
+
static void removeAllCookie(JNIEnv*, jobject) {
#if USE(CHROME_NETWORK_STACK)
// Though WebRequestContext::get() is threadsafe, the context itself, in
@@ -62,9 +77,21 @@ static void removeAllCookie(JNIEnv*, jobject) {
#endif
}
+static void setAcceptCookie(JNIEnv*, jobject, jboolean accept) {
+#if USE(CHROME_NETWORK_STACK)
+ // This is a static method which configures the cookie policy for all
+ // WebViews, so we configure the contexts for both regular and private
+ // browsing.
+ WebRequestContext::get(false)->setAllowCookies(accept);
+ WebRequestContext::get(true)->setAllowCookies(accept);
+#endif
+}
+
static JNINativeMethod gCookieManagerMethods[] = {
{ "nativeUseChromiumHttpStack", "()Z", (void*) useChromiumHttpStack },
+ { "nativeAcceptCookie", "()Z", (void*) acceptCookie },
{ "nativeRemoveAllCookie", "()V", (void*) removeAllCookie },
+ { "nativeSetAcceptCookie", "(Z)V", (void*) setAcceptCookie },
};
int registerCookieManager(JNIEnv* env)