StorageNamespaceProxy.cpp [plain text]
#include "config.h"
#include "StorageNamespaceProxy.h"
#include "Chrome.h"
#include "ChromeClientImpl.h"
#include "Page.h"
#include "SecurityOrigin.h"
#include "StorageAreaProxy.h"
#include "WebKit.h"
#include "platform/WebKitPlatformSupport.h"
#include "WebStorageNamespace.h"
#include "platform/WebString.h"
#include "WebViewClient.h"
#include "WebViewImpl.h"
namespace WebCore {
PassRefPtr<StorageNamespace> StorageNamespace::localStorageNamespace(const String& path, unsigned quota)
{
return adoptRef(new StorageNamespaceProxy(WebKit::webKitPlatformSupport()->createLocalStorageNamespace(path, quota), LocalStorage));
}
PassRefPtr<StorageNamespace> StorageNamespace::sessionStorageNamespace(Page* page, unsigned quota)
{
WebKit::WebViewClient* webViewClient = static_cast<WebKit::WebViewImpl*>(page->chrome()->client()->webView())->client();
return adoptRef(new StorageNamespaceProxy(webViewClient->createSessionStorageNamespace(quota), SessionStorage));
}
StorageNamespaceProxy::StorageNamespaceProxy(WebKit::WebStorageNamespace* storageNamespace, StorageType storageType)
: m_storageNamespace(adoptPtr(storageNamespace))
, m_storageType(storageType)
{
}
StorageNamespaceProxy::~StorageNamespaceProxy()
{
}
PassRefPtr<StorageNamespace> StorageNamespaceProxy::copy()
{
ASSERT(m_storageType == SessionStorage);
WebKit::WebStorageNamespace* newNamespace = m_storageNamespace->copy();
if (!newNamespace)
return 0;
return adoptRef(new StorageNamespaceProxy(newNamespace, m_storageType));
}
PassRefPtr<StorageArea> StorageNamespaceProxy::storageArea(PassRefPtr<SecurityOrigin> origin)
{
return adoptRef(new StorageAreaProxy(m_storageNamespace->createStorageArea(origin->toString()), m_storageType));
}
void StorageNamespaceProxy::close()
{
}
void StorageNamespaceProxy::clearOriginForDeletion(SecurityOrigin* origin)
{
ASSERT_NOT_REACHED();
}
void StorageNamespaceProxy::clearAllOriginsForDeletion()
{
ASSERT_NOT_REACHED();
}
void StorageNamespaceProxy::sync()
{
ASSERT_NOT_REACHED();
}
bool StorageNamespaceProxy::isSameNamespace(const WebKit::WebStorageNamespace& sessionNamespace)
{
return m_storageNamespace->isSameNamespace(sessionNamespace);
}
}