blob: 4d3bbe475920b236c8850fd90e5bf08f466f7f61 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
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
17package android.webkit;
18
Nate Fischer3442c742017-09-08 17:02:00 -070019import android.annotation.Nullable;
20
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080021import java.io.Serializable;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080022
23/**
24 * This class contains the back/forward list for a WebView.
25 * WebView.copyBackForwardList() will return a copy of this class used to
26 * inspect the entries in the list.
27 */
Ignacio Solla451e3382014-11-10 10:35:54 +000028public abstract class WebBackForwardList implements Cloneable, Serializable {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080029 /**
Nate Fischer0a6140d2017-09-05 12:37:49 -070030 * Return the current history item. This method returns {@code null} if the list is
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080031 * empty.
32 * @return The current history item.
33 */
Nate Fischer3442c742017-09-08 17:02:00 -070034 @Nullable
Ignacio Solla451e3382014-11-10 10:35:54 +000035 public abstract WebHistoryItem getCurrentItem();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080036
37 /**
38 * Get the index of the current history item. This index can be used to
39 * directly index into the array list.
40 * @return The current index from 0...n or -1 if the list is empty.
41 */
Ignacio Solla451e3382014-11-10 10:35:54 +000042 public abstract int getCurrentIndex();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080043
44 /**
45 * Get the history item at the given index. The index range is from 0...n
46 * where 0 is the first item and n is the last item.
47 * @param index The index to retrieve.
48 */
Ignacio Solla451e3382014-11-10 10:35:54 +000049 public abstract WebHistoryItem getItemAtIndex(int index);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080050
51 /**
52 * Get the total size of the back/forward list.
53 * @return The size of the list.
54 */
Ignacio Solla451e3382014-11-10 10:35:54 +000055 public abstract int getSize();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080056
57 /**
58 * Clone the entire object to be used in the UI thread by clients of
59 * WebView. This creates a copy that should never be modified by any of the
Torne (Richard Coles)e4b86642018-06-19 16:29:54 -040060 * webkit package classes. On Android 4.4 and later there is no need to use
61 * this, as the object is already a read-only copy of the internal state.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080062 */
Ignacio Solla451e3382014-11-10 10:35:54 +000063 protected abstract WebBackForwardList clone();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080064}