1/*
2 This file is part of the WebKit open source project.
3 This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
21#pragma once
22
23#if ENABLE(NOTIFICATIONS)
24
25#include "JSDOMConvertDictionary.h"
26#include "JSDOMConvertEnumeration.h"
27#include "JSDOMWrapper.h"
28#include "JSEventTarget.h"
29#include "Notification.h"
30#include <wtf/NeverDestroyed.h>
31
32namespace WebCore {
33
34class WEBCORE_EXPORT JSNotification : public JSEventTarget {
35public:
36 using Base = JSEventTarget;
37 using DOMWrapped = Notification;
38 static JSNotification* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref<Notification>&& impl)
39 {
40 JSNotification* ptr = new (NotNull, JSC::allocateCell<JSNotification>(globalObject->vm().heap)) JSNotification(structure, *globalObject, WTFMove(impl));
41 ptr->finishCreation(globalObject->vm());
42 return ptr;
43 }
44
45 static JSC::JSObject* createPrototype(JSC::VM&, JSDOMGlobalObject&);
46 static JSC::JSObject* prototype(JSC::VM&, JSDOMGlobalObject&);
47 static Notification* toWrapped(JSC::VM&, JSC::JSValue);
48
49 DECLARE_INFO;
50
51 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
52 {
53 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
54 }
55
56 static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
57 static void heapSnapshot(JSCell*, JSC::HeapSnapshotBuilder&);
58 Notification& wrapped() const
59 {
60 return static_cast<Notification&>(Base::wrapped());
61 }
62protected:
63 JSNotification(JSC::Structure*, JSDOMGlobalObject&, Ref<Notification>&&);
64
65 void finishCreation(JSC::VM&);
66};
67
68class JSNotificationOwner : public JSC::WeakHandleOwner {
69public:
70 virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&, const char**);
71 virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
72};
73
74inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, Notification*)
75{
76 static NeverDestroyed<JSNotificationOwner> owner;
77 return &owner.get();
78}
79
80inline void* wrapperKey(Notification* wrappableObject)
81{
82 return wrappableObject;
83}
84
85WEBCORE_EXPORT JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, Notification&);
86inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, Notification* impl) { return impl ? toJS(state, globalObject, *impl) : JSC::jsNull(); }
87JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject*, Ref<Notification>&&);
88inline JSC::JSValue toJSNewlyCreated(JSC::ExecState* state, JSDOMGlobalObject* globalObject, RefPtr<Notification>&& impl) { return impl ? toJSNewlyCreated(state, globalObject, impl.releaseNonNull()) : JSC::jsNull(); }
89
90template<> struct JSDOMWrapperConverterTraits<Notification> {
91 using WrapperClass = JSNotification;
92 using ToWrappedReturnType = Notification*;
93};
94#if ENABLE(NOTIFICATIONS)
95
96String convertEnumerationToString(Notification::Direction);
97template<> JSC::JSString* convertEnumerationToJS(JSC::ExecState&, Notification::Direction);
98
99template<> Optional<Notification::Direction> parseEnumeration<Notification::Direction>(JSC::ExecState&, JSC::JSValue);
100template<> const char* expectedEnumerationValues<Notification::Direction>();
101
102#endif
103
104#if ENABLE(NOTIFICATIONS)
105
106template<> Notification::Options convertDictionary<Notification::Options>(JSC::ExecState&, JSC::JSValue);
107
108#endif
109
110
111} // namespace WebCore
112
113#endif // ENABLE(NOTIFICATIONS)
114