blob: cdff41685b80197932c8fd5697a793b8ae35e703 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
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
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080019import android.content.Context;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080020
Ben Murdoch99c12e82012-04-25 15:00:17 +010021/**
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>
Steve Block32fe4102012-07-17 16:29:11 +010026 * <li>Username/password pairs for web forms</li>
Ben Murdoch99c12e82012-04-25 15:00:17 +010027 * <li>HTTP authentication username/password pairs</li>
28 * <li>Data entered into text fields (e.g. for autocomplete suggestions)</li>
29 * </ul>
30 */
Ignacio Solla451e3382014-11-10 10:35:54 +000031public abstract class WebViewDatabase {
Kristian Monsenf4912582012-08-16 15:26:24 -040032 /**
33 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}
34 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080035 protected static final String LOGTAG = "webviewdatabase";
36
John Reck9f9d3452012-09-20 13:18:59 -070037 public static WebViewDatabase getInstance(Context context) {
Ben Murdoch99c12e82012-04-25 15:00:17 +010038 return WebViewFactory.getProvider().getWebViewDatabase(context);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080039 }
40
41 /**
Steve Block32fe4102012-07-17 16:29:11 +010042 * Gets whether there are any saved username/password pairs for web forms.
43 * Note that these are unrelated to HTTP authentication credentials.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080044 *
Steve Block32fe4102012-07-17 16:29:11 +010045 * @return true if there are any saved username/password pairs
46 * @see WebView#savePassword
Ben Murdoch924ac512013-04-11 13:51:59 +010047 * @see #clearUsernamePassworda
48 * @deprecated Saving passwords in WebView will not be supported in future versions.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080049 */
Ben Murdoch924ac512013-04-11 13:51:59 +010050 @Deprecated
Ignacio Solla451e3382014-11-10 10:35:54 +000051 public abstract boolean hasUsernamePassword();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080052
53 /**
Steve Block32fe4102012-07-17 16:29:11 +010054 * Clears any saved username/password pairs for web forms.
55 * Note that these are unrelated to HTTP authentication credentials.
56 *
57 * @see WebView#savePassword
Jonathan Dixon7c282192012-11-30 15:53:28 -080058 * @see #hasUsernamePassword
Ben Murdoch924ac512013-04-11 13:51:59 +010059 * @deprecated Saving passwords in WebView will not be supported in future versions.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080060 */
Ben Murdoch924ac512013-04-11 13:51:59 +010061 @Deprecated
Ignacio Solla451e3382014-11-10 10:35:54 +000062 public abstract void clearUsernamePassword();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080063
64 /**
Steve Block46ce1db2012-07-17 16:43:00 +010065 * Gets whether there are any saved credentials for HTTP authentication.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080066 *
Steve Block46ce1db2012-07-17 16:43:00 +010067 * @return whether there are any saved credentials
Jonathan Dixon7c282192012-11-30 15:53:28 -080068 * @see WebView#getHttpAuthUsernamePassword
69 * @see WebView#setHttpAuthUsernamePassword
70 * @see #clearHttpAuthUsernamePassword
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080071 */
Ignacio Solla451e3382014-11-10 10:35:54 +000072 public abstract boolean hasHttpAuthUsernamePassword();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080073
74 /**
Steve Block46ce1db2012-07-17 16:43:00 +010075 * Clears any saved credentials for HTTP authentication.
76 *
Jonathan Dixon7c282192012-11-30 15:53:28 -080077 * @see WebView#getHttpAuthUsernamePassword
78 * @see WebView#setHttpAuthUsernamePassword
79 * @see #hasHttpAuthUsernamePassword
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080080 */
Ignacio Solla451e3382014-11-10 10:35:54 +000081 public abstract void clearHttpAuthUsernamePassword();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080082
83 /**
Steve Block219dfa42012-07-20 10:31:21 +010084 * Gets whether there is any saved data for web forms.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080085 *
Steve Block219dfa42012-07-20 10:31:21 +010086 * @return whether there is any saved data for web forms
Jonathan Dixon7c282192012-11-30 15:53:28 -080087 * @see #clearFormData
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080088 */
Ignacio Solla451e3382014-11-10 10:35:54 +000089 public abstract boolean hasFormData();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080090
91 /**
Steve Block219dfa42012-07-20 10:31:21 +010092 * Clears any saved data for web forms.
93 *
Jonathan Dixon7c282192012-11-30 15:53:28 -080094 * @see #hasFormData
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080095 */
Ignacio Solla451e3382014-11-10 10:35:54 +000096 public abstract void clearFormData();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080097}