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     @SystemApi
39     @Deprecated
getId()40     public abstract int getId();
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.
47      */
getUrl()48     public abstract String getUrl();
49 
50     /**
51      * Return the original url of this history item. This was the requested
52      * url, the final url may be different as there might have been
53      * redirects while loading the site.
54      * @return The original url of this history item.
55      */
getOriginalUrl()56     public abstract String getOriginalUrl();
57 
58     /**
59      * Return the document title of this history item.
60      * @return The document title of this history item.
61      */
getTitle()62     public abstract String getTitle();
63 
64     /**
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}.
67      */
68     @Nullable
getFavicon()69     public abstract Bitmap getFavicon();
70 
71     /**
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.
75      */
clone()76     protected abstract WebHistoryItem clone();
77 }
78