Hook up remaining CookieManager methods

hasCookies(), removeExpiredCookie(), removeSessionCookie() and setCookie()

Requires a change to external/webkit ...
https://android-git.corp.google.com/g/76897

Bug: 3116410
Change-Id: I46603be60e2a6b0e8bac9ca506b56d78643a3658
This commit is contained in:
Steve Block
2010-10-28 12:23:48 +01:00
parent 04d5020470
commit 93e5e14240

View File

@@ -301,6 +301,11 @@ public final class CookieManager {
* @param value The value for set-cookie: in http response header
*/
public void setCookie(String url, String value) {
if (useChromiumHttpStack()) {
nativeSetCookie(url, value);
return;
}
WebAddress uri;
try {
uri = new WebAddress(url);
@@ -522,6 +527,11 @@ public final class CookieManager {
* Remove all session cookies, which are cookies without expiration date
*/
public void removeSessionCookie() {
if (useChromiumHttpStack()) {
nativeRemoveSessionCookie();
return;
}
final Runnable clearCache = new Runnable() {
public void run() {
synchronized(CookieManager.this) {
@@ -569,6 +579,10 @@ public final class CookieManager {
* Return true if there are stored cookies.
*/
public synchronized boolean hasCookies() {
if (useChromiumHttpStack()) {
return nativeHasCookies();
}
return CookieSyncManager.getInstance().hasCookies();
}
@@ -576,6 +590,11 @@ public final class CookieManager {
* Remove all expired cookies
*/
public void removeExpiredCookie() {
if (useChromiumHttpStack()) {
nativeRemoveExpiredCookie();
return;
}
final Runnable clearCache = new Runnable() {
public void run() {
synchronized(CookieManager.this) {
@@ -1050,6 +1069,10 @@ public final class CookieManager {
private static native boolean nativeUseChromiumHttpStack();
private static native boolean nativeAcceptCookie();
private static native String nativeGetCookie(String url);
private static native boolean nativeHasCookies();
private static native void nativeRemoveAllCookie();
private static native void nativeRemoveExpiredCookie();
private static native void nativeRemoveSessionCookie();
private static native void nativeSetAcceptCookie(boolean accept);
private static native void nativeSetCookie(String url, String value);
}