Home | History | Annotate | Download | only in webkit
      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 
     19 import 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 entered into 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  */
     31 public class WebViewDatabase {
     32     // TODO: deprecate/hide this.
     33     protected static final String LOGTAG = "webviewdatabase";
     34 
     35     /**
     36      * @hide Only for use by WebViewProvider implementations.
     37      */
     38     protected WebViewDatabase() {
     39     }
     40 
     41     public static synchronized WebViewDatabase getInstance(Context context) {
     42         return WebViewFactory.getProvider().getWebViewDatabase(context);
     43     }
     44 
     45     /**
     46      * Gets whether there are any username/password combinations
     47      * from web pages saved.
     48      *
     49      * @return true if there are any username/passwords used in web
     50      *         forms saved
     51      */
     52     public boolean hasUsernamePassword() {
     53         throw new MustOverrideException();
     54     }
     55 
     56     /**
     57      * Clears any username/password combinations saved from web forms.
     58      */
     59     public void clearUsernamePassword() {
     60         throw new MustOverrideException();
     61     }
     62 
     63     /**
     64      * Gets whether there are any HTTP authentication username/password combinations saved.
     65      *
     66      * @return true if there are any HTTP authentication username/passwords saved
     67      */
     68     public boolean hasHttpAuthUsernamePassword() {
     69         throw new MustOverrideException();
     70     }
     71 
     72     /**
     73      * Clears any HTTP authentication username/passwords that are saved.
     74      */
     75     public void clearHttpAuthUsernamePassword() {
     76         throw new MustOverrideException();
     77     }
     78 
     79     /**
     80      * Gets whether there is any previously-entered form data saved.
     81      *
     82      * @return true if there is form data saved
     83      */
     84     public boolean hasFormData() {
     85         throw new MustOverrideException();
     86     }
     87 
     88     /**
     89      * Clears any stored previously-entered form data.
     90      */
     91     public void clearFormData() {
     92         throw new MustOverrideException();
     93     }
     94 }
     95