InspectorFileSystemAgent.cpp [plain text]
#include "config.h"
#if ENABLE(INSPECTOR) && ENABLE(FILE_SYSTEM)
#include "InspectorFileSystemAgent.h"
#include "DOMFileSystem.h"
#include "InspectorState.h"
#include "InstrumentingAgents.h"
namespace WebCore {
namespace FileSystemAgentState {
static const char fileSystemAgentEnabled[] = "fileSystemAgentEnabled";
}
PassOwnPtr<InspectorFileSystemAgent> InspectorFileSystemAgent::create(InstrumentingAgents* instrumentingAgents, InspectorState* state)
{
return adoptPtr(new InspectorFileSystemAgent(instrumentingAgents, state));
}
InspectorFileSystemAgent::~InspectorFileSystemAgent()
{
m_instrumentingAgents->setInspectorFileSystemAgent(0);
}
void InspectorFileSystemAgent::didOpenFileSystem(PassRefPtr<DOMFileSystem> fileSystem)
{
}
void InspectorFileSystemAgent::fileSystemInvalidated(PassRefPtr<DOMFileSystem> fileSystem)
{
}
void InspectorFileSystemAgent::enable(ErrorString*)
{
if (m_enabled)
return;
m_enabled = true;
m_state->setBoolean(FileSystemAgentState::fileSystemAgentEnabled, m_enabled);
}
void InspectorFileSystemAgent::disable(ErrorString*)
{
if (!m_enabled)
return;
m_enabled = false;
m_state->setBoolean(FileSystemAgentState::fileSystemAgentEnabled, m_enabled);
}
void InspectorFileSystemAgent::setFrontend(InspectorFrontend* frontend)
{
ASSERT(frontend);
m_frontend = frontend->filesystem();
}
void InspectorFileSystemAgent::clearFrontend()
{
m_frontend = 0;
m_enabled = false;
m_state->setBoolean(FileSystemAgentState::fileSystemAgentEnabled, m_enabled);
}
void InspectorFileSystemAgent::restore()
{
m_enabled = m_state->getBoolean(FileSystemAgentState::fileSystemAgentEnabled);
}
InspectorFileSystemAgent::InspectorFileSystemAgent(InstrumentingAgents* instrumentingAgents, InspectorState* state)
: InspectorBaseAgent<InspectorFileSystemAgent>("FileSystem", instrumentingAgents, state),
m_frontend(0),
m_enabled(false)
{
ASSERT(instrumentingAgents);
ASSERT(state);
m_instrumentingAgents->setInspectorFileSystemAgent(this);
}
}
#endif // ENABLE(INSPECTOR) && ENABLE(FILE_SYSTEM)