blob: 1987f53570d2ef0c2b61459e05eda87c1893496c [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 /**
Steve Block46ce1db2012-07-17 16:43:00 +010069 * Gets whether there are any saved credentials for HTTP authentication.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080070 *
Steve Block46ce1db2012-07-17 16:43:00 +010071 * @return whether there are any saved credentials
72 * @see Webview#getHttpAuthUsernamePassword
73 * @see Webview#setHttpAuthUsernamePassword
74 * @see clearHttpAuthUsernamePassword
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080075 */
76 public boolean hasHttpAuthUsernamePassword() {
Ben Murdoch99c12e82012-04-25 15:00:17 +010077 throw new MustOverrideException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080078 }
79
80 /**
Steve Block46ce1db2012-07-17 16:43:00 +010081 * Clears any saved credentials for HTTP authentication.
82 *
83 * @see Webview#getHttpAuthUsernamePassword
84 * @see Webview#setHttpAuthUsernamePassword
85 * @see hasHttpAuthUsernamePassword
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080086 */
87 public void clearHttpAuthUsernamePassword() {
Ben Murdoch99c12e82012-04-25 15:00:17 +010088 throw new MustOverrideException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080089 }
90
91 /**
Steve Block219dfa42012-07-20 10:31:21 +010092 * Gets whether there is any saved data for web forms.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080093 *
Steve Block219dfa42012-07-20 10:31:21 +010094 * @return whether there is any saved data for web forms
95 * @see clearFormData
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080096 */
97 public boolean hasFormData() {
Ben Murdoch99c12e82012-04-25 15:00:17 +010098 throw new MustOverrideException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080099 }
100
101 /**
Steve Block219dfa42012-07-20 10:31:21 +0100102 * Clears any saved data for web forms.
103 *
104 * @see hasFormData
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800105 */
106 public void clearFormData() {
Ben Murdoch99c12e82012-04-25 15:00:17 +0100107 throw new MustOverrideException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800108 }
109}