#include "IDBKey.h"
#include "IDBKeyRange.h"
#include "IDBRequest.h"
+#include "IDBVersionChangeRequest.h"
#include "Page.h"
#include "PageGroup.h"
#include "SecurityOrigin.h"
namespace WebCore {
IDBFactory::IDBFactory(IDBFactoryBackendInterface* factory)
- : m_factoryBackend(factory)
+ : m_backend(factory)
{
// We pass a reference to this object before it can be adopted.
relaxAdoptionRequirement();
RefPtr<IDBRequest> request = IDBRequest::create(document, IDBAny::create(this), 0);
GroupSettings* groupSettings = document->page()->group().groupSettings();
- m_factoryBackend->getDatabaseNames(request, document->securityOrigin(), document->frame(), groupSettings->indexedDBDatabasePath());
+ m_backend->getDatabaseNames(request, document->securityOrigin(), document->frame(), groupSettings->indexedDBDatabasePath());
return request;
}
RefPtr<IDBRequest> request = IDBRequest::create(document, IDBAny::create(this), 0);
GroupSettings* groupSettings = document->page()->group().groupSettings();
- m_factoryBackend->open(name, request, document->securityOrigin(), document->frame(), groupSettings->indexedDBDatabasePath());
+#if ENABLE(TIZEN_INDEXED_DATABASE)
+ m_backend->open(document, name, request, document->securityOrigin(), document->frame(), groupSettings->indexedDBDatabasePath());
+#else
+ m_backend->open(name, request, document->securityOrigin(), document->frame(), groupSettings->indexedDBDatabasePath());
+#endif // TIZEN_INDEXED_DATABASE
+ return request;
+}
+
+PassRefPtr<IDBVersionChangeRequest> IDBFactory::deleteDatabase(ScriptExecutionContext* context, const String& name, ExceptionCode& ec)
+{
+ if (!context->isDocument()) {
+ // FIXME: make this work with workers.
+ return 0;
+ }
+
+ Document* document = static_cast<Document*>(context);
+ if (!document->frame() || !document->page())
+ return 0;
+
+ if (name.isNull()) {
+ ec = IDBDatabaseException::NON_TRANSIENT_ERR;
+ return 0;
+ }
+
+ RefPtr<IDBVersionChangeRequest> request = IDBVersionChangeRequest::create(document, IDBAny::createNull(), "");
+ GroupSettings* groupSettings = document->page()->group().groupSettings();
+#if ENABLE(TIZEN_INDEXED_DATABASE)
+ m_backend->deleteDatabase(document, name, request, document->securityOrigin(), document->frame(), groupSettings->indexedDBDatabasePath());
+#else
+ m_backend->deleteDatabase(name, request, document->securityOrigin(), document->frame(), groupSettings->indexedDBDatabasePath());
+#endif // TIZEN_INDEXED_DATABASE
return request;
}
ASSERT(first);
ASSERT(second);
- if (first->type() == IDBKey::NullType || second->type() == IDBKey::NullType) {
+ if (first->type() == IDBKey::InvalidType || second->type() == IDBKey::InvalidType) {
ec = IDBDatabaseException::DATA_ERR;
return 0;
}