blob: 418a5d99498810b688ce617a2409058241304b8f [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 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080031public class WebViewDatabase {
Ben Murdoch99c12e82012-04-25 15:00:17 +010032 // TODO: deprecate/hide this.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080033 protected static final String LOGTAG = "webviewdatabase";
34
Ben Murdoch99c12e82012-04-25 15:00:17 +010035 /**
36 * @hide Only for use by WebViewProvider implementations.
37 */
38 protected WebViewDatabase() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080039 }
40
41 public static synchronized WebViewDatabase getInstance(Context context) {
Ben Murdoch99c12e82012-04-25 15:00:17 +010042 return WebViewFactory.getProvider().getWebViewDatabase(context);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080043 }
44
45 /**
Steve Block32fe4102012-07-17 16:29:11 +010046 * Gets whether there are any saved username/password pairs for web forms.
47 * Note that these are unrelated to HTTP authentication credentials.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080048 *
Steve Block32fe4102012-07-17 16:29:11 +010049 * @return true if there are any saved username/password pairs
50 * @see WebView#savePassword
51 * @see clearUsernamePassword
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080052 */
53 public boolean hasUsernamePassword() {
Ben Murdoch99c12e82012-04-25 15:00:17 +010054 throw new MustOverrideException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080055 }
56
57 /**
Steve Block32fe4102012-07-17 16:29:11 +010058 * Clears any saved username/password pairs for web forms.
59 * Note that these are unrelated to HTTP authentication credentials.
60 *
61 * @see WebView#savePassword
62 * @see hasUsernamePassword
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080063 */
64 public void clearUsernamePassword() {
Ben Murdoch99c12e82012-04-25 15:00:17 +010065 throw new MustOverrideException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080066 }
67
68 /**
Ben Murdoch99c12e82012-04-25 15:00:17 +010069 * Gets whether there are any HTTP authentication username/password combinations saved.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080070 *
Ben Murdoch99c12e82012-04-25 15:00:17 +010071 * @return true if there are any HTTP authentication username/passwords saved
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080072 */
73 public boolean hasHttpAuthUsernamePassword() {
Ben Murdoch99c12e82012-04-25 15:00:17 +010074 throw new MustOverrideException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080075 }
76
77 /**
Ben Murdoch99c12e82012-04-25 15:00:17 +010078 * Clears any HTTP authentication username/passwords that are saved.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080079 */
80 public void clearHttpAuthUsernamePassword() {
Ben Murdoch99c12e82012-04-25 15:00:17 +010081 throw new MustOverrideException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080082 }
83
84 /**
Ben Murdoch99c12e82012-04-25 15:00:17 +010085 * Gets whether there is any previously-entered form data saved.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080086 *
Ben Murdoch99c12e82012-04-25 15:00:17 +010087 * @return true if there is form data saved
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080088 */
89 public boolean hasFormData() {
Ben Murdoch99c12e82012-04-25 15:00:17 +010090 throw new MustOverrideException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080091 }
92
93 /**
Ben Murdoch99c12e82012-04-25 15:00:17 +010094 * Clears any stored previously-entered form data.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080095 */
96 public void clearFormData() {
Ben Murdoch99c12e82012-04-25 15:00:17 +010097 throw new MustOverrideException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080098 }
99}