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

Commit ef5b30f2 authored by Nate Fischer's avatar Nate Fischer Committed by Android (Google) Code Review
Browse files

Merge "WebView: add IntDef for SafeBrowsingThreat"

parents c314c0df 5ab00b31
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.webkit;

import android.annotation.IntDef;
import android.graphics.Bitmap;
import android.net.http.SslError;
import android.os.Message;
@@ -23,6 +24,9 @@ import android.view.InputEvent;
import android.view.KeyEvent;
import android.view.ViewRootImpl;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

public class WebViewClient {

    /**
@@ -237,6 +241,16 @@ public class WebViewClient {
    /** Resource load was cancelled by Safe Browsing */
    public static final int ERROR_UNSAFE_RESOURCE = -16;

    /** @hide */
    @IntDef({
        SAFE_BROWSING_THREAT_UNKNOWN,
        SAFE_BROWSING_THREAT_MALWARE,
        SAFE_BROWSING_THREAT_PHISHING,
        SAFE_BROWSING_THREAT_UNWANTED_SOFTWARE
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface SafeBrowsingThreat {}

    /** The resource was blocked for an unknown reason */
    public static final int SAFE_BROWSING_THREAT_UNKNOWN = 0;
    /** The resource was blocked because it contains malware */
@@ -521,8 +535,8 @@ public class WebViewClient {
     *                   SAFE_BROWSING_THREAT_* value.
     * @param callback Applications must invoke one of the callback methods.
     */
    public void onSafeBrowsingHit(WebView view, WebResourceRequest request, int threatType,
            SafeBrowsingResponse callback) {
    public void onSafeBrowsingHit(WebView view, WebResourceRequest request,
            @SafeBrowsingThreat int threatType, SafeBrowsingResponse callback) {
        callback.showInterstitial(/* allowReporting */ true);
    }
}