1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 package org.chromium.content.browser;
7 import java.util.ArrayList;
10 * {@link NavigationHistory} captures a snapshot of the navigation history of a
11 * {@link ContentView}. It is a copy and will not be updated as navigation
12 * occurs on the source {@link ContentView}.
14 public class NavigationHistory {
16 private ArrayList<NavigationEntry> entries = new ArrayList<NavigationEntry>();
17 private int mCurrentEntryIndex;
19 protected void addEntry(NavigationEntry entry) {
23 /* package */ void setCurrentEntryIndex(int currentEntryIndex) {
24 mCurrentEntryIndex = currentEntryIndex;
28 * @return The number of entries in the history.
30 public int getEntryCount() {
31 return entries.size();
35 * Returns the {@link NavigationEntry} for the given index.
37 public NavigationEntry getEntryAtIndex(int index) {
38 return entries.get(index);
42 * Returns the index of the entry the {@link ContentView} was navigated to
43 * when the history was fetched.
45 public int getCurrentEntryIndex() {
46 return mCurrentEntryIndex;