#ifndef CloseEvent_h
#define CloseEvent_h
#include "core/events/Event.h"
namespace WebCore {
struct CloseEventInit : public EventInit {
CloseEventInit()
: wasClean(false)
, code(0)
{
};
bool wasClean;
unsigned short code;
String reason;
};
class CloseEvent FINAL : public Event {
public:
static PassRefPtrWillBeRawPtr<CloseEvent> create()
{
return adoptRefWillBeNoop(new CloseEvent());
}
static PassRefPtrWillBeRawPtr<CloseEvent> create(bool wasClean, unsigned short code, const String& reason)
{
return adoptRefWillBeNoop(new CloseEvent(wasClean, code, reason));
}
static PassRefPtrWillBeRawPtr<CloseEvent> create(const AtomicString& type, const CloseEventInit& initializer)
{
return adoptRefWillBeNoop(new CloseEvent(type, initializer));
}
bool wasClean() const { return m_wasClean; }
unsigned short code() const { return m_code; }
String reason() const { return m_reason; }
virtual const AtomicString& interfaceName() const OVERRIDE { return EventNames::CloseEvent; }
virtual void trace(Visitor* visitor) OVERRIDE { Event::trace(visitor); }
private:
CloseEvent()
: Event(EventTypeNames::close, false, false)
, m_wasClean(false)
, m_code(0)
{
ScriptWrappable::init(this);
}
CloseEvent(bool wasClean, int code, const String& reason)
: Event(EventTypeNames::close, false, false)
, m_wasClean(wasClean)
, m_code(code)
, m_reason(reason)
{
ScriptWrappable::init(this);
}
CloseEvent(const AtomicString& type, const CloseEventInit& initializer)
: Event(type, initializer)
, m_wasClean(initializer.wasClean)
, m_code(initializer.code)
, m_reason(initializer.reason)
{
ScriptWrappable::init(this);
}
bool m_wasClean;
unsigned short m_code;
String m_reason;
};
}
#endif