#ifndef BackForwardList_h
#define BackForwardList_h
#include "BackForwardClient.h"
#include <wtf/HashSet.h>
#include <wtf/Vector.h>
namespace WebCore {
class Page;
typedef Vector<RefPtr<HistoryItem>> HistoryItemVector;
typedef HashSet<RefPtr<HistoryItem>> HistoryItemHashSet;
class BackForwardList : public BackForwardClient {
public:
static PassRefPtr<BackForwardList> create(Page* page) { return adoptRef(new BackForwardList(page)); }
virtual ~BackForwardList();
Page* page() { return m_page; }
virtual void addItem(PassRefPtr<HistoryItem>) override;
void goBack();
void goForward();
virtual void goToItem(HistoryItem*) override;
HistoryItem* backItem();
HistoryItem* currentItem();
HistoryItem* forwardItem();
virtual HistoryItem* itemAtIndex(int) override;
void backListWithLimit(int, HistoryItemVector&);
void forwardListWithLimit(int, HistoryItemVector&);
int capacity();
void setCapacity(int);
bool enabled();
void setEnabled(bool);
virtual int backListCount() override;
virtual int forwardListCount() override;
bool containsItem(HistoryItem*);
virtual void close() override;
bool closed();
void removeItem(HistoryItem*);
HistoryItemVector& entries();
#if PLATFORM(IOS)
virtual unsigned current() override;
virtual void setCurrent(unsigned newCurrent) override;
virtual bool clearAllPageCaches() override;
#endif
private:
explicit BackForwardList(Page*);
Page* m_page;
HistoryItemVector m_entries;
HistoryItemHashSet m_entryHash;
unsigned m_current;
unsigned m_capacity;
bool m_closed;
bool m_enabled;
};
}
#endif // BackForwardList_h