| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (C) 2007 Apple Inc. All rights reserved. | |
| 3 * | |
| 4 * Redistribution and use in source and binary forms, with or without | |
| 5 * modification, are permitted provided that the following conditions | |
| 6 * are met: | |
| 7 * | |
| 8 * 1. Redistributions of source code must retain the above copyright | |
| 9 * notice, this list of conditions and the following disclaimer. | |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | |
| 11 * notice, this list of conditions and the following disclaimer in the | |
| 12 * documentation and/or other materials provided with the distribution. | |
| 13 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of | |
| 14 * its contributors may be used to endorse or promote products derived | |
| 15 * from this software without specific prior written permission. | |
| 16 * | |
| 17 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY | |
| 18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
| 19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
| 20 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY | |
| 21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
| 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
| 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
| 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
| 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 27 */ | |
| 28 | |
| 29 #ifndef Console_h | |
| 30 #define Console_h | |
| 31 | |
| 32 #include "PlatformString.h" | |
| 33 #include <wtf/RefCounted.h> | |
| 34 #include <wtf/PassRefPtr.h> | |
| 35 | |
| 36 namespace KJS { | |
| 37 class ExecState; | |
| 38 class ArgList; | |
| 39 class Profile; | |
| 40 class JSValue; | |
| 41 } | |
| 42 | |
| 43 namespace WebCore { | |
| 44 | |
| 45 class Frame; | |
| 46 class Page; | |
| 47 class String; | |
| 48 | |
| 49 enum MessageSource { | |
| 50 HTMLMessageSource, | |
| 51 XMLMessageSource, | |
| 52 JSMessageSource, | |
| 53 CSSMessageSource, | |
| 54 OtherMessageSource | |
| 55 }; | |
| 56 | |
| 57 enum MessageLevel { | |
| 58 TipMessageLevel, | |
| 59 LogMessageLevel, | |
| 60 WarningMessageLevel, | |
| 61 ErrorMessageLevel, | |
| 62 ObjectMessageLevel, | |
| 63 StartGroupMessageLevel, | |
| 64 EndGroupMessageLevel | |
| 65 }; | |
| 66 | |
| 67 class Console : public RefCounted<Console> { | |
| 68 public: | |
| 69 static PassRefPtr<Console> create(Frame* frame) { return adoptRef(new Co
nsole(frame)); } | |
| 70 | |
| 71 void disconnectFrame(); | |
| 72 | |
| 73 void addMessage(MessageSource, MessageLevel, const String& message, unsi
gned lineNumber, const String& sourceURL); | |
| 74 | |
| 75 #if USE(JSC) | |
| 76 void debug(KJS::ExecState*, const KJS::ArgList&); | |
| 77 void error(KJS::ExecState*, const KJS::ArgList&); | |
| 78 void info(KJS::ExecState*, const KJS::ArgList&); | |
| 79 void log(KJS::ExecState*, const KJS::ArgList&); | |
| 80 void warn(KJS::ExecState*, const KJS::ArgList&); | |
| 81 void dir(KJS::ExecState*, const KJS::ArgList&); | |
| 82 void assertCondition(bool condition, KJS::ExecState*, const KJS::ArgList
&); | |
| 83 void count(KJS::ExecState*, const KJS::ArgList&); | |
| 84 void profile(KJS::ExecState*, const KJS::ArgList&); | |
| 85 void profileEnd(KJS::ExecState*, const KJS::ArgList&); | |
| 86 void time(const KJS::UString& title); | |
| 87 void timeEnd(KJS::ExecState*, const KJS::ArgList&); | |
| 88 void group(KJS::ExecState*, const KJS::ArgList&); | |
| 89 void groupEnd(); | |
| 90 | |
| 91 void reportException(KJS::ExecState*, KJS::JSValue*); | |
| 92 void reportCurrentException(KJS::ExecState*); | |
| 93 #elif USE(V8) | |
| 94 void debug(const String& message); | |
| 95 void error(const String& message); | |
| 96 void info(const String& message); | |
| 97 void log(const String& message); | |
| 98 void warn(const String& message); | |
| 99 void time(const String& title); | |
| 100 void groupEnd(); | |
| 101 #endif | |
| 102 private: | |
| 103 inline Page* page() const; | |
| 104 | |
| 105 Console(Frame*); | |
| 106 | |
| 107 Frame* m_frame; | |
| 108 }; | |
| 109 | |
| 110 } // namespace WebCore | |
| 111 | |
| 112 #endif // Console_h | |
| OLD | NEW |