/** * Remove all cookies. The value of the callback is true iff at least one cookie was removed. * * @param callback A callback called after the cookies (if any) are removed. */ public void removeAllCookies(ValueCallback<Boolean> callback) { try { nativeRemoveAllCookies(CookieCallback.convert(callback)); } catch (IllegalStateException e) { throw new IllegalStateException( "removeAllCookies must be called on a thread with a running Looper."); } }
/** * Set cookie for a given url. The old cookie with same host/path/name will be removed. The new * cookie will be added if it is not expired or it does not have expiration which implies it is * session cookie. * * @param url The url which cookie is set for. * @param value The value for set-cookie: in http response header. * @param callback A callback called with the success status after the cookie is set. */ public void setCookie( final String url, final String value, final ValueCallback<Boolean> callback) { try { nativeSetCookie(url, value, CookieCallback.convert(callback)); } catch (IllegalStateException e) { throw new IllegalStateException( "SetCookie must be called on a thread with a running Looper."); } }
@CalledByNative public static void invokeBooleanCookieCallback(CookieCallback<Boolean> callback, boolean result) { callback.onReceiveValue(result); }