2 * Copyright (C) 2011 Google Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #ifndef InspectorController_h
32 #define InspectorController_h
34 #include "core/inspector/InspectorBaseAgent.h"
35 #include "wtf/Forward.h"
36 #include "wtf/HashMap.h"
37 #include "wtf/Noncopyable.h"
38 #include "wtf/text/WTFString.h"
42 class DOMWrapperWorld;
44 class GraphicsContext;
45 class InjectedScriptManager;
46 class InspectorBackendDispatcher;
47 class InspectorClient;
48 class InspectorFrontend;
49 class InspectorFrontendChannel;
50 class InspectorFrontendClient;
51 class InspectorMemoryAgent;
52 class InspectorTimelineAgent;
53 class InspectorOverlay;
55 class InstrumentingAgents;
59 class PlatformGestureEvent;
60 class PlatformMouseEvent;
61 class PlatformTouchEvent;
62 class PostWorkerNotificationToFrontendTask;
67 class InspectorController {
68 WTF_MAKE_NONCOPYABLE(InspectorController);
69 WTF_MAKE_FAST_ALLOCATED;
71 ~InspectorController();
73 static PassOwnPtr<InspectorController> create(Page*, InspectorClient*);
74 void inspectedPageDestroyed();
76 Page* inspectedPage() const;
78 void setInspectorFrontendClient(PassOwnPtr<InspectorFrontendClient>);
79 void didClearWindowObjectInWorld(Frame*, DOMWrapperWorld*);
80 void setInjectedScriptForOrigin(const String& origin, const String& source);
82 void dispatchMessageFromFrontend(const String& message);
84 bool hasFrontend() const { return m_inspectorFrontend; }
85 void connectFrontend(InspectorFrontendChannel*);
86 void disconnectFrontend();
87 void reconnectFrontend();
88 void reuseFrontend(InspectorFrontendChannel*, const String& inspectorStateCookie);
89 void setProcessId(long);
90 void setLayerTreeId(int);
91 void webViewResized(const IntSize&);
94 void drawHighlight(GraphicsContext&) const;
95 void getHighlight(Highlight*) const;
97 Node* highlightedNode() const;
99 bool handleGestureEvent(Frame*, const PlatformGestureEvent&);
100 bool handleMouseEvent(Frame*, const PlatformMouseEvent&);
101 bool handleTouchEvent(Frame*, const PlatformTouchEvent&);
103 void requestPageScaleFactor(float scale, const IntPoint& origin);
104 bool deviceEmulationEnabled();
107 void evaluateForTestInFrontend(long callId, const String& script);
111 void setResourcesDataSizeLimitsFromInternals(int maximumResourcesContentSize, int maximumSingleResourceContentSize);
113 InspectorClient* inspectorClient() const { return m_inspectorClient; }
115 void willProcessTask();
116 void didProcessTask();
118 void didBeginFrame(int frameId);
119 void didCancelFrame();
120 void willComposite();
124 InspectorController(Page*, InspectorClient*);
126 friend class PostWorkerNotificationToFrontendTask;
127 friend InstrumentingAgents* instrumentationForPage(Page*);
129 RefPtr<InstrumentingAgents> m_instrumentingAgents;
130 OwnPtr<InjectedScriptManager> m_injectedScriptManager;
131 OwnPtr<InspectorCompositeState> m_state;
132 OwnPtr<InspectorOverlay> m_overlay;
134 InspectorMemoryAgent* m_memoryAgent;
135 InspectorTimelineAgent* m_timelineAgent;
137 RefPtr<InspectorBackendDispatcher> m_inspectorBackendDispatcher;
138 OwnPtr<InspectorFrontendClient> m_inspectorFrontendClient;
139 OwnPtr<InspectorFrontend> m_inspectorFrontend;
141 InspectorClient* m_inspectorClient;
142 InspectorAgentRegistry m_agents;
149 #endif // !defined(InspectorController_h)