#ifndef WebDevToolsAgentImpl_h
#define WebDevToolsAgentImpl_h
#include "core/inspector/InspectorClient.h"
#include "core/inspector/InspectorFrontendChannel.h"
#include "WebDevToolsAgentPrivate.h"
#include "WebPageOverlay.h"
#include "public/platform/WebSize.h"
#include "public/platform/WebThread.h"
#include "wtf/Forward.h"
#include "wtf/OwnPtr.h"
#include "wtf/Vector.h"
namespace WebCore {
class Document;
class LocalFrame;
class FrameView;
class GraphicsContext;
class InspectorClient;
class InspectorController;
class Node;
class PlatformKeyboardEvent;
}
namespace blink {
class WebDevToolsAgentClient;
class WebFrame;
class WebFrameImpl;
class WebString;
class WebURLRequest;
class WebURLResponse;
class WebViewImpl;
struct WebMemoryUsageInfo;
struct WebURLError;
struct WebDevToolsMessageData;
class WebDevToolsAgentImpl FINAL :
public WebDevToolsAgentPrivate,
public WebCore::InspectorClient,
public WebCore::InspectorFrontendChannel,
public WebPageOverlay,
private WebThread::TaskObserver {
public:
WebDevToolsAgentImpl(WebViewImpl* webViewImpl, WebDevToolsAgentClient* client);
virtual ~WebDevToolsAgentImpl();
virtual void didCreateScriptContext(WebFrameImpl*, int worldId) OVERRIDE;
virtual void webViewResized(const WebSize&) OVERRIDE;
virtual bool handleInputEvent(WebCore::Page*, const WebInputEvent&) OVERRIDE;
virtual void attach() OVERRIDE;
virtual void reattach(const WebString& savedState) OVERRIDE;
virtual void detach() OVERRIDE;
virtual void didNavigate() OVERRIDE;
virtual void didBeginFrame(int frameId) OVERRIDE;
virtual void didCancelFrame() OVERRIDE;
virtual void willComposite() OVERRIDE;
virtual void didComposite() OVERRIDE;
virtual void dispatchOnInspectorBackend(const WebString& message) OVERRIDE;
virtual void inspectElementAt(const WebPoint&) OVERRIDE;
virtual void evaluateInWebInspector(long callId, const WebString& script) OVERRIDE;
virtual void setProcessId(long) OVERRIDE;
virtual void setLayerTreeId(int) OVERRIDE;
virtual void processGPUEvent(const GPUEvent&) OVERRIDE;
virtual void highlight() OVERRIDE;
virtual void hideHighlight() OVERRIDE;
virtual void updateInspectorStateCookie(const WTF::String&) OVERRIDE;
virtual void sendMessageToFrontend(PassRefPtr<WebCore::JSONObject> message) OVERRIDE;
virtual void flush() OVERRIDE;
virtual void clearBrowserCache() OVERRIDE;
virtual void clearBrowserCookies() OVERRIDE;
virtual void overrideDeviceMetrics(int width, int height, float deviceScaleFactor, bool emulateViewport, bool fitWindow) OVERRIDE;
virtual void getAllocatedObjects(HashSet<const void*>&) OVERRIDE;
virtual void dumpUncountedAllocatedObjects(const HashMap<const void*, size_t>&) OVERRIDE;
virtual void setTraceEventCallback(const WTF::String& categoryFilter, TraceEventCallback) OVERRIDE;
virtual void resetTraceEventCallback() OVERRIDE;
virtual void startGPUEventsRecording() OVERRIDE;
virtual void stopGPUEventsRecording() OVERRIDE;
virtual void dispatchKeyEvent(const WebCore::PlatformKeyboardEvent&) OVERRIDE;
virtual void dispatchMouseEvent(const WebCore::PlatformMouseEvent&) OVERRIDE;
virtual void paintPageOverlay(WebCanvas*) OVERRIDE;
void flushPendingFrontendMessages();
private:
virtual void willProcessTask() OVERRIDE;
virtual void didProcessTask() OVERRIDE;
void enableViewportEmulation();
void disableViewportEmulation();
WebCore::InspectorController* inspectorController();
WebCore::LocalFrame* mainFrame();
int m_hostId;
WebDevToolsAgentClient* m_client;
WebViewImpl* m_webViewImpl;
bool m_attached;
bool m_generatingEvent;
bool m_deviceMetricsEnabled;
bool m_emulateViewportEnabled;
bool m_originalViewportEnabled;
bool m_isOverlayScrollbarsEnabled;
typedef Vector<RefPtr<WebCore::JSONObject> > FrontendMessageQueue;
FrontendMessageQueue m_frontendMessageQueue;
};
}
#endif