1/*
2 * Copyright (C) 2007 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
19import android.content.Context;
20
21/**
22 * This class allows developers to determine whether any WebView used in the
23 * application has stored any of the following types of browsing data and
24 * to clear any such stored data for all WebViews in the application.
25 * <ul>
26 *  <li>Username/password pairs for web forms</li>
27 *  <li>HTTP authentication username/password pairs</li>
28 *  <li>Data entered into text fields (e.g. for autocomplete suggestions)</li>
29 * </ul>
30 */
31public class WebViewDatabase {
32    /**
33     * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}
34     */
35    protected static final String LOGTAG = "webviewdatabase";
36
37    /**
38     * @hide Only for use by WebViewProvider implementations.
39     */
40    protected WebViewDatabase() {
41    }
42
43    public static WebViewDatabase getInstance(Context context) {
44        return WebViewFactory.getProvider().getWebViewDatabase(context);
45    }
46
47    /**
48     * Gets whether there are any saved username/password pairs for web forms.
49     * Note that these are unrelated to HTTP authentication credentials.
50     *
51     * @return true if there are any saved username/password pairs
52     * @see WebView#savePassword
53     * @see clearUsernamePassword
54     */
55    public boolean hasUsernamePassword() {
56        throw new MustOverrideException();
57    }
58
59    /**
60     * Clears any saved username/password pairs for web forms.
61     * Note that these are unrelated to HTTP authentication credentials.
62     *
63     * @see WebView#savePassword
64     * @see hasUsernamePassword
65     */
66    public void clearUsernamePassword() {
67        throw new MustOverrideException();
68    }
69
70    /**
71     * Gets whether there are any saved credentials for HTTP authentication.
72     *
73     * @return whether there are any saved credentials
74     * @see Webview#getHttpAuthUsernamePassword
75     * @see Webview#setHttpAuthUsernamePassword
76     * @see clearHttpAuthUsernamePassword
77     */
78    public boolean hasHttpAuthUsernamePassword() {
79        throw new MustOverrideException();
80    }
81
82    /**
83     * Clears any saved credentials for HTTP authentication.
84     *
85     * @see Webview#getHttpAuthUsernamePassword
86     * @see Webview#setHttpAuthUsernamePassword
87     * @see hasHttpAuthUsernamePassword
88     */
89    public void clearHttpAuthUsernamePassword() {
90        throw new MustOverrideException();
91    }
92
93    /**
94     * Gets whether there is any saved data for web forms.
95     *
96     * @return whether there is any saved data for web forms
97     * @see clearFormData
98     */
99    public boolean hasFormData() {
100        throw new MustOverrideException();
101    }
102
103    /**
104     * Clears any saved data for web forms.
105     *
106     * @see hasFormData
107     */
108    public void clearFormData() {
109        throw new MustOverrideException();
110    }
111}
112