Chromium Code Reviews| 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 25 matching lines...) Expand all Loading... | |
| 36 #include "bindings/v8/ScriptState.h" | 36 #include "bindings/v8/ScriptState.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 | |
| 47 class InjectedScriptBase { | 46 class InjectedScriptBase { |
| 48 public: | 47 public: |
| 49 virtual ~InjectedScriptBase() { } | 48 virtual ~InjectedScriptBase() { } |
| 50 | 49 virtual const String& name() const = 0; |
| 51 const String& name() const { return m_name; } | 50 virtual bool isEmpty() const = 0; |
| 52 bool isEmpty() const { return m_injectedScriptObject.isEmpty(); } | 51 virtual ScriptState* scriptState() const = 0; |
| 53 ScriptState* scriptState() const { return m_injectedScriptObject.scriptState (); } | 52 virtual bool isJavaScript() const = 0; |
| 54 | 53 |
| 55 protected: | 54 protected: |
| 56 typedef bool (*InspectedStateAccessCheck)(ScriptState*); | 55 typedef bool (*InspectedStateAccessCheck)(ScriptState*); |
| 57 InjectedScriptBase(const String& name); | 56 }; |
| 58 InjectedScriptBase(const String& name, ScriptObject, InspectedStateAccessChe ck); | 57 |
| 58 class V8InjectedScriptBase : public virtual InjectedScriptBase { | |
|
vsm
2014/06/03 14:24:49
The virtual base class feels kind of nasty. Not s
Jacob
2014/06/03 20:23:13
This is ugly. Added a FIXMEDart that we need to fi
| |
| 59 public: | |
| 60 virtual ~V8InjectedScriptBase() { } | |
| 61 | |
| 62 virtual bool isEmpty() const { return m_injectedScriptObject.isEmpty(); } | |
| 63 virtual ScriptState* scriptState() const { return m_injectedScriptObject.scr iptState(); } | |
| 64 | |
| 65 virtual bool isJavaScript() const { return true; } | |
| 66 | |
| 67 virtual const String& name() const { return m_name; } | |
| 68 | |
| 69 protected: | |
| 70 V8InjectedScriptBase(const String& name); | |
| 71 V8InjectedScriptBase(const String& name, ScriptObject, InspectedStateAccessC heck); | |
| 59 | 72 |
| 60 void initialize(ScriptObject, InspectedStateAccessCheck); | 73 void initialize(ScriptObject, InspectedStateAccessCheck); |
| 61 bool canAccessInspectedWindow() const; | 74 |
| 62 const ScriptObject& injectedScriptObject() const; | 75 const ScriptObject& injectedScriptObject() const; |
| 63 ScriptValue callFunctionWithEvalEnabled(ScriptFunctionCall&, bool& hadExcept ion) const; | 76 ScriptValue callFunctionWithEvalEnabled(ScriptFunctionCall&, bool& hadExcept ion) const; |
| 64 void makeCall(ScriptFunctionCall&, RefPtr<JSONValue>* result); | 77 void makeCall(ScriptFunctionCall&, RefPtr<JSONValue>* result); |
| 65 void makeEvalCall(ErrorString*, ScriptFunctionCall&, RefPtr<TypeBuilder::Run time::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown); | 78 void makeEvalCall(ErrorString*, ScriptFunctionCall&, RefPtr<TypeBuilder::Run time::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown); |
| 66 | 79 |
| 80 bool canAccessInspectedWindow() const; | |
| 81 String m_name; | |
| 82 InspectedStateAccessCheck m_inspectedStateAccessCheck; | |
| 83 | |
| 67 private: | 84 private: |
| 68 String m_name; | |
| 69 ScriptObject m_injectedScriptObject; | 85 ScriptObject m_injectedScriptObject; |
|
rmacnak
2014/06/03 17:32:34
Add a note this should become V8ScriptValue in M37
Jacob
2014/06/03 20:23:13
done.
| |
| 70 InspectedStateAccessCheck m_inspectedStateAccessCheck; | |
| 71 }; | 86 }; |
| 72 | 87 |
| 73 | 88 |
| 74 } // namespace WebCore | 89 } // namespace WebCore |
| 75 | 90 |
| 76 #endif | 91 #endif |
| OLD | NEW |