Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM Permissions.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #ifndef mozilla_dom_PermissionsBinding_h
4 : #define mozilla_dom_PermissionsBinding_h
5 :
6 : #include "js/RootingAPI.h"
7 : #include "jspubtd.h"
8 : #include "mozilla/ErrorResult.h"
9 : #include "mozilla/dom/BindingDeclarations.h"
10 : #include "mozilla/dom/Nullable.h"
11 :
12 : namespace mozilla {
13 : namespace dom {
14 :
15 : struct NativePropertyHooks;
16 : struct PermissionDescriptorAtoms;
17 : class Permissions;
18 : struct PermissionsAtoms;
19 : class ProtoAndIfaceCache;
20 :
21 : } // namespace dom
22 : } // namespace mozilla
23 :
24 : namespace mozilla {
25 : namespace dom {
26 :
27 : enum class PermissionName : uint8_t {
28 : Geolocation,
29 : Notifications,
30 : Push,
31 : Persistent_storage,
32 : EndGuard_
33 : };
34 :
35 : namespace PermissionNameValues {
36 : extern const EnumEntry strings[5];
37 : } // namespace PermissionNameValues
38 :
39 : bool
40 : ToJSValue(JSContext* aCx, PermissionName aArgument, JS::MutableHandle<JS::Value> aValue);
41 :
42 :
43 : struct PermissionDescriptor : public DictionaryBase
44 : {
45 : MOZ_INIT_OUTSIDE_CTOR PermissionName mName;
46 :
47 : PermissionDescriptor();
48 :
49 : explicit inline PermissionDescriptor(const FastDictionaryInitializer& )
50 : {
51 : // Do nothing here; this is used by our "Fast" subclass
52 : }
53 :
54 : explicit inline PermissionDescriptor(const PermissionDescriptor& aOther)
55 : {
56 : *this = aOther;
57 : }
58 :
59 : bool
60 : Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
61 :
62 : bool
63 : Init(const nsAString& aJSON);
64 :
65 : bool
66 : ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
67 :
68 : bool
69 : ToJSON(nsAString& aJSON) const;
70 :
71 : void
72 : TraceDictionary(JSTracer* trc);
73 :
74 : PermissionDescriptor&
75 : operator=(const PermissionDescriptor& aOther);
76 :
77 : private:
78 : static bool
79 : InitIds(JSContext* cx, PermissionDescriptorAtoms* atomsCache);
80 : };
81 :
82 : namespace binding_detail {
83 : struct FastPermissionDescriptor : public PermissionDescriptor
84 : {
85 : inline FastPermissionDescriptor()
86 : : PermissionDescriptor(FastDictionaryInitializer())
87 : {
88 : // Doesn't matter what int we pass to the parent constructor
89 : }
90 : };
91 : } // namespace binding_detail
92 :
93 :
94 : namespace PermissionsBinding {
95 :
96 : typedef mozilla::dom::Permissions NativeType;
97 :
98 : JSObject*
99 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);
100 :
101 : const JSClass*
102 : GetJSClass();
103 :
104 : bool
105 : Wrap(JSContext* aCx, mozilla::dom::Permissions* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
106 :
107 : template <class T>
108 0 : inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
109 : {
110 0 : JS::Rooted<JSObject*> reflector(aCx);
111 0 : return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
112 : }
113 :
114 : // We declare this as an array so that retrieving a pointer to this
115 : // binding's property hooks only requires compile/link-time resolvable
116 : // address arithmetic. Declaring it as a pointer instead would require
117 : // doing a run-time load to fetch a pointer to this binding's property
118 : // hooks. And then structures which embedded a pointer to this structure
119 : // would require a run-time load for proper initialization, which would
120 : // then induce static constructors. Lots of static constructors.
121 : extern const NativePropertyHooks sNativePropertyHooks[];
122 :
123 : void
124 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
125 :
126 : JS::Handle<JSObject*>
127 : GetProtoObjectHandle(JSContext* aCx);
128 :
129 : JS::Handle<JSObject*>
130 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);
131 :
132 : JSObject*
133 : GetConstructorObject(JSContext* aCx);
134 :
135 : } // namespace PermissionsBinding
136 :
137 :
138 :
139 : } // namespace dom
140 : } // namespace mozilla
141 :
142 : #endif // mozilla_dom_PermissionsBinding_h
|