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 18 matching lines...) Expand all Loading... |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "core/inspector/PageDebuggerAgent.h" | 32 #include "core/inspector/PageDebuggerAgent.h" |
33 | 33 |
34 #include "bindings/v8/DOMWrapperWorld.h" | 34 #include "bindings/v8/DOMWrapperWorld.h" |
35 #include "bindings/v8/PageScriptDebugServer.h" | 35 #include "bindings/v8/PageScriptDebugServer.h" |
36 #include "core/inspector/InspectorOverlay.h" | 36 #include "core/inspector/InspectorOverlay.h" |
37 #include "core/inspector/InspectorPageAgent.h" | 37 #include "core/inspector/InspectorPageAgent.h" |
38 #include "core/inspector/InstrumentingAgents.h" | 38 #include "core/inspector/InstrumentingAgents.h" |
| 39 #include "core/page/Page.h" |
39 #include "core/page/PageConsole.h" | 40 #include "core/page/PageConsole.h" |
40 | 41 |
41 namespace WebCore { | 42 namespace WebCore { |
42 | 43 |
43 PassOwnPtr<PageDebuggerAgent> PageDebuggerAgent::create(InstrumentingAgents* ins
trumentingAgents, InspectorCompositeState* inspectorState, InspectorPageAgent* p
ageAgent, InjectedScriptManager* injectedScriptManager, InspectorOverlay* overla
y) | 44 PassOwnPtr<PageDebuggerAgent> PageDebuggerAgent::create(InstrumentingAgents* ins
trumentingAgents, InspectorCompositeState* inspectorState, InspectorPageAgent* p
ageAgent, InjectedScriptManager* injectedScriptManager, InspectorOverlay* overla
y) |
44 { | 45 { |
45 return adoptPtr(new PageDebuggerAgent(instrumentingAgents, inspectorState, p
ageAgent, injectedScriptManager, overlay)); | 46 return adoptPtr(new PageDebuggerAgent(instrumentingAgents, inspectorState, p
ageAgent, injectedScriptManager, overlay)); |
46 } | 47 } |
47 | 48 |
48 PageDebuggerAgent::PageDebuggerAgent(InstrumentingAgents* instrumentingAgents, I
nspectorCompositeState* inspectorState, InspectorPageAgent* pageAgent, InjectedS
criptManager* injectedScriptManager, InspectorOverlay* overlay) | 49 PageDebuggerAgent::PageDebuggerAgent(InstrumentingAgents* instrumentingAgents, I
nspectorCompositeState* inspectorState, InspectorPageAgent* pageAgent, InjectedS
criptManager* injectedScriptManager, InspectorOverlay* overlay) |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 void PageDebuggerAgent::muteConsole() | 87 void PageDebuggerAgent::muteConsole() |
87 { | 88 { |
88 PageConsole::mute(); | 89 PageConsole::mute(); |
89 } | 90 } |
90 | 91 |
91 void PageDebuggerAgent::unmuteConsole() | 92 void PageDebuggerAgent::unmuteConsole() |
92 { | 93 { |
93 PageConsole::unmute(); | 94 PageConsole::unmute(); |
94 } | 95 } |
95 | 96 |
| 97 void PageDebuggerAgent::addConsoleMessage(MessageSource source, MessageLevel lev
el, const String& message, const String& sourceURL) |
| 98 { |
| 99 m_pageAgent->page()->console()->addMessage(source, level, message, sourceURL
, 0); |
| 100 } |
| 101 |
96 InjectedScript PageDebuggerAgent::injectedScriptForEval(ErrorString* errorString
, const int* executionContextId) | 102 InjectedScript PageDebuggerAgent::injectedScriptForEval(ErrorString* errorString
, const int* executionContextId) |
97 { | 103 { |
98 if (!executionContextId) { | 104 if (!executionContextId) { |
99 ScriptState* scriptState = mainWorldScriptState(m_pageAgent->mainFrame()
); | 105 ScriptState* scriptState = mainWorldScriptState(m_pageAgent->mainFrame()
); |
100 return injectedScriptManager()->injectedScriptFor(scriptState); | 106 return injectedScriptManager()->injectedScriptFor(scriptState); |
101 } | 107 } |
102 InjectedScript injectedScript = injectedScriptManager()->injectedScriptForId
(*executionContextId); | 108 InjectedScript injectedScript = injectedScriptManager()->injectedScriptForId
(*executionContextId); |
103 if (injectedScript.hasNoValue()) | 109 if (injectedScript.hasNoValue()) |
104 *errorString = "Execution context with given id not found."; | 110 *errorString = "Execution context with given id not found."; |
105 return injectedScript; | 111 return injectedScript; |
106 } | 112 } |
107 | 113 |
108 void PageDebuggerAgent::setOverlayMessage(ErrorString*, const String* message) | 114 void PageDebuggerAgent::setOverlayMessage(ErrorString*, const String* message) |
109 { | 115 { |
110 m_overlay->setPausedInDebuggerMessage(message); | 116 m_overlay->setPausedInDebuggerMessage(message); |
111 } | 117 } |
112 | 118 |
113 void PageDebuggerAgent::didClearWindowObjectInWorld(Frame* frame, DOMWrapperWorl
d* world) | 119 void PageDebuggerAgent::didClearWindowObjectInWorld(Frame* frame, DOMWrapperWorl
d* world) |
114 { | 120 { |
115 if (world != mainThreadNormalWorld() || frame != m_pageAgent->mainFrame()) | 121 if (world != mainThreadNormalWorld() || frame != m_pageAgent->mainFrame()) |
116 return; | 122 return; |
117 | 123 |
118 reset(); | 124 reset(); |
119 scriptDebugServer().setScriptPreprocessor(m_pageAgent->scriptPreprocessor())
; | 125 scriptDebugServer().setScriptPreprocessor(m_pageAgent->scriptPreprocessor())
; |
120 } | 126 } |
121 | 127 |
122 } // namespace WebCore | 128 } // namespace WebCore |
123 | 129 |
OLD | NEW |