The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 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 | |
Nate Fischer | 3442c74 | 2017-09-08 17:02:00 -0700 | [diff] [blame] | 19 | import android.annotation.Nullable; |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 20 | import android.annotation.SystemApi; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 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 |
Torne (Richard Coles) | e4b8664 | 2018-06-19 16:29:54 -0400 | [diff] [blame] | 26 | * item. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 27 | * @see WebBackForwardList |
| 28 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 29 | public abstract class WebHistoryItem implements Cloneable { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 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. |
Kristian Monsen | fc77165 | 2011-05-10 16:44:05 +0100 | [diff] [blame] | 35 | * @deprecated This method is now obsolete. |
Kristian Monsen | f491258 | 2012-08-16 15:26:24 -0400 | [diff] [blame] | 36 | * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 37 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 38 | @SystemApi |
Kristian Monsen | fc77165 | 2011-05-10 16:44:05 +0100 | [diff] [blame] | 39 | @Deprecated |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 40 | public abstract int getId(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 41 | |
| 42 | /** |
| 43 | * Return the url of this history item. The url is the base url of this |
| 44 | * history item. See getTargetUrl() for the url that is the actual target of |
| 45 | * this history item. |
| 46 | * @return The base url of this history item. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 47 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 48 | public abstract String getUrl(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 49 | |
| 50 | /** |
| 51 | * Return the original url of this history item. This was the requested |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 52 | * url, the final url may be different as there might have been |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 53 | * redirects while loading the site. |
| 54 | * @return The original url of this history item. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 55 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 56 | public abstract String getOriginalUrl(); |
| 57 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 58 | /** |
| 59 | * Return the document title of this history item. |
| 60 | * @return The document title of this history item. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 61 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 62 | public abstract String getTitle(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 63 | |
| 64 | /** |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 65 | * Return the favicon of this history item or {@code null} if no favicon was found. |
| 66 | * @return A Bitmap containing the favicon for this history item or {@code null}. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 67 | */ |
Nate Fischer | 3442c74 | 2017-09-08 17:02:00 -0700 | [diff] [blame] | 68 | @Nullable |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 69 | public abstract Bitmap getFavicon(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 70 | |
| 71 | /** |
Torne (Richard Coles) | e4b8664 | 2018-06-19 16:29:54 -0400 | [diff] [blame] | 72 | * Clone the history item for use by clients of WebView. On Android 4.4 and later |
| 73 | * there is no need to use this, as the object is already a read-only copy of the |
| 74 | * internal state. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 75 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 76 | protected abstract WebHistoryItem clone(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 77 | } |