InjectedScriptHost.h [plain text]
#ifndef InjectedScriptHost_h
#define InjectedScriptHost_h
#include "ConsoleTypes.h"
#include "InspectorAgent.h"
#include "ScriptState.h"
#include <wtf/RefCounted.h>
#include <wtf/Vector.h>
namespace WebCore {
class Database;
class InjectedScript;
class InspectorAgent;
class InspectorConsoleAgent;
class InspectorDOMStorageAgent;
class InspectorDatabaseAgent;
class InspectorFrontend;
class InspectorObject;
class InspectorValue;
class Node;
class ScriptObject;
class ScriptValue;
class Storage;
class InjectedScriptHost : public RefCounted<InjectedScriptHost> {
public:
static PassRefPtr<InjectedScriptHost> create();
~InjectedScriptHost();
void init(InspectorAgent* inspectorAgent
, InspectorConsoleAgent* consoleAgent
#if ENABLE(DATABASE)
, InspectorDatabaseAgent* databaseAgent
#endif
#if ENABLE(DOM_STORAGE)
, InspectorDOMStorageAgent* domStorageAgent
#endif
)
{
m_inspectorAgent = inspectorAgent;
m_consoleAgent = consoleAgent;
#if ENABLE(DATABASE)
m_databaseAgent = databaseAgent;
#endif
#if ENABLE(DOM_STORAGE)
m_domStorageAgent = domStorageAgent;
#endif
}
void setFrontend(InspectorFrontend* frontend) { m_frontend = frontend; }
void clearFrontend() { m_frontend = 0; }
static Node* scriptValueAsNode(ScriptValue);
static ScriptValue nodeAsScriptValue(ScriptState*, Node*);
void disconnect();
void addInspectedNode(Node*);
void clearInspectedNodes();
void inspectImpl(PassRefPtr<InspectorValue> objectToInspect, PassRefPtr<InspectorValue> hints);
void clearConsoleMessages();
void copyText(const String& text);
Node* inspectedNode(unsigned int num);
#if ENABLE(DATABASE)
int databaseIdImpl(Database*);
#endif
#if ENABLE(DOM_STORAGE)
int storageIdImpl(Storage*);
#endif
#if ENABLE(WORKERS)
long nextWorkerId();
void didCreateWorker(long id, const String& url, bool isSharedWorker);
void didDestroyWorker(long id);
#endif
private:
InjectedScriptHost();
InspectorAgent* m_inspectorAgent;
InspectorConsoleAgent* m_consoleAgent;
#if ENABLE(DATABASE)
InspectorDatabaseAgent* m_databaseAgent;
#endif
#if ENABLE(DOM_STORAGE)
InspectorDOMStorageAgent* m_domStorageAgent;
#endif
InspectorFrontend* m_frontend;
long m_lastWorkerId;
Vector<RefPtr<Node> > m_inspectedNodes;
};
}
#endif // !defined(InjectedScriptHost_h)