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 java.io.Serializable;
21 
22 /**
23  * This class contains the back/forward list for a WebView.
24  * WebView.copyBackForwardList() will return a copy of this class used to
25  * inspect the entries in the list.
26  */
27 public abstract class WebBackForwardList implements Cloneable, Serializable {
28     /**
29      * Return the current history item. This method returns null if the list is
30      * empty.
31      * @return The current history item.
32      */
getCurrentItem()33     public abstract WebHistoryItem getCurrentItem();
34 
35     /**
36      * Get the index of the current history item. This index can be used to
37      * directly index into the array list.
38      * @return The current index from 0...n or -1 if the list is empty.
39      */
getCurrentIndex()40     public abstract int getCurrentIndex();
41 
42     /**
43      * Get the history item at the given index. The index range is from 0...n
44      * where 0 is the first item and n is the last item.
45      * @param index The index to retrieve.
46      */
getItemAtIndex(int index)47     public abstract WebHistoryItem getItemAtIndex(int index);
48 
49     /**
50      * Get the total size of the back/forward list.
51      * @return The size of the list.
52      */
getSize()53     public abstract int getSize();
54 
55     /**
56      * Clone the entire object to be used in the UI thread by clients of
57      * WebView. This creates a copy that should never be modified by any of the
58      * webkit package classes.
59      */
clone()60     protected abstract WebBackForwardList clone();
61 }
62