1 // Copyright (c) 2013 Intel Corporation. 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.xwalk.core;
7 import java.io.Serializable;
9 import org.chromium.content.browser.NavigationHistory;
11 // Wrap NavigationHistory in content as WebBackForwardList.
12 public class WebBackForwardList implements Cloneable, Serializable {
13 private NavigationHistory mHistory;
15 public WebBackForwardList(NavigationHistory history) {
19 public WebBackForwardList(WebBackForwardList list) {
20 mHistory = list.mHistory;
23 public synchronized WebHistoryItem getCurrentItem() {
24 return getItemAtIndex(getCurrentIndex());
27 public synchronized int getCurrentIndex() {
28 return mHistory.getCurrentEntryIndex();
31 public synchronized WebHistoryItem getItemAtIndex(int index) {
32 return new WebHistoryItem(mHistory.getEntryAtIndex(index));
35 public synchronized int getSize() {
36 return mHistory.getEntryCount();
39 protected synchronized WebBackForwardList clone() {
40 return new WebBackForwardList(this);