| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010 Google Inc. All rights reserved. | 2 * Copyright (c) 2010 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 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 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 ScriptArguments_h | 31 #ifndef ScriptArguments_h |
| 32 #define ScriptArguments_h | 32 #define ScriptArguments_h |
| 33 | 33 |
| 34 #include "ScriptState.h" |
| 34 #include "PlatformString.h" | 35 #include "PlatformString.h" |
| 35 #include "ScriptState.h" | 36 |
| 36 #include <wtf/Forward.h> | 37 #include <wtf/Forward.h> |
| 37 #include <wtf/RefCounted.h> | 38 #include <wtf/RefCounted.h> |
| 38 #include <wtf/Vector.h> | 39 #include <wtf/Vector.h> |
| 39 | 40 |
| 40 namespace WebCore { | 41 namespace WebCore { |
| 41 | 42 |
| 43 class DOMWindow; |
| 44 class InspectorArray; |
| 45 class InjectedScriptManager; |
| 42 class ScriptValue; | 46 class ScriptValue; |
| 43 | 47 |
| 48 // FIXME: consider renaming to ConsoleArguments. |
| 44 class ScriptArguments : public RefCounted<ScriptArguments> { | 49 class ScriptArguments : public RefCounted<ScriptArguments> { |
| 50 WTF_MAKE_NONCOPYABLE(ScriptArguments); |
| 45 public: | 51 public: |
| 46 static PassRefPtr<ScriptArguments> create(ScriptState*, Vector<ScriptValue>&
arguments); | 52 ScriptArguments() {}; |
| 53 virtual ~ScriptArguments() {} |
| 47 | 54 |
| 48 ~ScriptArguments(); | 55 virtual PassRefPtr<InspectorArray> wrap(InjectedScriptManager*) const = 0; |
| 56 virtual DOMWindow* domWindow() const = 0; |
| 49 | 57 |
| 50 const ScriptValue& argumentAt(size_t) const; | 58 virtual bool argumentGetString(size_t, String&) const = 0; |
| 51 size_t argumentCount() const { return m_arguments.size(); } | 59 virtual bool argumentToString(size_t, String&) const = 0; |
| 52 | 60 |
| 53 ScriptState* globalState() const; | 61 virtual bool isEqual(ScriptArguments*) const = 0; |
| 54 | 62 |
| 55 bool getFirstArgumentAsString(WTF::String& result, bool checkForNullOrUndefi
ned = false); | 63 virtual ScriptValue argumentAt(size_t) const = 0; |
| 56 bool isEqual(ScriptArguments*) const; | 64 virtual size_t argumentCount() const = 0; |
| 65 }; |
| 66 |
| 67 class JavaScriptArguments : public ScriptArguments { |
| 68 public: |
| 69 static PassRefPtr<JavaScriptArguments> create(ScriptState*, Vector<ScriptVal
ue>& arguments); |
| 70 virtual ~JavaScriptArguments(); |
| 71 |
| 72 virtual PassRefPtr<InspectorArray> wrap(InjectedScriptManager*) const; |
| 73 virtual DOMWindow* domWindow() const; |
| 74 |
| 75 virtual bool argumentGetString(size_t, String&) const; |
| 76 virtual bool argumentToString(size_t, String&) const; |
| 77 |
| 78 virtual bool isEqual(ScriptArguments*) const; |
| 79 |
| 80 virtual ScriptValue argumentAt(size_t) const; |
| 81 virtual size_t argumentCount() const { return m_arguments.size(); } |
| 57 | 82 |
| 58 private: | 83 private: |
| 59 ScriptArguments(ScriptState*, Vector<ScriptValue>& arguments); | 84 JavaScriptArguments(ScriptState*, Vector<ScriptValue>& arguments); |
| 60 | 85 |
| 61 ScriptStateProtectedPtr m_scriptState; | 86 ScriptStateProtectedPtr m_scriptState; |
| 62 Vector<ScriptValue> m_arguments; | 87 Vector<ScriptValue> m_arguments; |
| 63 }; | 88 }; |
| 64 | 89 |
| 65 } // namespace WebCore | 90 } // namespace WebCore |
| 66 | 91 |
| 67 #endif // ScriptArguments_h | 92 #endif // ScriptArguments_h |
| OLD | NEW |