| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 | 53 ScriptState* scriptState() const { return m_injectedScriptObject.scriptState
(); } |
| 54 { | |
| 55 ASSERT(!isEmpty()); | |
| 56 return m_injectedScriptObject.scriptState(); | |
| 57 } | |
| 58 | 54 |
| 59 protected: | 55 protected: |
| 60 typedef bool (*InspectedStateAccessCheck)(ScriptState*); | 56 typedef bool (*InspectedStateAccessCheck)(ScriptState*); |
| 61 InjectedScriptBase(const String& name); | 57 InjectedScriptBase(const String& name); |
| 62 InjectedScriptBase(const String& name, ScriptValue, InspectedStateAccessChec
k); | 58 InjectedScriptBase(const String& name, ScriptValue, InspectedStateAccessChec
k); |
| 63 | 59 |
| 64 void initialize(ScriptValue, InspectedStateAccessCheck); | 60 void initialize(ScriptValue, InspectedStateAccessCheck); |
| 65 bool canAccessInspectedWindow() const; | 61 bool canAccessInspectedWindow() const; |
| 66 const ScriptValue& injectedScriptObject() const; | 62 const ScriptValue& injectedScriptObject() const; |
| 67 ScriptValue callFunctionWithEvalEnabled(ScriptFunctionCall&, bool& hadExcept
ion) const; | 63 ScriptValue callFunctionWithEvalEnabled(ScriptFunctionCall&, bool& hadExcept
ion) const; |
| 68 void makeCall(ScriptFunctionCall&, RefPtr<JSONValue>* result); | 64 void makeCall(ScriptFunctionCall&, RefPtr<JSONValue>* result); |
| 69 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); |
| 70 | 66 |
| 71 private: | 67 private: |
| 72 String m_name; | 68 String m_name; |
| 73 ScriptValue m_injectedScriptObject; | 69 ScriptValue m_injectedScriptObject; |
| 74 InspectedStateAccessCheck m_inspectedStateAccessCheck; | 70 InspectedStateAccessCheck m_inspectedStateAccessCheck; |
| 75 }; | 71 }; |
| 76 | 72 |
| 77 | 73 |
| 78 } // namespace WebCore | 74 } // namespace WebCore |
| 79 | 75 |
| 80 #endif | 76 #endif |
| OLD | NEW |