| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> | 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> |
| 4 * Copyright (C) 2009 Google Inc. All rights reserved. | 4 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 Pasteboard::generalPasteboard()->writePlainText(text); | 91 Pasteboard::generalPasteboard()->writePlainText(text); |
| 92 } | 92 } |
| 93 | 93 |
| 94 Node* InjectedScriptHost::nodeForId(long nodeId) | 94 Node* InjectedScriptHost::nodeForId(long nodeId) |
| 95 { | 95 { |
| 96 if (InspectorDOMAgent* domAgent = inspectorDOMAgent()) | 96 if (InspectorDOMAgent* domAgent = inspectorDOMAgent()) |
| 97 return domAgent->nodeForId(nodeId); | 97 return domAgent->nodeForId(nodeId); |
| 98 return 0; | 98 return 0; |
| 99 } | 99 } |
| 100 | 100 |
| 101 ScriptValue InjectedScriptHost::wrapObject(const ScriptValue& object, const Stri
ng& objectGroup) | |
| 102 { | |
| 103 if (m_inspectorController) | |
| 104 return m_inspectorController->wrapObject(object, objectGroup); | |
| 105 return ScriptValue(); | |
| 106 } | |
| 107 | |
| 108 ScriptValue InjectedScriptHost::unwrapObject(const String& objectId) | |
| 109 { | |
| 110 if (m_inspectorController) | |
| 111 return m_inspectorController->unwrapObject(objectId); | |
| 112 return ScriptValue(); | |
| 113 } | |
| 114 | |
| 115 long InjectedScriptHost::pushNodePathToFrontend(Node* node, bool withChildren, b
ool selectInUI) | 101 long InjectedScriptHost::pushNodePathToFrontend(Node* node, bool withChildren, b
ool selectInUI) |
| 116 { | 102 { |
| 117 InspectorFrontend* frontend = inspectorFrontend(); | 103 InspectorFrontend* frontend = inspectorFrontend(); |
| 118 InspectorDOMAgent* domAgent = inspectorDOMAgent(); | 104 InspectorDOMAgent* domAgent = inspectorDOMAgent(); |
| 119 if (!domAgent || !frontend) | 105 if (!domAgent || !frontend) |
| 120 return 0; | 106 return 0; |
| 121 long id = domAgent->pushNodePathToFrontend(node); | 107 long id = domAgent->pushNodePathToFrontend(node); |
| 122 if (withChildren) | 108 if (withChildren) |
| 123 domAgent->pushChildNodesToFrontend(id); | 109 domAgent->pushChildNodesToFrontend(id); |
| 124 if (selectInUI) | 110 if (selectInUI) |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 ScriptObject InjectedScriptHost::injectedScriptForId(long id) | 170 ScriptObject InjectedScriptHost::injectedScriptForId(long id) |
| 185 { | 171 { |
| 186 return m_idToInjectedScript.get(id); | 172 return m_idToInjectedScript.get(id); |
| 187 } | 173 } |
| 188 | 174 |
| 189 void InjectedScriptHost::discardInjectedScripts() | 175 void InjectedScriptHost::discardInjectedScripts() |
| 190 { | 176 { |
| 191 m_idToInjectedScript.clear(); | 177 m_idToInjectedScript.clear(); |
| 192 } | 178 } |
| 193 | 179 |
| 180 void InjectedScriptHost::releaseWrapperObjectGroup(long injectedScriptId, const
String& objectGroup) |
| 181 { |
| 182 if (injectedScriptId) { |
| 183 ScriptObject injectedScript = m_idToInjectedScript.get(injectedScriptId
); |
| 184 if (!injectedScript.hasNoValue()) |
| 185 releaseWrapperObjectGroup(injectedScript, objectGroup); |
| 186 } else { |
| 187 // Iterate over all injected scripts if injectedScriptId is not specifi
ed. |
| 188 for (IdToInjectedScriptMap::iterator it = m_idToInjectedScript.begin();
it != m_idToInjectedScript.end(); ++it) |
| 189 releaseWrapperObjectGroup(it->second, objectGroup); |
| 190 } |
| 191 } |
| 192 |
| 194 InspectorDOMAgent* InjectedScriptHost::inspectorDOMAgent() | 193 InspectorDOMAgent* InjectedScriptHost::inspectorDOMAgent() |
| 195 { | 194 { |
| 196 if (!m_inspectorController) | 195 if (!m_inspectorController) |
| 197 return 0; | 196 return 0; |
| 198 return m_inspectorController->domAgent(); | 197 return m_inspectorController->domAgent(); |
| 199 } | 198 } |
| 200 | 199 |
| 201 InspectorFrontend* InjectedScriptHost::inspectorFrontend() | 200 InspectorFrontend* InjectedScriptHost::inspectorFrontend() |
| 202 { | 201 { |
| 203 if (!m_inspectorController) | 202 if (!m_inspectorController) |
| 204 return 0; | 203 return 0; |
| 205 return m_inspectorController->m_frontend.get(); | 204 return m_inspectorController->m_frontend.get(); |
| 206 } | 205 } |
| 207 | 206 |
| 207 void InjectedScriptHost::releaseWrapperObjectGroup(const ScriptObject& injectedS
cript, const String& objectGroup) |
| 208 { |
| 209 ScriptFunctionCall releaseFunction(injectedScript.scriptState(), injectedScr
ipt, "releaseWrapperObjectGroup"); |
| 210 releaseFunction.appendArgument(objectGroup); |
| 211 releaseFunction.call(); |
| 212 } |
| 213 |
| 208 } // namespace WebCore | 214 } // namespace WebCore |
| 209 | 215 |
| 210 #endif // ENABLE(INSPECTOR) | 216 #endif // ENABLE(INSPECTOR) |
| OLD | NEW |