| 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 14 matching lines...) Expand all Loading... |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 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 InjectedScriptBase_h | 31 #ifndef InjectedScriptBase_h |
| 32 #define InjectedScriptBase_h | 32 #define InjectedScriptBase_h |
| 33 | 33 |
| 34 #include "InspectorTypeBuilder.h" | 34 #include "InspectorTypeBuilder.h" |
| 35 #include "bindings/v8/ScriptObject.h" | |
| 36 #include "bindings/v8/ScriptState.h" | 35 #include "bindings/v8/ScriptState.h" |
| 36 #include "bindings/v8/ScriptValue.h" |
| 37 #include "wtf/Forward.h" | 37 #include "wtf/Forward.h" |
| 38 | 38 |
| 39 namespace WebCore { | 39 namespace WebCore { |
| 40 | 40 |
| 41 class JSONValue; | 41 class JSONValue; |
| 42 class ScriptFunctionCall; | 42 class ScriptFunctionCall; |
| 43 | 43 |
| 44 typedef String ErrorString; | 44 typedef String ErrorString; |
| 45 | 45 |
| 46 | 46 |
| 47 class InjectedScriptBase { | 47 class InjectedScriptBase { |
| 48 public: | 48 public: |
| 49 virtual ~InjectedScriptBase() { } | 49 virtual ~InjectedScriptBase() { } |
| 50 | 50 |
| 51 const String& name() const { return m_name; } | 51 const String& name() const { return m_name; } |
| 52 bool isEmpty() const { return m_injectedScriptObject.isEmpty(); } | 52 bool isEmpty() const { return m_injectedScriptObject.isEmpty(); } |
| 53 ScriptState* scriptState() const { return m_injectedScriptObject.scriptState
(); } | 53 ScriptState* scriptState() const { return m_injectedScriptObject.scriptState
(); } |
| 54 | 54 |
| 55 protected: | 55 protected: |
| 56 typedef bool (*InspectedStateAccessCheck)(ScriptState*); | 56 typedef bool (*InspectedStateAccessCheck)(ScriptState*); |
| 57 InjectedScriptBase(const String& name); | 57 InjectedScriptBase(const String& name); |
| 58 InjectedScriptBase(const String& name, ScriptObject, InspectedStateAccessChe
ck); | 58 InjectedScriptBase(const String& name, ScriptValue, InspectedStateAccessChec
k); |
| 59 | 59 |
| 60 void initialize(ScriptObject, InspectedStateAccessCheck); | 60 void initialize(ScriptValue, InspectedStateAccessCheck); |
| 61 bool canAccessInspectedWindow() const; | 61 bool canAccessInspectedWindow() const; |
| 62 const ScriptObject& injectedScriptObject() const; | 62 const ScriptValue& injectedScriptObject() const; |
| 63 ScriptValue callFunctionWithEvalEnabled(ScriptFunctionCall&, bool& hadExcept
ion) const; | 63 ScriptValue callFunctionWithEvalEnabled(ScriptFunctionCall&, bool& hadExcept
ion) const; |
| 64 void makeCall(ScriptFunctionCall&, RefPtr<JSONValue>* result); | 64 void makeCall(ScriptFunctionCall&, RefPtr<JSONValue>* result); |
| 65 void makeEvalCall(ErrorString*, ScriptFunctionCall&, RefPtr<TypeBuilder::Run
time::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown); | 65 void makeEvalCall(ErrorString*, ScriptFunctionCall&, RefPtr<TypeBuilder::Run
time::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown); |
| 66 | 66 |
| 67 private: | 67 private: |
| 68 String m_name; | 68 String m_name; |
| 69 ScriptObject m_injectedScriptObject; | 69 ScriptValue m_injectedScriptObject; |
| 70 InspectedStateAccessCheck m_inspectedStateAccessCheck; | 70 InspectedStateAccessCheck m_inspectedStateAccessCheck; |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 | 73 |
| 74 } // namespace WebCore | 74 } // namespace WebCore |
| 75 | 75 |
| 76 #endif | 76 #endif |
| OLD | NEW |