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 InspectorDOMAgent;
class InspectorDOMStorageAgent;
class InspectorDatabaseAgent;
class InspectorFrontend;
class InspectorObject;
class InspectorValue;
class Node;
class ScriptObject;
class ScriptValue;
class Storage;
struct EventListenerInfo;
class InjectedScriptHost : public RefCounted<InjectedScriptHost> {
public:
static PassRefPtr<InjectedScriptHost> create();
~InjectedScriptHost();
void init(InspectorAgent* inspectorAgent
, InspectorConsoleAgent* consoleAgent
#if ENABLE(SQL_DATABASE)
, InspectorDatabaseAgent* databaseAgent
#endif
, InspectorDOMStorageAgent* domStorageAgent
, InspectorDOMAgent* domAgent
)
{
m_inspectorAgent = inspectorAgent;
m_consoleAgent = consoleAgent;
#if ENABLE(SQL_DATABASE)
m_databaseAgent = databaseAgent;
#endif
m_domStorageAgent = domStorageAgent;
m_domAgent = domAgent;
}
static Node* scriptValueAsNode(ScriptValue);
static ScriptValue nodeAsScriptValue(ScriptState*, Node*);
void disconnect();
class InspectableObject {
public:
virtual ScriptValue get(ScriptState*);
virtual ~InspectableObject() { }
};
void addInspectedObject(PassOwnPtr<InspectableObject>);
void clearInspectedObjects();
InspectableObject* inspectedObject(unsigned int num);
void inspectImpl(PassRefPtr<InspectorValue> objectToInspect, PassRefPtr<InspectorValue> hints);
void getEventListenersImpl(Node*, Vector<EventListenerInfo>& listenersArray);
void clearConsoleMessages();
void copyText(const String& text);
#if ENABLE(SQL_DATABASE)
String databaseIdImpl(Database*);
#endif
String storageIdImpl(Storage*);
#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(SQL_DATABASE)
InspectorDatabaseAgent* m_databaseAgent;
#endif
InspectorDOMStorageAgent* m_domStorageAgent;
InspectorDOMAgent* m_domAgent;
long m_lastWorkerId;
Vector<OwnPtr<InspectableObject> > m_inspectedObjects;
OwnPtr<InspectableObject> m_defaultInspectableObject;
};
}
#endif // !defined(InjectedScriptHost_h)