| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | |
| 3 * | |
| 4 * Redistribution and use in source and binary forms, with or without | |
| 5 * modification, are permitted provided that the following conditions are | |
| 6 * met: | |
| 7 * | |
| 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 | |
| 13 * distribution. | |
| 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. | |
| 17 * | |
| 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. | |
| 29 */ | |
| 30 | |
| 31 #include "config.h" | |
| 32 #include "core/inspector/PageDebuggerAgent.h" | |
| 33 | |
| 34 #include "sky/engine/bindings/core/v8/DOMWrapperWorld.h" | |
| 35 #include "sky/engine/bindings/core/v8/ScriptController.h" | |
| 36 #include "sky/engine/bindings/core/v8/ScriptSourceCode.h" | |
| 37 #include "sky/engine/core/frame/FrameConsole.h" | |
| 38 #include "sky/engine/core/frame/LocalFrame.h" | |
| 39 #include "sky/engine/core/page/Page.h" | |
| 40 #include "sky/engine/v8_inspector/inspector_host.h" | |
| 41 | |
| 42 namespace blink { | |
| 43 | |
| 44 PassOwnPtr<PageDebuggerAgent> PageDebuggerAgent::create(PageScriptDebugServer* p
ageScriptDebugServer, inspector::InspectorHost* host, InjectedScriptManager* inj
ectedScriptManager) | |
| 45 { | |
| 46 return adoptPtr(new PageDebuggerAgent(pageScriptDebugServer, host, injectedS
criptManager)); | |
| 47 } | |
| 48 | |
| 49 PageDebuggerAgent::PageDebuggerAgent(PageScriptDebugServer* pageScriptDebugServe
r, inspector::InspectorHost* host, InjectedScriptManager* injectedScriptManager) | |
| 50 : InspectorDebuggerAgent(injectedScriptManager) | |
| 51 , m_pageScriptDebugServer(pageScriptDebugServer) | |
| 52 , m_host(host) | |
| 53 { | |
| 54 } | |
| 55 | |
| 56 PageDebuggerAgent::~PageDebuggerAgent() | |
| 57 { | |
| 58 } | |
| 59 | |
| 60 void PageDebuggerAgent::startListeningScriptDebugServer() | |
| 61 { | |
| 62 scriptDebugServer().addListener(this, m_host); | |
| 63 } | |
| 64 | |
| 65 void PageDebuggerAgent::stopListeningScriptDebugServer() | |
| 66 { | |
| 67 scriptDebugServer().removeListener(this, m_host); | |
| 68 } | |
| 69 | |
| 70 PageScriptDebugServer& PageDebuggerAgent::scriptDebugServer() | |
| 71 { | |
| 72 return *m_pageScriptDebugServer; | |
| 73 } | |
| 74 | |
| 75 void PageDebuggerAgent::muteConsole() | |
| 76 { | |
| 77 FrameConsole::mute(); | |
| 78 } | |
| 79 | |
| 80 void PageDebuggerAgent::unmuteConsole() | |
| 81 { | |
| 82 FrameConsole::unmute(); | |
| 83 } | |
| 84 | |
| 85 InjectedScript PageDebuggerAgent::injectedScriptForEval(ErrorString* errorString
, const int* executionContextId) | |
| 86 { | |
| 87 if (!executionContextId) { | |
| 88 ScriptState* scriptState = ScriptState::from(m_host->GetContext()); | |
| 89 return injectedScriptManager()->injectedScriptFor(scriptState); | |
| 90 } | |
| 91 InjectedScript injectedScript = injectedScriptManager()->injectedScriptForId
(*executionContextId); | |
| 92 if (injectedScript.isEmpty()) | |
| 93 *errorString = "Execution context with given id not found."; | |
| 94 return injectedScript; | |
| 95 } | |
| 96 | |
| 97 void PageDebuggerAgent::setOverlayMessage(ErrorString*, const String* message) | |
| 98 { | |
| 99 if (message) | |
| 100 printf("OVERLAY MESSAGE: %s\n", message->ascii().data()); | |
| 101 else | |
| 102 printf("OVERLAY REMOVED\n"); | |
| 103 } | |
| 104 | |
| 105 void PageDebuggerAgent::didClearDocumentOfWindowObject(LocalFrame* frame) | |
| 106 { | |
| 107 reset(); | |
| 108 scriptDebugServer().setPreprocessorSource(String()); | |
| 109 } | |
| 110 | |
| 111 } // namespace blink | |
| OLD | NEW |