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;
46 class InjectedScriptManager;
47 class InspectorBackendDispatcher;
49 class InspectorClient;
50 class InspectorDOMAgent;
51 class InspectorFrontend;
52 class InspectorFrontendChannel;
53 class InspectorFrontendClient;
54 class InspectorPageAgent;
55 class InspectorTimelineAgent;
56 class InspectorOverlay;
58 class InstrumentingAgents;
62 class PlatformGestureEvent;
63 class PlatformKeyboardEvent;
64 class PlatformMouseEvent;
65 class PlatformTouchEvent;
70 class InspectorController {
71 WTF_MAKE_NONCOPYABLE(InspectorController);
72 WTF_MAKE_FAST_ALLOCATED;
74 ~InspectorController();
76 static PassOwnPtr<InspectorController> create(Page*, InspectorClient*);
78 // Settings overrides.
79 void setTextAutosizingEnabled(bool);
80 void setDeviceScaleAdjustment(float);
82 void inspectedPageDestroyed();
83 void registerModuleAgent(PassOwnPtr<InspectorAgent>);
85 void setInspectorFrontendClient(PassOwnPtr<InspectorFrontendClient>);
86 void didClearWindowObjectInMainWorld(Frame*);
87 void setInjectedScriptForOrigin(const String& origin, const String& source);
89 void dispatchMessageFromFrontend(const String& message);
91 void connectFrontend(InspectorFrontendChannel*);
92 void disconnectFrontend();
93 void reconnectFrontend();
94 void reuseFrontend(InspectorFrontendChannel*, const String& inspectorStateCookie);
95 void setProcessId(long);
96 void setLayerTreeId(int);
97 void webViewResized(const IntSize&);
100 void drawHighlight(GraphicsContext&) const;
101 void getHighlight(Highlight*) const;
102 void hideHighlight();
103 Node* highlightedNode() const;
105 bool handleGestureEvent(Frame*, const PlatformGestureEvent&);
106 bool handleMouseEvent(Frame*, const PlatformMouseEvent&);
107 bool handleTouchEvent(Frame*, const PlatformTouchEvent&);
108 bool handleKeyboardEvent(Frame*, const PlatformKeyboardEvent&);
110 void requestPageScaleFactor(float scale, const IntPoint& origin);
111 bool deviceEmulationEnabled();
114 void evaluateForTestInFrontend(long callId, const String& script);
118 void setResourcesDataSizeLimitsFromInternals(int maximumResourcesContentSize, int maximumSingleResourceContentSize);
120 void willProcessTask();
121 void didProcessTask();
123 void didCommitLoadForMainFrame();
124 void didBeginFrame(int frameId);
125 void didCancelFrame();
126 void willComposite();
129 void processGPUEvent(double timestamp, int phase, bool foreign, size_t usedGPUMemoryBytes);
131 void scriptsEnabled(bool);
134 InspectorController(Page*, InspectorClient*);
136 void initializeDeferredAgents();
138 friend InstrumentingAgents* instrumentationForPage(Page*);
140 RefPtr<InstrumentingAgents> m_instrumentingAgents;
141 OwnPtr<InjectedScriptManager> m_injectedScriptManager;
142 OwnPtr<InspectorCompositeState> m_state;
143 OwnPtr<InspectorOverlay> m_overlay;
145 InspectorDOMAgent* m_domAgent;
146 InspectorPageAgent* m_pageAgent;
147 InspectorTimelineAgent* m_timelineAgent;
149 RefPtr<InspectorBackendDispatcher> m_inspectorBackendDispatcher;
150 OwnPtr<InspectorFrontendClient> m_inspectorFrontendClient;
151 OwnPtr<InspectorFrontend> m_inspectorFrontend;
153 InspectorClient* m_inspectorClient;
154 InspectorAgentRegistry m_agents;
155 Vector<InspectorAgent*> m_moduleAgents;
157 bool m_deferredAgentsInitialized;
163 #endif // !defined(InspectorController_h)