| 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.Nullable; |
| 20 | import android.annotation.SystemApi; |
| 21 | import android.graphics.Bitmap; |
| 22 | |
| 23 | /** |
| 24 | * A convenience class for accessing fields in an entry in the back/forward list |
| 25 | * of a WebView. Each WebHistoryItem is a snapshot of the requested history |
| 26 | * item. |
| 27 | * @see WebBackForwardList |
| 28 | */ |
| 29 | public abstract class WebHistoryItem implements Cloneable { |
| 30 | /** |
| 31 | * Return an identifier for this history item. If an item is a copy of |
| 32 | * another item, the identifiers will be the same even if they are not the |
| 33 | * same object. |
| 34 | * @return The id for this item. |
| 35 | * @deprecated This method is now obsolete. |
| 36 | * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} |
| 37 | */ |
| 38 | @SuppressWarnings("HiddenAbstractMethod") |
| 39 | @SystemApi |
| 40 | @Deprecated |
| 41 | public abstract int getId(); |
| 42 | |
| 43 | /** |
| 44 | * Return the url of this history item. The url is the base url of this |
| 45 | * history item. See getTargetUrl() for the url that is the actual target of |
| 46 | * this history item. |
| 47 | * @return The base url of this history item. |
| 48 | */ |
| 49 | public abstract String getUrl(); |
| 50 | |
| 51 | /** |
| 52 | * Return the original url of this history item. This was the requested |
| 53 | * url, the final url may be different as there might have been |
| 54 | * redirects while loading the site. |
| 55 | * @return The original url of this history item. |
| 56 | */ |
| 57 | public abstract String getOriginalUrl(); |
| 58 | |
| 59 | /** |
| 60 | * Return the document title of this history item. |
| 61 | * @return The document title of this history item. |
| 62 | */ |
| 63 | public abstract String getTitle(); |
| 64 | |
| 65 | /** |
| 66 | * Return the favicon of this history item or {@code null} if no favicon was found. |
| 67 | * @return A Bitmap containing the favicon for this history item or {@code null}. |
| 68 | */ |
| 69 | @Nullable |
| 70 | public abstract Bitmap getFavicon(); |
| 71 | |
| 72 | /** |
| 73 | * Clone the history item for use by clients of WebView. On Android 4.4 and later |
| 74 | * there is no need to use this, as the object is already a read-only copy of the |
| 75 | * internal state. |
| 76 | */ |
| 77 | protected abstract WebHistoryItem clone(); |
| 78 | } |