OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.content.browser; | 5 package org.chromium.content_public.browser; |
| 6 |
| 7 //import org.chromium.content_public.browser.NavigationEntry; |
6 | 8 |
7 import java.util.ArrayList; | 9 import java.util.ArrayList; |
8 | 10 |
9 /** | 11 /** |
10 * {@link NavigationHistory} captures a snapshot of the navigation history of a | 12 * {@link NavigationHistory} captures a snapshot of the navigation history of a |
11 * {@link ContentViewCore}. It is a copy and will not be updated as navigation | 13 * {@link ContentViewCore}. It is a copy and will not be updated as navigation |
12 * occurs on the source {@link ContentViewCore}. | 14 * occurs on the source {@link ContentViewCore}. |
13 */ | 15 */ |
14 public class NavigationHistory { | 16 public class NavigationHistory { |
15 | 17 |
16 private final ArrayList<NavigationEntry> mEntries = new ArrayList<Navigation
Entry>(); | 18 private final ArrayList<NavigationEntry> mEntries = new ArrayList<Navigation
Entry>(); |
17 private int mCurrentEntryIndex; | 19 private int mCurrentEntryIndex; |
18 | 20 |
19 protected void addEntry(NavigationEntry entry) { | 21 public void addEntry(NavigationEntry entry) { |
20 mEntries.add(entry); | 22 mEntries.add(entry); |
21 } | 23 } |
22 | 24 |
23 /* package */ void setCurrentEntryIndex(int currentEntryIndex) { | 25 public void setCurrentEntryIndex(int currentEntryIndex) { |
24 mCurrentEntryIndex = currentEntryIndex; | 26 mCurrentEntryIndex = currentEntryIndex; |
25 } | 27 } |
26 | 28 |
27 /** | 29 /** |
28 * @return The number of entries in the history. | 30 * @return The number of entries in the history. |
29 */ | 31 */ |
30 public int getEntryCount() { | 32 public int getEntryCount() { |
31 return mEntries.size(); | 33 return mEntries.size(); |
32 } | 34 } |
33 | 35 |
34 /** | 36 /** |
35 * Returns the {@link NavigationEntry} for the given index. | 37 * Returns the {@link NavigationEntry} for the given index. |
36 */ | 38 */ |
37 public NavigationEntry getEntryAtIndex(int index) { | 39 public NavigationEntry getEntryAtIndex(int index) { |
38 return mEntries.get(index); | 40 return mEntries.get(index); |
39 } | 41 } |
40 | 42 |
41 /** | 43 /** |
42 * Returns the index of the entry the {@link ContentViewCore} was navigated
to | 44 * Returns the index of the entry the {@link ContentViewCore} was navigated
to |
43 * when the history was fetched. | 45 * when the history was fetched. |
44 */ | 46 */ |
45 public int getCurrentEntryIndex() { | 47 public int getCurrentEntryIndex() { |
46 return mCurrentEntryIndex; | 48 return mCurrentEntryIndex; |
47 } | 49 } |
48 | 50 |
49 } | 51 } |
OLD | NEW |