Debian Codegraph @

core/java/android/webkit/WebIconDatabase.java

raw symbols SCIP
1 /*
2 * Copyright (C) 2006 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.annotation.SystemApi;
20 import android.content.ContentResolver;
21 import android.graphics.Bitmap;
22
23 /**
24 * Functions for manipulating the icon database used by WebView.
25 * These functions require that a WebView be constructed before being invoked
26 * and WebView.getIconDatabase() will return a WebIconDatabase object. This
27 * WebIconDatabase object is a single instance and all methods operate on that
28 * single object.
29 * The main use-case for this class is calling {@link #open}
30 * to enable favicon functionality on all WebView instances in this process.
31 *
32 * @deprecated This class is only required when running on devices
33 * up to {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2}
34 */
35 @Deprecated
36 public abstract class WebIconDatabase {
37 /**
38 * Interface for receiving icons from the database.
39 * @deprecated This interface is obsolete.
40 */
41 @Deprecated
42 public interface IconListener {
43 /**
44 * Called when the icon has been retrieved from the database and the
45 * result is non-null.
46 * @param url The url passed in the request.
47 * @param icon The favicon for the given url.
48 */
49 public void onReceivedIcon(String url, Bitmap icon);
50 }
51
52 /**
53 * Open a the icon database and store the icons in the given path.
54 * @param path The directory path where the icon database will be stored.
55 */
56 public abstract void open(String path);
57
58 /**
59 * Close the shared instance of the icon database.
60 */
61 public abstract void close();
62
63 /**
64 * Removes all the icons in the database.
65 */
66 public abstract void removeAllIcons();
67
68 /**
69 * Request the Bitmap representing the icon for the given page
70 * url. If the icon exists, the listener will be called with the result.
71 * @param url The page's url.
72 * @param listener An implementation on IconListener to receive the result.
73 */
74 public abstract void requestIconForPageUrl(String url, IconListener listener);
75
76 /** {@hide}
77 */
78 @SuppressWarnings("HiddenAbstractMethod")
79 @SystemApi
80 public abstract void bulkRequestIconForPageUrl(ContentResolver cr, String where,
81 IconListener listener);
82
83 /**
84 * Retain the icon for the given page url.
85 * @param url The page's url.
86 */
87 public abstract void retainIconForPageUrl(String url);
88
89 /**
90 * Release the icon for the given page url.
91 * @param url The page's url.
92 */
93 public abstract void releaseIconForPageUrl(String url);
94
95 /**
96 * Get the global instance of WebIconDatabase.
97 * @return A single instance of WebIconDatabase. It will be the same
98 * instance for the current process each time this method is
99 * called.
100 */
101 public static WebIconDatabase getInstance() {
102 // XXX: Must be created in the UI thread.
103 return WebViewFactory.getProvider().getWebIconDatabase();
104 }
105 }