diff options
Diffstat (limited to 'Source/WebKit/android/jni/CookieManager.cpp')
-rw-r--r-- | Source/WebKit/android/jni/CookieManager.cpp | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/Source/WebKit/android/jni/CookieManager.cpp b/Source/WebKit/android/jni/CookieManager.cpp index 357d158..fca612f 100644 --- a/Source/WebKit/android/jni/CookieManager.cpp +++ b/Source/WebKit/android/jni/CookieManager.cpp @@ -40,49 +40,30 @@ static const char* javaCookieManagerClass = "android/webkit/CookieManager"; 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 = WebCookieJar::get(false)->allowCookies(); ASSERT(regularAcceptCookies == WebCookieJar::get(true)->allowCookies()); return regularAcceptCookies; -#else - // The Android HTTP stack is implemented Java-side. - ASSERT_NOT_REACHED(); - return false; -#endif } static jstring getCookie(JNIEnv* env, jobject, jstring url, jboolean privateBrowsing) { -#if USE(CHROME_NETWORK_STACK) GURL gurl(jstringToStdString(env, url)); CookieOptions options; options.set_include_httponly(); std::string cookies = WebCookieJar::get(privateBrowsing)->cookieStore()->GetCookieMonster()->GetCookiesWithOptions(gurl, options); return stdStringToJstring(env, cookies); -#else - // The Android HTTP stack is implemented Java-side. - ASSERT_NOT_REACHED(); - return jstring(); -#endif } static bool hasCookies(JNIEnv*, jobject, jboolean privateBrowsing) { -#if USE(CHROME_NETWORK_STACK) return WebCookieJar::get(privateBrowsing)->getNumCookiesInDatabase() > 0; -#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) WebCookieJar::get(false)->cookieStore()->GetCookieMonster()->DeleteAll(true); // This will lazily create a new private browsing context. However, if the // context doesn't already exist, there's no need to create it, as cookies @@ -94,84 +75,62 @@ static void removeAllCookie(JNIEnv*, jobject) // The Java code removes cookies directly from the backing database, so we do the same, // but with a NULL callback so it's asynchronous. WebCookieJar::get(true)->cookieStore()->GetCookieMonster()->FlushStore(NULL); -#endif } static void removeExpiredCookie(JNIEnv*, jobject) { -#if USE(CHROME_NETWORK_STACK) // This simply forces a GC. The getters delete expired cookies so won't return expired cookies anyway. WebCookieJar::get(false)->cookieStore()->GetCookieMonster()->GetAllCookies(); WebCookieJar::get(true)->cookieStore()->GetCookieMonster()->GetAllCookies(); -#endif } static void removeSessionCookies(WebCookieJar* cookieJar) { -#if USE(CHROME_NETWORK_STACK) CookieMonster* cookieMonster = cookieJar->cookieStore()->GetCookieMonster(); CookieList cookies = cookieMonster->GetAllCookies(); for (CookieList::const_iterator iter = cookies.begin(); iter != cookies.end(); ++iter) { if (iter->IsSessionCookie()) cookieMonster->DeleteCanonicalCookie(*iter); } -#endif } static void removeSessionCookie(JNIEnv*, jobject) { -#if USE(CHROME_NETWORK_STACK) removeSessionCookies(WebCookieJar::get(false)); removeSessionCookies(WebCookieJar::get(true)); -#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. WebCookieJar::get(false)->setAllowCookies(accept); WebCookieJar::get(true)->setAllowCookies(accept); -#endif } static void setCookie(JNIEnv* env, jobject, jstring url, jstring value, jboolean privateBrowsing) { -#if USE(CHROME_NETWORK_STACK) GURL gurl(jstringToStdString(env, url)); std::string line(jstringToStdString(env, value)); CookieOptions options; options.set_include_httponly(); WebCookieJar::get(privateBrowsing)->cookieStore()->GetCookieMonster()->SetCookieWithOptions(gurl, line, options); -#endif } static void flushCookieStore(JNIEnv*, jobject) { -#if USE(CHROME_NETWORK_STACK) WebCookieJar::flush(); -#endif } static bool acceptFileSchemeCookies(JNIEnv*, jobject) { -#if USE(CHROME_NETWORK_STACK) return WebCookieJar::acceptFileSchemeCookies(); -#else - // File scheme cookies are always accepted with the Android HTTP stack. - return true; -#endif } static void setAcceptFileSchemeCookies(JNIEnv*, jobject, jboolean accept) { -#if USE(CHROME_NETWORK_STACK) WebCookieJar::setAcceptFileSchemeCookies(accept); -#else - // File scheme cookies are always accepted with the Android HTTP stack. -#endif } static JNINativeMethod gCookieManagerMethods[] = { |