#pragma once
#if ENABLE(INDEXED_DATABASE)
#include <functional>
#include <wtf/Forward.h>
#include <wtf/Ref.h>
#include <wtf/ThreadSafeRefCounted.h>
#include <wtf/Vector.h>
namespace JSC {
class JSValue;
}
namespace WebCore {
class IDBOpenDBRequest;
class ScriptExecutionContext;
class SecurityOrigin;
struct ExceptionCodeWithMessage;
namespace IDBClient {
class IDBConnectionProxy;
}
typedef int ExceptionCode;
class IDBFactory : public ThreadSafeRefCounted<IDBFactory> {
public:
static Ref<IDBFactory> create(IDBClient::IDBConnectionProxy&);
~IDBFactory();
RefPtr<IDBOpenDBRequest> open(ScriptExecutionContext&, const String& name, Optional<uint64_t> version, ExceptionCodeWithMessage&);
RefPtr<IDBOpenDBRequest> deleteDatabase(ScriptExecutionContext&, const String& name, ExceptionCodeWithMessage&);
short cmp(ScriptExecutionContext&, JSC::JSValue first, JSC::JSValue second, ExceptionCodeWithMessage&);
WEBCORE_EXPORT void getAllDatabaseNames(const SecurityOrigin& mainFrameOrigin, const SecurityOrigin& openingOrigin, std::function<void (const Vector<String>&)>);
private:
explicit IDBFactory(IDBClient::IDBConnectionProxy&);
RefPtr<IDBOpenDBRequest> openInternal(ScriptExecutionContext&, const String& name, unsigned long long version, ExceptionCodeWithMessage&);
Ref<IDBClient::IDBConnectionProxy> m_connectionProxy;
};
}
#endif // ENABLE(INDEXED_DATABASE)