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

Commit 68945491 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "WebView: add @Nullable and @NonNull annotations"

parents d17e402a 3442c74d
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -16,13 +16,14 @@

package android.webkit;

import android.annotation.Nullable;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Map;


/**
 * Manages the HTTP cache used by an application's {@link WebView} instances.
 * @deprecated Access to the HTTP cache will be removed in a future release.
@@ -233,6 +234,7 @@ public final class CacheManager {
     * @deprecated This method no longer has any effect and always returns {@code null}.
     */
    @Deprecated
    @Nullable
    public static File getCacheFileBaseDir() {
        return null;
    }
@@ -287,6 +289,7 @@ public final class CacheManager {
     * @deprecated This method no longer has any effect and always returns {@code null}.
     */
    @Deprecated
    @Nullable
    public static CacheResult getCacheFile(String url,
            Map<String, String> headers) {
        return null;
+6 −2
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package android.webkit;

import android.annotation.Nullable;

import java.security.Principal;
import java.security.PrivateKey;
import java.security.cert.X509Certificate;
@@ -42,14 +44,16 @@ public abstract class ClientCertRequest {
    public ClientCertRequest() { }

    /**
     * Returns the acceptable types of asymmetric keys (can be {@code null}).
     * Returns the acceptable types of asymmetric keys.
     */
    @Nullable
    public abstract String[] getKeyTypes();

    /**
     * Returns the acceptable certificate issuers for the certificate
     *            matching the private key (can be {@code null}).
     *            matching the private key.
     */
    @Nullable
    public abstract Principal[] getPrincipals();

    /**
+5 −3
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.webkit;

import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.net.WebAddress;

@@ -116,7 +117,8 @@ public abstract class CookieManager {
     *              HTTP response header
     * @param callback a callback to be executed when the cookie has been set
     */
    public abstract void setCookie(String url, String value, ValueCallback<Boolean> callback);
    public abstract void setCookie(String url, String value, @Nullable ValueCallback<Boolean>
            callback);

    /**
     * Gets the cookies for the given URL.
@@ -175,7 +177,7 @@ public abstract class CookieManager {
     * method from a thread without a Looper.
     * @param callback a callback which is executed when the session cookies have been removed
     */
    public abstract void removeSessionCookies(ValueCallback<Boolean> callback);
    public abstract void removeSessionCookies(@Nullable ValueCallback<Boolean> callback);

    /**
     * Removes all cookies.
@@ -197,7 +199,7 @@ public abstract class CookieManager {
     * method from a thread without a Looper.
     * @param callback a callback which is executed when the cookies have been removed
     */
    public abstract void removeAllCookies(ValueCallback<Boolean> callback);
    public abstract void removeAllCookies(@Nullable ValueCallback<Boolean> callback);

    /**
     * Gets whether there are stored cookies.
+6 −3
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.webkit;

import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.content.Context;
import android.content.res.Resources;
@@ -87,10 +88,12 @@ public class FindActionModeCallback implements ActionMode.Callback, TextWatcher,
        mMatchesFound = false;
    }

    /*
     * Set the WebView to search.  Must be non null.
    /**
     * Set the WebView to search.
     *
     * @param webView an implementation of WebView
     */
    public void setWebView(WebView webView) {
    public void setWebView(@NonNull WebView webView) {
        if (null == webView) {
            throw new AssertionError("WebView supplied to "
                    + "FindActionModeCallback cannot be null");
+4 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.webkit;

import android.annotation.Nullable;
import android.text.TextUtils;

import libcore.net.MimeUtils;
@@ -86,6 +87,7 @@ public class MimeTypeMap {
     * @param extension A file extension without the leading '.'
     * @return The MIME type for the given extension or {@code null} iff there is none.
     */
    @Nullable
    public String getMimeTypeFromExtension(String extension) {
        return MimeUtils.guessMimeTypeFromExtension(extension);
    }
@@ -111,6 +113,7 @@ public class MimeTypeMap {
     * @param mimeType A MIME type (i.e. text/plain)
     * @return The extension for the given MIME type or {@code null} iff there is none.
     */
    @Nullable
    public String getExtensionFromMimeType(String mimeType) {
        return MimeUtils.guessExtensionFromMimeType(mimeType);
    }
@@ -125,7 +128,7 @@ public class MimeTypeMap {
     * @param contentDisposition Content-disposition header given by the server.
     * @return The MIME type that should be used for this data.
     */
    /* package */ String remapGenericMimeType(String mimeType, String url,
    /* package */ String remapGenericMimeType(@Nullable String mimeType, String url,
            String contentDisposition) {
        // If we have one of "generic" MIME types, try to deduce
        // the right MIME type from the file extension (if any):
Loading