#ifndef kjs_proxy_h
#define kjs_proxy_h
#include "JSDOMWindow.h"
#include <kjs/protect.h>
#include <wtf/RefPtr.h>
namespace KJS {
class JSGlobalObject;
class JSValue;
}
namespace WebCore {
class Event;
class EventListener;
class Frame;
class Node;
class String;
class KJSProxy {
public:
KJSProxy(Frame*);
~KJSProxy();
bool haveGlobalObject() const { return m_globalObject; }
JSDOMWindow* globalObject()
{
initScriptIfNeeded();
return m_globalObject;
}
KJS::JSValue* evaluate(const String& filename, int baseLine, const String& code);
void clear();
EventListener* createHTMLEventHandler(const String& functionName, const String& code, Node*);
#if ENABLE(SVG)
EventListener* createSVGEventHandler(const String& functionName, const String& code, Node*);
#endif
void finishedWithEvent(Event*);
void setEventHandlerLineno(int lineno) { m_handlerLineno = lineno; }
void clearDocumentWrapper();
void setProcessingTimerCallback(bool b) { m_processingTimerCallback = b; }
bool processingUserGesture() const;
bool isEnabled();
private:
void initScriptIfNeeded()
{
if (!m_globalObject)
initScript();
}
void initScript();
KJS::ProtectedPtr<JSDOMWindow> m_globalObject;
Frame* m_frame;
int m_handlerLineno;
bool m_processingTimerCallback;
bool m_processingInlineCode;
};
}
#endif