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/Vector.h"
39 #include "wtf/text/WTFString.h"
43 class DOMWrapperWorld;
45 class GraphicsContext;
47 class InjectedScriptManager;
48 class InspectorBackendDispatcher;
50 class InspectorClient;
51 class InspectorDOMAgent;
52 class InspectorFrontend;
53 class InspectorFrontendChannel;
54 class InspectorFrontendClient;
55 class InspectorLayerTreeAgent;
56 class InspectorPageAgent;
57 class InspectorTimelineAgent;
58 class InspectorTracingAgent;
59 class InspectorOverlay;
61 class InstrumentingAgents;
65 class PlatformGestureEvent;
66 class PlatformKeyboardEvent;
67 class PlatformMouseEvent;
68 class PlatformTouchEvent;
71 class InspectorController {
72 WTF_MAKE_NONCOPYABLE(InspectorController);
73 WTF_MAKE_FAST_ALLOCATED;
75 ~InspectorController();
77 static PassOwnPtr<InspectorController> create(Page*, InspectorClient*);
79 // Settings overrides.
80 void setTextAutosizingEnabled(bool);
81 void setDeviceScaleAdjustment(float);
83 void willBeDestroyed();
84 void registerModuleAgent(PassOwnPtr<InspectorAgent>);
86 void setInspectorFrontendClient(PassOwnPtr<InspectorFrontendClient>);
87 void didClearDocumentOfWindowObject(LocalFrame*);
88 void setInjectedScriptForOrigin(const String& origin, const String& source);
90 void dispatchMessageFromFrontend(const String& message);
92 void connectFrontend(InspectorFrontendChannel*);
93 void disconnectFrontend();
94 void reconnectFrontend();
95 void reuseFrontend(InspectorFrontendChannel*, const String& inspectorStateCookie);
96 void setProcessId(long);
97 void setLayerTreeId(int);
98 void webViewResized(const IntSize&);
101 void drawHighlight(GraphicsContext&) const;
103 bool handleGestureEvent(LocalFrame*, const PlatformGestureEvent&);
104 bool handleMouseEvent(LocalFrame*, const PlatformMouseEvent&);
105 bool handleTouchEvent(LocalFrame*, const PlatformTouchEvent&);
106 bool handleKeyboardEvent(LocalFrame*, const PlatformKeyboardEvent&);
108 void requestPageScaleFactor(float scale, const IntPoint& origin);
109 bool deviceEmulationEnabled();
112 void evaluateForTestInFrontend(long callId, const String& script);
116 void setResourcesDataSizeLimitsFromInternals(int maximumResourcesContentSize, int maximumSingleResourceContentSize);
118 void willProcessTask();
119 void didProcessTask();
120 void flushPendingFrontendMessages();
122 void didCommitLoadForMainFrame();
123 void didBeginFrame(int frameId);
124 void didCancelFrame();
125 void willComposite();
128 void processGPUEvent(double timestamp, int phase, bool foreign, uint64_t usedGPUMemoryBytes, uint64_t limitGPUMemoryBytes);
130 void scriptsEnabled(bool);
132 void willAddPageOverlay(const GraphicsLayer*);
133 void didRemovePageOverlay(const GraphicsLayer*);
136 InspectorController(Page*, InspectorClient*);
138 void initializeDeferredAgents();
140 friend InstrumentingAgents* instrumentationForPage(Page*);
142 RefPtr<InstrumentingAgents> m_instrumentingAgents;
143 OwnPtr<InjectedScriptManager> m_injectedScriptManager;
144 OwnPtr<InspectorCompositeState> m_state;
145 OwnPtr<InspectorOverlay> m_overlay;
147 InspectorDOMAgent* m_domAgent;
148 InspectorPageAgent* m_pageAgent;
149 InspectorTimelineAgent* m_timelineAgent;
150 InspectorLayerTreeAgent* m_layerTreeAgent;
151 InspectorTracingAgent* m_tracingAgent;
153 RefPtr<InspectorBackendDispatcher> m_inspectorBackendDispatcher;
154 OwnPtr<InspectorFrontendClient> m_inspectorFrontendClient;
155 OwnPtr<InspectorFrontend> m_inspectorFrontend;
157 InspectorClient* m_inspectorClient;
158 InspectorAgentRegistry m_agents;
159 Vector<InspectorAgent*> m_moduleAgents;
161 bool m_deferredAgentsInitialized;
167 #endif // !defined(InspectorController_h)