diff options
| author | Steve Block <steveblock@google.com> | 2010-10-27 11:47:48 -0700 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-10-27 11:47:48 -0700 |
| commit | 7a1cdbe26e28fbeb8a8a9f82e855c4e48b58bcdc (patch) | |
| tree | e918a62449c9b6d6b2d96c4c58c77294a91e75f4 /WebKit/android/jni/CookieManager.cpp | |
| parent | 3b32bbf4fe3975f697d36b61341c918b599542b8 (diff) | |
| parent | 965d128a2f803da81a8a6d04c3d79382ff827bb9 (diff) | |
| download | external_webkit-7a1cdbe26e28fbeb8a8a9f82e855c4e48b58bcdc.zip external_webkit-7a1cdbe26e28fbeb8a8a9f82e855c4e48b58bcdc.tar.gz external_webkit-7a1cdbe26e28fbeb8a8a9f82e855c4e48b58bcdc.tar.bz2 | |
Merge "Hook up CookieManager.acceptCookie() and setAcceptCookie() for the Chromium HTTP stack"
Diffstat (limited to 'WebKit/android/jni/CookieManager.cpp')
| -rw-r--r-- | WebKit/android/jni/CookieManager.cpp | 27 |
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) |
