The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 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 | |
| 17 | package android.webkit; |
| 18 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 19 | import android.content.Context; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 20 | |
Ben Murdoch | 99c12e8 | 2012-04-25 15:00:17 +0100 | [diff] [blame] | 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> |
Steve Block | 32fe410 | 2012-07-17 16:29:11 +0100 | [diff] [blame] | 26 | * <li>Username/password pairs for web forms</li> |
Ben Murdoch | 99c12e8 | 2012-04-25 15:00:17 +0100 | [diff] [blame] | 27 | * <li>HTTP authentication username/password pairs</li> |
| 28 | * <li>Data entered into text fields (e.g. for autocomplete suggestions)</li> |
| 29 | * </ul> |
| 30 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 31 | public abstract class WebViewDatabase { |
Kristian Monsen | f491258 | 2012-08-16 15:26:24 -0400 | [diff] [blame] | 32 | /** |
| 33 | * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} |
| 34 | */ |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 35 | protected static final String LOGTAG = "webviewdatabase"; |
| 36 | |
John Reck | 9f9d345 | 2012-09-20 13:18:59 -0700 | [diff] [blame] | 37 | public static WebViewDatabase getInstance(Context context) { |
Ben Murdoch | 99c12e8 | 2012-04-25 15:00:17 +0100 | [diff] [blame] | 38 | return WebViewFactory.getProvider().getWebViewDatabase(context); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 39 | } |
| 40 | |
| 41 | /** |
Steve Block | 32fe410 | 2012-07-17 16:29:11 +0100 | [diff] [blame] | 42 | * 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 Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 44 | * |
Steve Block | 32fe410 | 2012-07-17 16:29:11 +0100 | [diff] [blame] | 45 | * @return true if there are any saved username/password pairs |
| 46 | * @see WebView#savePassword |
Ben Murdoch | 924ac51 | 2013-04-11 13:51:59 +0100 | [diff] [blame] | 47 | * @see #clearUsernamePassworda |
| 48 | * @deprecated Saving passwords in WebView will not be supported in future versions. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 49 | */ |
Ben Murdoch | 924ac51 | 2013-04-11 13:51:59 +0100 | [diff] [blame] | 50 | @Deprecated |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 51 | public abstract boolean hasUsernamePassword(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 52 | |
| 53 | /** |
Steve Block | 32fe410 | 2012-07-17 16:29:11 +0100 | [diff] [blame] | 54 | * 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 Dixon | 7c28219 | 2012-11-30 15:53:28 -0800 | [diff] [blame] | 58 | * @see #hasUsernamePassword |
Ben Murdoch | 924ac51 | 2013-04-11 13:51:59 +0100 | [diff] [blame] | 59 | * @deprecated Saving passwords in WebView will not be supported in future versions. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 60 | */ |
Ben Murdoch | 924ac51 | 2013-04-11 13:51:59 +0100 | [diff] [blame] | 61 | @Deprecated |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 62 | public abstract void clearUsernamePassword(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 63 | |
| 64 | /** |
Steve Block | 46ce1db | 2012-07-17 16:43:00 +0100 | [diff] [blame] | 65 | * Gets whether there are any saved credentials for HTTP authentication. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 66 | * |
Steve Block | 46ce1db | 2012-07-17 16:43:00 +0100 | [diff] [blame] | 67 | * @return whether there are any saved credentials |
Jonathan Dixon | 7c28219 | 2012-11-30 15:53:28 -0800 | [diff] [blame] | 68 | * @see WebView#getHttpAuthUsernamePassword |
| 69 | * @see WebView#setHttpAuthUsernamePassword |
| 70 | * @see #clearHttpAuthUsernamePassword |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 71 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 72 | public abstract boolean hasHttpAuthUsernamePassword(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 73 | |
| 74 | /** |
Steve Block | 46ce1db | 2012-07-17 16:43:00 +0100 | [diff] [blame] | 75 | * Clears any saved credentials for HTTP authentication. |
| 76 | * |
Jonathan Dixon | 7c28219 | 2012-11-30 15:53:28 -0800 | [diff] [blame] | 77 | * @see WebView#getHttpAuthUsernamePassword |
| 78 | * @see WebView#setHttpAuthUsernamePassword |
| 79 | * @see #hasHttpAuthUsernamePassword |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 80 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 81 | public abstract void clearHttpAuthUsernamePassword(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 82 | |
| 83 | /** |
Steve Block | 219dfa4 | 2012-07-20 10:31:21 +0100 | [diff] [blame] | 84 | * Gets whether there is any saved data for web forms. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 85 | * |
Steve Block | 219dfa4 | 2012-07-20 10:31:21 +0100 | [diff] [blame] | 86 | * @return whether there is any saved data for web forms |
Jonathan Dixon | 7c28219 | 2012-11-30 15:53:28 -0800 | [diff] [blame] | 87 | * @see #clearFormData |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 88 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 89 | public abstract boolean hasFormData(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 90 | |
| 91 | /** |
Steve Block | 219dfa4 | 2012-07-20 10:31:21 +0100 | [diff] [blame] | 92 | * Clears any saved data for web forms. |
| 93 | * |
Jonathan Dixon | 7c28219 | 2012-11-30 15:53:28 -0800 | [diff] [blame] | 94 | * @see #hasFormData |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 95 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 96 | public abstract void clearFormData(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 97 | } |