Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 26ed99f3 authored by Jonathan Dixon's avatar Jonathan Dixon Committed by Android (Google) Code Review
Browse files

Merge "static methods in CookieManger call via instance"

parents 5479e291 be58c406
Loading
Loading
Loading
Loading
+20 −4
Original line number Diff line number Diff line
@@ -166,9 +166,17 @@ public class CookieManager {
     * @return True if {@link WebView} instances send and accept cookies for
     *         file scheme URLs
     */
    // Static for backward compatibility.
    public static boolean allowFileSchemeCookies() {
        // TODO: indirect this via the WebViewFactoryProvider.Statics interface. http://b/6379925
        return CookieManagerClassic.allowFileSchemeCookies();
        return getInstance().allowFileSchemeCookiesImpl();
    }

    /**
     * Implements {@link #allowFileSchemeCookies()}
     * @hide Only for use by WebViewProvider implementations
     */
    protected boolean allowFileSchemeCookiesImpl() {
        throw new MustOverrideException();
    }

    /**
@@ -181,8 +189,16 @@ public class CookieManager {
     * Note that calls to this method will have no effect if made after a
     * {@link WebView} or CookieManager instance has been created.
     */
    // Static for backward compatibility.
    public static void setAcceptFileSchemeCookies(boolean accept) {
        // TODO: indirect this via the WebViewFactoryProvider.Statics interface. http://b/6379925
        CookieManagerClassic.setAcceptFileSchemeCookies(accept);
        getInstance().setAcceptFileSchemeCookiesImpl(accept);
    }

    /**
     * Implements {@link #setAcceptFileSchemeCookies(boolean)}
     * @hide Only for use by WebViewProvider implementations
     */
    protected void setAcceptFileSchemeCookiesImpl(boolean accept) {
        throw new MustOverrideException();
    }
}
+4 −18
Original line number Diff line number Diff line
@@ -159,27 +159,13 @@ class CookieManagerClassic extends CookieManager {
        nativeFlushCookieStore();
    }

    /**
     * Gets whether the application's {@link WebView} instances send and accept
     * cookies for file scheme URLs.
     * @return True if {@link WebView} instances send and accept cookies for
     *         file scheme URLs
     */
    public static boolean allowFileSchemeCookies() {
    @Override
    protected boolean allowFileSchemeCookiesImpl() {
        return nativeAcceptFileSchemeCookies();
    }

    /**
     * Sets whether the application's {@link WebView} instances should send and
     * accept cookies for file scheme URLs.
     * Use of cookies with file scheme URLs is potentially insecure. Do not use
     * this feature unless you can be sure that no unintentional sharing of
     * cookie data can take place.
     * <p>
     * Note that calls to this method will have no effect if made after a
     * {@link WebView} or CookieManager instance has been created.
     */
    public static void setAcceptFileSchemeCookies(boolean accept) {
    @Override
    protected void setAcceptFileSchemeCookiesImpl(boolean accept) {
        nativeSetAcceptFileSchemeCookies(accept);
    }