#ifndef V8CustomElementLifecycleCallbacks_h
#define V8CustomElementLifecycleCallbacks_h
#include "bindings/v8/NewScriptState.h"
#include "bindings/v8/ScopedPersistent.h"
#include "core/dom/ContextLifecycleObserver.h"
#include "core/dom/custom/CustomElementLifecycleCallbacks.h"
#include "wtf/PassOwnPtr.h"
#include "wtf/PassRefPtr.h"
#include <v8.h>
namespace WebCore {
class CustomElementLifecycleCallbacks;
class Element;
class ExecutionContext;
class V8PerContextData;
class V8CustomElementLifecycleCallbacks FINAL : public CustomElementLifecycleCallbacks, ContextLifecycleObserver {
public:
static PassRefPtr<V8CustomElementLifecycleCallbacks> create(ExecutionContext*, v8::Handle<v8::Object> prototype, v8::Handle<v8::Function> created, v8::Handle<v8::Function> attached, v8::Handle<v8::Function> detached, v8::Handle<v8::Function> attributeChanged);
virtual ~V8CustomElementLifecycleCallbacks();
bool setBinding(CustomElementDefinition* owner, PassOwnPtr<CustomElementBinding>);
private:
V8CustomElementLifecycleCallbacks(ExecutionContext*, v8::Handle<v8::Object> prototype, v8::Handle<v8::Function> created, v8::Handle<v8::Function> attached, v8::Handle<v8::Function> detached, v8::Handle<v8::Function> attributeChanged);
virtual void created(Element*) OVERRIDE;
virtual void attached(Element*) OVERRIDE;
virtual void detached(Element*) OVERRIDE;
virtual void attributeChanged(Element*, const AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue) OVERRIDE;
void call(const ScopedPersistent<v8::Function>& weakCallback, Element*);
V8PerContextData* creationContextData();
CustomElementDefinition* m_owner;
RefPtr<NewScriptState> m_scriptState;
ScopedPersistent<v8::Object> m_prototype;
ScopedPersistent<v8::Function> m_created;
ScopedPersistent<v8::Function> m_attached;
ScopedPersistent<v8::Function> m_detached;
ScopedPersistent<v8::Function> m_attributeChanged;
};
}
#endif