CommandLineAPIHost.h [plain text]
#ifndef CommandLineAPIHost_h
#define CommandLineAPIHost_h
#include "ScriptState.h"
#include <runtime/ConsoleTypes.h>
#include <wtf/RefCounted.h>
#include <wtf/Vector.h>
#include <wtf/text/WTFString.h>
namespace Deprecated {
class ScriptValue;
}
namespace Inspector {
class InspectorAgent;
class InspectorConsoleAgent;
class InspectorObject;
class InspectorValue;
}
namespace WebCore {
class Database;
class InspectorDOMAgent;
class InspectorDOMStorageAgent;
class InspectorDatabaseAgent;
class Node;
class Storage;
struct EventListenerInfo;
class CommandLineAPIHost : public RefCounted<CommandLineAPIHost> {
public:
static PassRefPtr<CommandLineAPIHost> create();
~CommandLineAPIHost();
void init(Inspector::InspectorAgent* inspectorAgent
, Inspector::InspectorConsoleAgent* consoleAgent
, InspectorDOMAgent* domAgent
, InspectorDOMStorageAgent* domStorageAgent
#if ENABLE(SQL_DATABASE)
, InspectorDatabaseAgent* databaseAgent
#endif
)
{
m_inspectorAgent = inspectorAgent;
m_consoleAgent = consoleAgent;
m_domAgent = domAgent;
m_domStorageAgent = domStorageAgent;
#if ENABLE(SQL_DATABASE)
m_databaseAgent = databaseAgent;
#endif
}
void disconnect();
void clearConsoleMessages();
void copyText(const String& text);
class InspectableObject {
WTF_MAKE_FAST_ALLOCATED;
public:
virtual Deprecated::ScriptValue get(JSC::ExecState*);
virtual ~InspectableObject() { }
};
void addInspectedObject(std::unique_ptr<InspectableObject>);
void clearInspectedObjects();
InspectableObject* inspectedObject(unsigned index);
void inspectImpl(PassRefPtr<Inspector::InspectorValue> objectToInspect, PassRefPtr<Inspector::InspectorValue> hints);
void getEventListenersImpl(Node*, Vector<EventListenerInfo>& listenersArray);
#if ENABLE(SQL_DATABASE)
String databaseIdImpl(Database*);
#endif
String storageIdImpl(Storage*);
private:
CommandLineAPIHost();
Inspector::InspectorAgent* m_inspectorAgent;
Inspector::InspectorConsoleAgent* m_consoleAgent;
InspectorDOMAgent* m_domAgent;
InspectorDOMStorageAgent* m_domStorageAgent;
#if ENABLE(SQL_DATABASE)
InspectorDatabaseAgent* m_databaseAgent;
#endif
Vector<std::unique_ptr<InspectableObject>> m_inspectedObjects;
std::unique_ptr<InspectableObject> m_defaultInspectableObject;
};
}
#endif // !defined(CommandLineAPIHost_h)