OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 30 matching lines...) Expand all Loading... |
41 #include "core/inspector/InjectedScriptManager.h" | 41 #include "core/inspector/InjectedScriptManager.h" |
42 #include "core/inspector/InspectorAnimationAgent.h" | 42 #include "core/inspector/InspectorAnimationAgent.h" |
43 #include "core/inspector/InspectorApplicationCacheAgent.h" | 43 #include "core/inspector/InspectorApplicationCacheAgent.h" |
44 #include "core/inspector/InspectorCSSAgent.h" | 44 #include "core/inspector/InspectorCSSAgent.h" |
45 #include "core/inspector/InspectorCanvasAgent.h" | 45 #include "core/inspector/InspectorCanvasAgent.h" |
46 #include "core/inspector/InspectorClient.h" | 46 #include "core/inspector/InspectorClient.h" |
47 #include "core/inspector/InspectorDOMAgent.h" | 47 #include "core/inspector/InspectorDOMAgent.h" |
48 #include "core/inspector/InspectorDOMDebuggerAgent.h" | 48 #include "core/inspector/InspectorDOMDebuggerAgent.h" |
49 #include "core/inspector/InspectorDOMStorageAgent.h" | 49 #include "core/inspector/InspectorDOMStorageAgent.h" |
50 #include "core/inspector/InspectorDebuggerAgent.h" | 50 #include "core/inspector/InspectorDebuggerAgent.h" |
51 #include "core/inspector/InspectorFrontendClient.h" | |
52 #include "core/inspector/InspectorHeapProfilerAgent.h" | 51 #include "core/inspector/InspectorHeapProfilerAgent.h" |
53 #include "core/inspector/InspectorInputAgent.h" | 52 #include "core/inspector/InspectorInputAgent.h" |
54 #include "core/inspector/InspectorInspectorAgent.h" | 53 #include "core/inspector/InspectorInspectorAgent.h" |
55 #include "core/inspector/InspectorInstrumentation.h" | 54 #include "core/inspector/InspectorInstrumentation.h" |
56 #include "core/inspector/InspectorLayerTreeAgent.h" | 55 #include "core/inspector/InspectorLayerTreeAgent.h" |
57 #include "core/inspector/InspectorMemoryAgent.h" | 56 #include "core/inspector/InspectorMemoryAgent.h" |
58 #include "core/inspector/InspectorOverlay.h" | 57 #include "core/inspector/InspectorOverlay.h" |
59 #include "core/inspector/InspectorPageAgent.h" | 58 #include "core/inspector/InspectorPageAgent.h" |
60 #include "core/inspector/InspectorProfilerAgent.h" | 59 #include "core/inspector/InspectorProfilerAgent.h" |
61 #include "core/inspector/InspectorResourceAgent.h" | 60 #include "core/inspector/InspectorResourceAgent.h" |
62 #include "core/inspector/InspectorState.h" | 61 #include "core/inspector/InspectorState.h" |
63 #include "core/inspector/InspectorTimelineAgent.h" | 62 #include "core/inspector/InspectorTimelineAgent.h" |
64 #include "core/inspector/InspectorTracingAgent.h" | 63 #include "core/inspector/InspectorTracingAgent.h" |
65 #include "core/inspector/InspectorWorkerAgent.h" | 64 #include "core/inspector/InspectorWorkerAgent.h" |
66 #include "core/inspector/InstrumentingAgents.h" | 65 #include "core/inspector/InstrumentingAgents.h" |
67 #include "core/inspector/PageConsoleAgent.h" | 66 #include "core/inspector/PageConsoleAgent.h" |
68 #include "core/inspector/PageDebuggerAgent.h" | 67 #include "core/inspector/PageDebuggerAgent.h" |
69 #include "core/inspector/PageRuntimeAgent.h" | 68 #include "core/inspector/PageRuntimeAgent.h" |
70 #include "core/page/ContextMenuProvider.h" | |
71 #include "core/page/Page.h" | 69 #include "core/page/Page.h" |
72 #include "core/rendering/RenderLayer.h" | 70 #include "core/rendering/RenderLayer.h" |
73 #include "platform/PlatformMouseEvent.h" | 71 #include "platform/PlatformMouseEvent.h" |
74 | 72 |
75 namespace blink { | 73 namespace blink { |
76 | 74 |
77 InspectorController::InspectorController(Page* page, InspectorClient* inspectorC
lient) | 75 InspectorController::InspectorController(Page* page, InspectorClient* inspectorC
lient) |
78 : m_instrumentingAgents(InstrumentingAgents::create()) | 76 : m_instrumentingAgents(InstrumentingAgents::create()) |
79 , m_injectedScriptManager(InjectedScriptManager::createForPage()) | 77 , m_injectedScriptManager(InjectedScriptManager::createForPage()) |
80 , m_state(adoptPtrWillBeNoop(new InspectorCompositeState(inspectorClient))) | 78 , m_state(adoptPtrWillBeNoop(new InspectorCompositeState(inspectorClient))) |
81 , m_overlay(InspectorOverlay::create(page, inspectorClient)) | 79 , m_overlay(InspectorOverlay::create(page, inspectorClient)) |
82 , m_cssAgent(nullptr) | 80 , m_cssAgent(nullptr) |
83 , m_resourceAgent(nullptr) | 81 , m_resourceAgent(nullptr) |
84 , m_layerTreeAgent(nullptr) | 82 , m_layerTreeAgent(nullptr) |
85 , m_animationAgent(nullptr) | 83 , m_animationAgent(nullptr) |
86 , m_inspectorFrontendClient(nullptr) | |
87 , m_inspectorClient(inspectorClient) | 84 , m_inspectorClient(inspectorClient) |
88 , m_agents(m_instrumentingAgents.get(), m_state.get()) | 85 , m_agents(m_instrumentingAgents.get(), m_state.get()) |
89 , m_isUnderTest(false) | 86 , m_isUnderTest(false) |
90 , m_deferredAgentsInitialized(false) | 87 , m_deferredAgentsInitialized(false) |
91 { | 88 { |
92 InjectedScriptManager* injectedScriptManager = m_injectedScriptManager.get()
; | 89 InjectedScriptManager* injectedScriptManager = m_injectedScriptManager.get()
; |
93 InspectorOverlay* overlay = m_overlay.get(); | 90 InspectorOverlay* overlay = m_overlay.get(); |
94 | 91 |
95 m_agents.append(InspectorInspectorAgent::create(this, injectedScriptManager)
); | 92 m_agents.append(InspectorInspectorAgent::create(this, injectedScriptManager)
); |
96 | 93 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 ASSERT(frame); | 221 ASSERT(frame); |
225 if (frame->isLocalFrame()) | 222 if (frame->isLocalFrame()) |
226 ASSERT(m_pageAgent->inspectedFrame()->view()); | 223 ASSERT(m_pageAgent->inspectedFrame()->view()); |
227 #endif | 224 #endif |
228 | 225 |
229 disconnectFrontend(); | 226 disconnectFrontend(); |
230 m_injectedScriptManager->disconnect(); | 227 m_injectedScriptManager->disconnect(); |
231 m_inspectorClient = 0; | 228 m_inspectorClient = 0; |
232 m_instrumentingAgents->reset(); | 229 m_instrumentingAgents->reset(); |
233 m_agents.discardAgents(); | 230 m_agents.discardAgents(); |
234 if (m_inspectorFrontendClient) | |
235 m_inspectorFrontendClient->dispose(); | |
236 } | 231 } |
237 | 232 |
238 void InspectorController::registerModuleAgent(PassOwnPtrWillBeRawPtr<InspectorAg
ent> agent) | 233 void InspectorController::registerModuleAgent(PassOwnPtrWillBeRawPtr<InspectorAg
ent> agent) |
239 { | 234 { |
240 m_agents.append(agent); | 235 m_agents.append(agent); |
241 } | 236 } |
242 | 237 |
243 void InspectorController::setInspectorFrontendClient(InspectorFrontendClient* in
spectorFrontendClient) | |
244 { | |
245 m_inspectorFrontendClient = inspectorFrontendClient; | |
246 } | |
247 | |
248 void InspectorController::didClearDocumentOfWindowObject(LocalFrame* frame) | |
249 { | |
250 // If the page is supposed to serve as InspectorFrontend notify inspector fr
ontend | |
251 // client that it's cleared so that the client can expose inspector bindings
. | |
252 if (m_inspectorFrontendClient && frame == m_pageAgent->inspectedFrame()) | |
253 m_inspectorFrontendClient->windowObjectCleared(); | |
254 } | |
255 | |
256 void InspectorController::connectFrontend(const String& hostId, InspectorFronten
dChannel* frontendChannel) | 238 void InspectorController::connectFrontend(const String& hostId, InspectorFronten
dChannel* frontendChannel) |
257 { | 239 { |
258 ASSERT(frontendChannel); | 240 ASSERT(frontendChannel); |
259 m_hostId = hostId; | 241 m_hostId = hostId; |
260 | 242 |
261 initializeDeferredAgents(); | 243 initializeDeferredAgents(); |
262 m_resourceAgent->setHostId(hostId); | 244 m_resourceAgent->setHostId(hostId); |
263 | 245 |
264 m_inspectorFrontend = adoptPtr(new InspectorFrontend(frontendChannel)); | 246 m_inspectorFrontend = adoptPtr(new InspectorFrontend(frontendChannel)); |
265 // We can reconnect to existing front-end -> unmute state. | 247 // We can reconnect to existing front-end -> unmute state. |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 | 339 |
358 if (!node->isElementNode() && !node->isDocumentNode()) | 340 if (!node->isElementNode() && !node->isDocumentNode()) |
359 node = node->parentNode(); | 341 node = node->parentNode(); |
360 | 342 |
361 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(S
criptState::forMainWorld(frame)); | 343 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(S
criptState::forMainWorld(frame)); |
362 if (injectedScript.isEmpty()) | 344 if (injectedScript.isEmpty()) |
363 return; | 345 return; |
364 injectedScript.inspectNode(node); | 346 injectedScript.inspectNode(node); |
365 } | 347 } |
366 | 348 |
367 void InspectorController::setInjectedScriptForOrigin(const String& origin, const
String& source) | |
368 { | |
369 if (InspectorInspectorAgent* inspectorAgent = m_instrumentingAgents->inspect
orInspectorAgent()) | |
370 inspectorAgent->setInjectedScriptForOrigin(origin, source); | |
371 } | |
372 | |
373 void InspectorController::showContextMenu(float x, float y, PassRefPtrWillBeRawP
tr<ContextMenuProvider> menuProvider) | |
374 { | |
375 if (!m_inspectorClient) | |
376 return; | |
377 m_inspectorClient->showContextMenu(x, y, menuProvider); | |
378 } | |
379 | |
380 void InspectorController::dispatchMessageFromFrontend(const String& message) | 349 void InspectorController::dispatchMessageFromFrontend(const String& message) |
381 { | 350 { |
382 if (m_inspectorBackendDispatcher) | 351 if (m_inspectorBackendDispatcher) |
383 m_inspectorBackendDispatcher->dispatch(message); | 352 m_inspectorBackendDispatcher->dispatch(message); |
384 } | 353 } |
385 | 354 |
386 bool InspectorController::handleGestureEvent(LocalFrame* frame, const PlatformGe
stureEvent& event) | 355 bool InspectorController::handleGestureEvent(LocalFrame* frame, const PlatformGe
stureEvent& event) |
387 { | 356 { |
388 // Overlay should not consume events. | 357 // Overlay should not consume events. |
389 m_overlay->handleGestureEvent(event); | 358 m_overlay->handleGestureEvent(event); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 m_layerTreeAgent->willAddPageOverlay(layer); | 498 m_layerTreeAgent->willAddPageOverlay(layer); |
530 } | 499 } |
531 | 500 |
532 void InspectorController::didRemovePageOverlay(const GraphicsLayer* layer) | 501 void InspectorController::didRemovePageOverlay(const GraphicsLayer* layer) |
533 { | 502 { |
534 if (m_layerTreeAgent) | 503 if (m_layerTreeAgent) |
535 m_layerTreeAgent->didRemovePageOverlay(layer); | 504 m_layerTreeAgent->didRemovePageOverlay(layer); |
536 } | 505 } |
537 | 506 |
538 } // namespace blink | 507 } // namespace blink |
OLD | NEW |