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 "platform/heap/Handle.h"
36 #include "wtf/Forward.h"
37 #include "wtf/HashMap.h"
38 #include "wtf/Noncopyable.h"
39 #include "wtf/text/WTFString.h"
43 class ContextMenuProvider;
44 class DOMWrapperWorld;
46 class GraphicsContext;
48 class InjectedScriptManager;
49 class InspectorBackendDispatcher;
51 class InspectorClient;
52 class InspectorCSSAgent;
53 class InspectorDOMAgent;
54 class InspectorFrontend;
55 class InspectorFrontendChannel;
56 class InspectorFrontendClient;
57 class InspectorLayerTreeAgent;
58 class InspectorPageAgent;
59 class InspectorResourceAgent;
60 class InspectorTimelineAgent;
61 class InspectorTracingAgent;
62 class InspectorOverlay;
64 class InstrumentingAgents;
68 class PlatformGestureEvent;
69 class PlatformKeyboardEvent;
70 class PlatformMouseEvent;
71 class PlatformTouchEvent;
74 class InspectorController : public NoBaseWillBeGarbageCollectedFinalized<InspectorController> {
75 WTF_MAKE_NONCOPYABLE(InspectorController);
76 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED;
78 ~InspectorController();
81 static PassOwnPtrWillBeRawPtr<InspectorController> create(Page*, InspectorClient*);
83 // Settings overrides.
84 void setTextAutosizingEnabled(bool);
85 void setDeviceScaleAdjustment(float);
87 void willBeDestroyed();
88 void registerModuleAgent(PassOwnPtrWillBeRawPtr<InspectorAgent>);
90 void setInspectorFrontendClient(PassOwnPtrWillBeRawPtr<InspectorFrontendClient>);
91 void didClearDocumentOfWindowObject(LocalFrame*);
92 void setInjectedScriptForOrigin(const String& origin, const String& source);
93 void showContextMenu(float x, float y, PassRefPtr<ContextMenuProvider>);
95 void dispatchMessageFromFrontend(const String& message);
97 void connectFrontend(const String& hostId, InspectorFrontendChannel*);
98 void disconnectFrontend();
99 void reconnectFrontend();
100 void reuseFrontend(const String& hostId, InspectorFrontendChannel*, const String& inspectorStateCookie);
101 void setProcessId(long);
102 void setLayerTreeId(int);
105 void drawHighlight(GraphicsContext&) const;
107 bool handleGestureEvent(LocalFrame*, const PlatformGestureEvent&);
108 bool handleMouseEvent(LocalFrame*, const PlatformMouseEvent&);
109 bool handleTouchEvent(LocalFrame*, const PlatformTouchEvent&);
110 bool handleKeyboardEvent(LocalFrame*, const PlatformKeyboardEvent&);
112 void deviceOrPageScaleFactorChanged();
113 bool deviceEmulationEnabled();
116 void evaluateForTestInFrontend(long callId, const String& script);
120 void setResourcesDataSizeLimitsFromInternals(int maximumResourcesContentSize, int maximumSingleResourceContentSize);
122 void willProcessTask();
123 void didProcessTask();
124 void flushPendingFrontendMessages();
126 void didCommitLoadForMainFrame();
127 void didBeginFrame(int frameId);
128 void didCancelFrame();
129 void willComposite();
132 void processGPUEvent(double timestamp, int phase, bool foreign, uint64_t usedGPUMemoryBytes, uint64_t limitGPUMemoryBytes);
134 void scriptsEnabled(bool);
136 void willAddPageOverlay(const GraphicsLayer*);
137 void didRemovePageOverlay(const GraphicsLayer*);
140 InspectorController(Page*, InspectorClient*);
142 void initializeDeferredAgents();
144 friend InstrumentingAgents* instrumentationForPage(Page*);
146 RefPtrWillBeMember<InstrumentingAgents> m_instrumentingAgents;
147 OwnPtrWillBeMember<InjectedScriptManager> m_injectedScriptManager;
148 OwnPtrWillBeMember<InspectorCompositeState> m_state;
149 OwnPtr<InspectorOverlay> m_overlay;
151 RawPtrWillBeMember<InspectorDOMAgent> m_domAgent;
152 RawPtrWillBeMember<InspectorPageAgent> m_pageAgent;
153 RawPtrWillBeMember<InspectorTimelineAgent> m_timelineAgent;
154 RawPtrWillBeMember<InspectorCSSAgent> m_cssAgent;
155 RawPtrWillBeMember<InspectorResourceAgent> m_resourceAgent;
156 RawPtrWillBeMember<InspectorLayerTreeAgent> m_layerTreeAgent;
157 RawPtrWillBeMember<InspectorTracingAgent> m_tracingAgent;
159 RefPtr<InspectorBackendDispatcher> m_inspectorBackendDispatcher;
160 OwnPtrWillBeMember<InspectorFrontendClient> m_inspectorFrontendClient;
161 OwnPtr<InspectorFrontend> m_inspectorFrontend;
162 RawPtrWillBeMember<Page> m_page;
163 InspectorClient* m_inspectorClient;
164 InspectorAgentRegistry m_agents;
166 bool m_deferredAgentsInitialized;
173 #endif // !defined(InspectorController_h)