SafeBrowsingResponse.java revision 6aabdc4dbc52a15826b4d711cd00736395f053ed
1/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.webkit;
18
19/**
20 * Used to indicate an action to take when hitting a malicious URL. Instances of this class are
21 * created by the WebView and passed to {@link WebViewClient#onSafebrowsingHit}. The host
22 * application must call {@link #showInterstitial}, {@link #proceed}, or {@link #backToSafety} to
23 * set the WebView's response to the Safe Browsing hit.
24 */
25public abstract class SafeBrowsingResponse {
26
27    /**
28     * Display the default interstitial.
29     *
30     * @param allowReporting True if the interstitial should show a reporting checkbox.
31     */
32    public abstract void showInterstitial(boolean allowReporting);
33
34    /**
35     * Act as if the user clicked "visit this unsafe site."
36     *
37     * @param report True to enable Safe Browsing reporting.
38     */
39    public abstract void proceed(boolean report);
40
41    /**
42     * Act as if the user clicked "back to safety."
43     *
44     * @param report True to enable Safe Browsing reporting.
45     */
46    public abstract void backToSafety(boolean report);
47}
48