BackForwardListBlackBerry.cpp [plain text]
#include "config.h"
#include "BackForwardListBlackBerry.h"
#include "HistoryItem.h"
#include "WebPage_p.h"
using namespace BlackBerry::WebKit;
namespace WebCore {
BackForwardListBlackBerry::BackForwardListBlackBerry(WebPagePrivate* pagePrivate)
: m_impl(BackForwardListImpl::create(pagePrivate->m_page))
, m_webPagePrivate(pagePrivate)
{
}
BackForwardListBlackBerry::~BackForwardListBlackBerry()
{
}
int BackForwardListBlackBerry::current()
{
return m_impl->backListCount();
}
void BackForwardListBlackBerry::notifyBackForwardListChanged()
{
m_webPagePrivate->m_client->resetBackForwardList(m_impl->entries().size(), current());
}
void BackForwardListBlackBerry::addItem(PassRefPtr<HistoryItem> prpItem)
{
if (!isActive())
return;
m_impl->addItem(prpItem);
notifyBackForwardListChanged();
}
void BackForwardListBlackBerry::goToItem(HistoryItem* item)
{
if (!m_impl->entries().size() || !item)
return;
int oldIndex = current();
m_impl->goToItem(item);
if (oldIndex != current())
notifyBackForwardListChanged();
else {
addItem(item);
}
}
HistoryItem* BackForwardListBlackBerry::itemAtIndex(int index)
{
return m_impl->itemAtIndex(index);
}
int BackForwardListBlackBerry::backListCount()
{
return m_impl->backListCount();
}
int BackForwardListBlackBerry::forwardListCount()
{
return m_impl->forwardListCount();
}
bool BackForwardListBlackBerry::isActive()
{
return m_impl->enabled() && m_impl->capacity();
}
void BackForwardListBlackBerry::close()
{
return m_impl->close();
}
void BackForwardListBlackBerry::clear()
{
int capacity = m_impl->capacity();
m_impl->setCapacity(0);
m_impl->setCapacity(capacity);
}
HistoryItemVector& BackForwardListBlackBerry::entries()
{
return m_impl->entries();
}
void BackForwardListBlackBerry::backListWithLimit(int limit, HistoryItemVector& list)
{
m_impl->backListWithLimit(limit, list);
}
void BackForwardListBlackBerry::forwardListWithLimit(int limit, HistoryItemVector& list)
{
m_impl->forwardListWithLimit(limit, list);
}
int BackForwardListBlackBerry::capacity()
{
return m_impl->capacity();
}
HistoryItem* BackForwardListBlackBerry::currentItem()
{
return m_impl->currentItem();
}
};