This source file includes following definitions.
- queryUsageAndQuota
- requestQuota
- getStorageQuota
- trace
#include "config.h"
#include "modules/quota/DeprecatedStorageInfo.h"
#include "core/dom/Document.h"
#include "core/dom/ExceptionCode.h"
#include "core/dom/ExecutionContext.h"
#include "modules/quota/DeprecatedStorageQuota.h"
#include "modules/quota/StorageErrorCallback.h"
#include "modules/quota/StorageQuotaCallback.h"
#include "modules/quota/StorageUsageCallback.h"
namespace WebCore {
DeprecatedStorageInfo::DeprecatedStorageInfo()
{
ScriptWrappable::init(this);
}
DeprecatedStorageInfo::~DeprecatedStorageInfo()
{
}
void DeprecatedStorageInfo::queryUsageAndQuota(ExecutionContext* executionContext, int storageType, PassOwnPtr<StorageUsageCallback> successCallback, PassOwnPtr<StorageErrorCallback> errorCallback)
{
DeprecatedStorageQuota* storageQuota = getStorageQuota(storageType);
if (!storageQuota) {
executionContext->postTask(StorageErrorCallback::CallbackTask::create(errorCallback, NotSupportedError));
return;
}
storageQuota->queryUsageAndQuota(executionContext, successCallback, errorCallback);
}
void DeprecatedStorageInfo::requestQuota(ExecutionContext* executionContext, int storageType, unsigned long long newQuotaInBytes, PassOwnPtr<StorageQuotaCallback> successCallback, PassOwnPtr<StorageErrorCallback> errorCallback)
{
DeprecatedStorageQuota* storageQuota = getStorageQuota(storageType);
if (!storageQuota) {
executionContext->postTask(StorageErrorCallback::CallbackTask::create(errorCallback, NotSupportedError));
return;
}
storageQuota->requestQuota(executionContext, newQuotaInBytes, successCallback, errorCallback);
}
DeprecatedStorageQuota* DeprecatedStorageInfo::getStorageQuota(int storageType)
{
switch (storageType) {
case TEMPORARY:
if (!m_temporaryStorage)
m_temporaryStorage = DeprecatedStorageQuota::create(DeprecatedStorageQuota::Temporary);
return m_temporaryStorage.get();
case PERSISTENT:
if (!m_persistentStorage)
m_persistentStorage = DeprecatedStorageQuota::create(DeprecatedStorageQuota::Persistent);
return m_persistentStorage.get();
}
return 0;
}
void DeprecatedStorageInfo::trace(Visitor* visitor)
{
visitor->trace(m_temporaryStorage);
visitor->trace(m_persistentStorage);
}
}