#ifndef InjectedScriptHost_h
#define InjectedScriptHost_h
#include "bindings/v8/ScriptState.h"
#include "bindings/v8/ScriptWrappable.h"
#include "wtf/PassOwnPtr.h"
#include "wtf/RefCounted.h"
#include "wtf/Vector.h"
#include "wtf/text/WTFString.h"
namespace WebCore {
class Database;
class EventTarget;
class InjectedScript;
class InstrumentingAgents;
class JSONValue;
class Node;
class ScriptDebugServer;
class ScriptValue;
class Storage;
struct EventListenerInfo;
class InjectedScriptHost : public RefCounted<InjectedScriptHost>, public ScriptWrappable {
public:
static PassRefPtr<InjectedScriptHost> create();
~InjectedScriptHost();
void init(InstrumentingAgents* instrumentingAgents, ScriptDebugServer* scriptDebugServer)
{
m_instrumentingAgents = instrumentingAgents;
m_scriptDebugServer = scriptDebugServer;
}
static Node* scriptValueAsNode(ScriptValue);
static ScriptValue nodeAsScriptValue(ScriptState*, Node*);
void disconnect();
class InspectableObject {
WTF_MAKE_FAST_ALLOCATED;
public:
virtual ScriptValue get(ScriptState*);
virtual ~InspectableObject() { }
};
void addInspectedObject(PassOwnPtr<InspectableObject>);
void clearInspectedObjects();
InspectableObject* inspectedObject(unsigned num);
void inspectImpl(PassRefPtr<JSONValue> objectToInspect, PassRefPtr<JSONValue> hints);
void getEventListenersImpl(EventTarget*, Vector<EventListenerInfo>& listenersArray);
void clearConsoleMessages();
void debugFunction(const String& scriptId, int lineNumber, int columnNumber);
void undebugFunction(const String& scriptId, int lineNumber, int columnNumber);
void monitorFunction(const String& scriptId, int lineNumber, int columnNumber, const String& functionName);
void unmonitorFunction(const String& scriptId, int lineNumber, int columnNumber);
ScriptDebugServer& scriptDebugServer() { return *m_scriptDebugServer; }
private:
InjectedScriptHost();
InstrumentingAgents* m_instrumentingAgents;
ScriptDebugServer* m_scriptDebugServer;
Vector<OwnPtr<InspectableObject> > m_inspectedObjects;
OwnPtr<InspectableObject> m_defaultInspectableObject;
};
}
#endif