| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 15 matching lines...) Expand all Loading... |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 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. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef InjectedScript_h | 31 #ifndef InjectedScript_h |
| 32 #define InjectedScript_h | 32 #define InjectedScript_h |
| 33 | 33 |
| 34 #include "bindings/core/v8/ScriptValue.h" | 34 #include "bindings/core/v8/ScriptValue.h" |
| 35 #include "core/InspectorTypeBuilder.h" | 35 #include "core/InspectorTypeBuilder.h" |
| 36 #include "core/inspector/InjectedScriptBase.h" | |
| 37 #include "core/inspector/InjectedScriptManager.h" | 36 #include "core/inspector/InjectedScriptManager.h" |
| 38 #include "core/inspector/InjectedScriptNative.h" | 37 #include "core/inspector/InjectedScriptNative.h" |
| 39 #include "wtf/Forward.h" | 38 #include "wtf/Forward.h" |
| 40 #include "wtf/Vector.h" | 39 #include "wtf/Vector.h" |
| 41 | 40 |
| 42 namespace blink { | 41 namespace blink { |
| 43 | 42 |
| 43 class JSONValue; |
| 44 class Node; | 44 class Node; |
| 45 class ScriptFunctionCall; |
| 45 | 46 |
| 46 class InjectedScript final : public InjectedScriptBase { | 47 typedef String ErrorString; |
| 48 PassRefPtr<JSONValue> toJSONValue(const ScriptValue&); |
| 49 |
| 50 |
| 51 class InjectedScript final { |
| 47 public: | 52 public: |
| 48 InjectedScript(); | 53 InjectedScript(); |
| 49 virtual ~InjectedScript() { } | 54 ~InjectedScript(); |
| 55 |
| 56 bool isEmpty() const { return m_injectedScriptObject.isEmpty(); } |
| 57 ScriptState* scriptState() const |
| 58 { |
| 59 ASSERT(!isEmpty()); |
| 60 return m_injectedScriptObject.scriptState(); |
| 61 } |
| 50 | 62 |
| 51 void evaluate( | 63 void evaluate( |
| 52 ErrorString*, | 64 ErrorString*, |
| 53 const String& expression, | 65 const String& expression, |
| 54 const String& objectGroup, | 66 const String& objectGroup, |
| 55 bool includeCommandLineAPI, | 67 bool includeCommandLineAPI, |
| 56 bool returnByValue, | 68 bool returnByValue, |
| 57 bool generatePreview, | 69 bool generatePreview, |
| 58 RefPtr<TypeBuilder::Runtime::RemoteObject>* result, | 70 RefPtr<TypeBuilder::Runtime::RemoteObject>* result, |
| 59 TypeBuilder::OptOutput<bool>* wasThrown, | 71 TypeBuilder::OptOutput<bool>* wasThrown, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapNode(Node*, const String&
groupName); | 111 PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapNode(Node*, const String&
groupName); |
| 100 ScriptValue findObjectById(const String& objectId) const; | 112 ScriptValue findObjectById(const String& objectId) const; |
| 101 | 113 |
| 102 String objectIdToObjectGroupName(const String& objectId) const; | 114 String objectIdToObjectGroupName(const String& objectId) const; |
| 103 void releaseObjectGroup(const String&); | 115 void releaseObjectGroup(const String&); |
| 104 | 116 |
| 105 void setCustomObjectFormatterEnabled(bool); | 117 void setCustomObjectFormatterEnabled(bool); |
| 106 | 118 |
| 107 private: | 119 private: |
| 108 friend InjectedScript InjectedScriptManager::injectedScriptFor(ScriptState*)
; | 120 friend InjectedScript InjectedScriptManager::injectedScriptFor(ScriptState*)
; |
| 121 using InspectedStateAccessCheck = bool (*)(ScriptState*); |
| 109 InjectedScript(ScriptValue, InspectedStateAccessCheck, PassRefPtr<InjectedSc
riptNative>); | 122 InjectedScript(ScriptValue, InspectedStateAccessCheck, PassRefPtr<InjectedSc
riptNative>); |
| 110 | 123 |
| 111 ScriptValue nodeAsScriptValue(Node*); | 124 ScriptValue nodeAsScriptValue(Node*); |
| 125 void initialize(ScriptValue, InspectedStateAccessCheck); |
| 126 bool canAccessInspectedWindow() const; |
| 127 const ScriptValue& injectedScriptObject() const; |
| 128 ScriptValue callFunctionWithEvalEnabled(ScriptFunctionCall&, bool& hadExcept
ion) const; |
| 129 void makeCall(ScriptFunctionCall&, RefPtr<JSONValue>* result); |
| 130 void makeEvalCall(ErrorString*, ScriptFunctionCall&, RefPtr<TypeBuilder::Run
time::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown, RefPtr<Typ
eBuilder::Debugger::ExceptionDetails>* = 0); |
| 131 void makeCallWithExceptionDetails(ScriptFunctionCall&, RefPtr<JSONValue>* re
sult, RefPtr<TypeBuilder::Debugger::ExceptionDetails>*); |
| 112 | 132 |
| 133 ScriptValue m_injectedScriptObject; |
| 134 InspectedStateAccessCheck m_inspectedStateAccessCheck; |
| 113 RefPtr<InjectedScriptNative> m_native; | 135 RefPtr<InjectedScriptNative> m_native; |
| 114 }; | 136 }; |
| 115 | 137 |
| 116 } // namespace blink | 138 } // namespace blink |
| 117 | 139 |
| 118 #endif | 140 #endif |
| OLD | NEW |