#ifndef InspectorAgent_h
#define InspectorAgent_h
#include "PlatformString.h"
#include <wtf/Forward.h>
#include <wtf/HashMap.h>
#include <wtf/Vector.h>
namespace WebCore {
class DOMWrapperWorld;
class DocumentLoader;
class Frame;
class InjectedScriptManager;
class InspectorFrontend;
class InspectorObject;
class InspectorWorkerResource;
class InstrumentingAgents;
class KURL;
class Page;
typedef String ErrorString;
class InspectorAgent {
WTF_MAKE_NONCOPYABLE(InspectorAgent);
WTF_MAKE_FAST_ALLOCATED;
public:
InspectorAgent(Page*, InjectedScriptManager*, InstrumentingAgents*);
virtual ~InspectorAgent();
void inspectedPageDestroyed();
bool enabled() const;
KURL inspectedURL() const;
KURL inspectedURLWithoutFragment() const;
void reloadPage(ErrorString*, bool ignoreCache);
void showConsole();
void setFrontend(InspectorFrontend*);
InspectorFrontend* frontend() const { return m_frontend; }
void clearFrontend();
void restore();
void didClearWindowObjectInWorld(Frame*, DOMWrapperWorld*);
void didCommitLoad();
void domContentLoadedEventFired();
#if ENABLE(WORKERS)
enum WorkerAction { WorkerCreated, WorkerDestroyed };
void postWorkerNotificationToFrontend(const InspectorWorkerResource&, WorkerAction);
void didCreateWorker(intptr_t, const String& url, bool isSharedWorker);
void didDestroyWorker(intptr_t);
#endif
bool hasFrontend() const { return m_frontend; }
#if ENABLE(JAVASCRIPT_DEBUGGER)
void showProfilesPanel();
#endif
void evaluateForTestInFrontend(long testCallId, const String& script);
void setInspectorExtensionAPI(const String& source);
void getInspectorState(RefPtr<InspectorObject>* state);
void setMonitoringXHREnabled(bool enabled, bool* newState);
private:
void showPanel(const String& panel);
void unbindAllResources();
#if ENABLE(JAVASCRIPT_DEBUGGER)
void toggleRecordButton(bool);
#endif
bool isMainResourceLoader(DocumentLoader*, const KURL& requestUrl);
void issueEvaluateForTestCommands();
Page* m_inspectedPage;
InspectorFrontend* m_frontend;
InstrumentingAgents* m_instrumentingAgents;
InjectedScriptManager* m_injectedScriptManager;
Vector<pair<long, String> > m_pendingEvaluateTestCommands;
String m_showPanelAfterVisible;
String m_inspectorExtensionAPI;
#if ENABLE(WORKERS)
typedef HashMap<intptr_t, RefPtr<InspectorWorkerResource> > WorkersMap;
WorkersMap m_workers;
#endif
bool m_canIssueEvaluateForTestInFrontend;
};
}
#endif // !defined(InspectorAgent_h)