#ifndef InspectorDatabaseAgent_h
#define InspectorDatabaseAgent_h
#include "InspectorFrontend.h"
#include "core/inspector/InspectorBaseAgent.h"
#include "heap/Handle.h"
#include "wtf/HashMap.h"
#include "wtf/PassOwnPtr.h"
#include "wtf/text/WTFString.h"
namespace WebCore {
class Database;
class DocumentLoader;
class LocalFrame;
class InspectorDatabaseResource;
class InspectorFrontend;
class InstrumentingAgents;
typedef String ErrorString;
class InspectorDatabaseAgent FINAL : public InspectorBaseAgent<InspectorDatabaseAgent>, public InspectorBackendDispatcher::DatabaseCommandHandler {
public:
static PassOwnPtr<InspectorDatabaseAgent> create()
{
return adoptPtr(new InspectorDatabaseAgent());
}
virtual ~InspectorDatabaseAgent();
virtual void setFrontend(InspectorFrontend*) OVERRIDE;
virtual void clearFrontend() OVERRIDE;
virtual void restore() OVERRIDE;
virtual void didCommitLoadForMainFrame() OVERRIDE;
virtual void enable(ErrorString*) OVERRIDE;
virtual void disable(ErrorString*) OVERRIDE;
virtual void getDatabaseTableNames(ErrorString*, const String& databaseId, RefPtr<TypeBuilder::Array<String> >& names) OVERRIDE;
virtual void executeSQL(ErrorString*, const String& databaseId, const String& query, PassRefPtr<ExecuteSQLCallback>) OVERRIDE;
void didOpenDatabase(PassRefPtrWillBeRawPtr<Database>, const String& domain, const String& name, const String& version);
private:
explicit InspectorDatabaseAgent();
Database* databaseForId(const String& databaseId);
InspectorDatabaseResource* findByFileName(const String& fileName);
InspectorFrontend::Database* m_frontend;
typedef WillBePersistentHeapHashMap<String, RefPtrWillBeMember<InspectorDatabaseResource> > DatabaseResourcesHeapMap;
DatabaseResourcesHeapMap m_resources;
bool m_enabled;
};
}
#endif