Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM FlyWebDiscoveryManager.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #ifndef mozilla_dom_FlyWebDiscoveryManagerBinding_h
4 : #define mozilla_dom_FlyWebDiscoveryManagerBinding_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/CallbackInterface.h"
11 : #include "mozilla/dom/Nullable.h"
12 : #include "mozilla/dom/ToJSValue.h"
13 :
14 : namespace mozilla {
15 : namespace dom {
16 :
17 : struct FlyWebDiscoveredService;
18 : struct FlyWebDiscoveredServiceAtoms;
19 : class FlyWebDiscoveryCallback;
20 : struct FlyWebDiscoveryCallbackAtoms;
21 : class FlyWebDiscoveryManager;
22 : struct FlyWebDiscoveryManagerAtoms;
23 : struct FlyWebPairedService;
24 : struct FlyWebPairedServiceAtoms;
25 : class FlyWebPairingCallback;
26 : struct FlyWebPairingCallbackAtoms;
27 : struct NativePropertyHooks;
28 : class ProtoAndIfaceCache;
29 :
30 : } // namespace dom
31 : } // namespace mozilla
32 :
33 : namespace mozilla {
34 : namespace dom {
35 :
36 0 : struct FlyWebDiscoveredService : public DictionaryBase
37 : {
38 : MOZ_INIT_OUTSIDE_CTOR nsString mCert;
39 : MOZ_INIT_OUTSIDE_CTOR nsString mDisplayName;
40 : MOZ_INIT_OUTSIDE_CTOR nsString mPath;
41 : MOZ_INIT_OUTSIDE_CTOR nsString mServiceId;
42 : MOZ_INIT_OUTSIDE_CTOR nsString mServiceType;
43 : MOZ_INIT_OUTSIDE_CTOR nsString mTransport;
44 :
45 : FlyWebDiscoveredService();
46 :
47 0 : explicit inline FlyWebDiscoveredService(const FastDictionaryInitializer& )
48 0 : {
49 : // Do nothing here; this is used by our "Fast" subclass
50 0 : }
51 :
52 0 : explicit inline FlyWebDiscoveredService(const FlyWebDiscoveredService& aOther)
53 0 : {
54 0 : *this = aOther;
55 0 : }
56 :
57 : bool
58 : Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
59 :
60 : bool
61 : Init(const nsAString& aJSON);
62 :
63 : bool
64 : ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
65 :
66 : bool
67 : ToJSON(nsAString& aJSON) const;
68 :
69 : void
70 : TraceDictionary(JSTracer* trc);
71 :
72 : FlyWebDiscoveredService&
73 : operator=(const FlyWebDiscoveredService& aOther);
74 :
75 : private:
76 : static bool
77 : InitIds(JSContext* cx, FlyWebDiscoveredServiceAtoms* atomsCache);
78 : };
79 :
80 : namespace binding_detail {
81 : struct FastFlyWebDiscoveredService : public FlyWebDiscoveredService
82 : {
83 : inline FastFlyWebDiscoveredService()
84 : : FlyWebDiscoveredService(FastDictionaryInitializer())
85 : {
86 : // Doesn't matter what int we pass to the parent constructor
87 : }
88 : };
89 : } // namespace binding_detail
90 :
91 :
92 0 : struct FlyWebPairedService : public DictionaryBase
93 : {
94 : MOZ_INIT_OUTSIDE_CTOR FlyWebDiscoveredService mDiscoveredService;
95 : MOZ_INIT_OUTSIDE_CTOR nsString mHostname;
96 : MOZ_INIT_OUTSIDE_CTOR nsString mUiUrl;
97 :
98 : FlyWebPairedService();
99 :
100 : explicit inline FlyWebPairedService(const FastDictionaryInitializer& )
101 : : mDiscoveredService(FastDictionaryInitializer())
102 : {
103 : // Do nothing here; this is used by our "Fast" subclass
104 : }
105 :
106 : explicit inline FlyWebPairedService(const FlyWebPairedService& aOther)
107 : : mDiscoveredService(FastDictionaryInitializer())
108 : {
109 : *this = aOther;
110 : }
111 :
112 : bool
113 : Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
114 :
115 : bool
116 : Init(const nsAString& aJSON);
117 :
118 : bool
119 : ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
120 :
121 : bool
122 : ToJSON(nsAString& aJSON) const;
123 :
124 : void
125 : TraceDictionary(JSTracer* trc);
126 :
127 : FlyWebPairedService&
128 : operator=(const FlyWebPairedService& aOther);
129 :
130 : private:
131 : static bool
132 : InitIds(JSContext* cx, FlyWebPairedServiceAtoms* atomsCache);
133 : };
134 :
135 : namespace binding_detail {
136 : struct FastFlyWebPairedService : public FlyWebPairedService
137 : {
138 : inline FastFlyWebPairedService()
139 : : FlyWebPairedService(FastDictionaryInitializer())
140 : {
141 : // Doesn't matter what int we pass to the parent constructor
142 : }
143 : };
144 : } // namespace binding_detail
145 :
146 :
147 : namespace FlyWebDiscoveryManagerBinding {
148 :
149 : typedef mozilla::dom::FlyWebDiscoveryManager NativeType;
150 :
151 : bool
152 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
153 :
154 : JSObject*
155 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);
156 :
157 : const JSClass*
158 : GetJSClass();
159 :
160 : bool
161 : Wrap(JSContext* aCx, mozilla::dom::FlyWebDiscoveryManager* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
162 :
163 : template <class T>
164 0 : inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
165 : {
166 0 : JS::Rooted<JSObject*> reflector(aCx);
167 0 : return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
168 : }
169 :
170 : // We declare this as an array so that retrieving a pointer to this
171 : // binding's property hooks only requires compile/link-time resolvable
172 : // address arithmetic. Declaring it as a pointer instead would require
173 : // doing a run-time load to fetch a pointer to this binding's property
174 : // hooks. And then structures which embedded a pointer to this structure
175 : // would require a run-time load for proper initialization, which would
176 : // then induce static constructors. Lots of static constructors.
177 : extern const NativePropertyHooks sNativePropertyHooks[];
178 :
179 : void
180 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
181 :
182 : JS::Handle<JSObject*>
183 : GetProtoObjectHandle(JSContext* aCx);
184 :
185 : JS::Handle<JSObject*>
186 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);
187 :
188 : JSObject*
189 : GetConstructorObject(JSContext* aCx);
190 :
191 : } // namespace FlyWebDiscoveryManagerBinding
192 :
193 :
194 :
195 0 : class FlyWebDiscoveryCallback : public CallbackInterface
196 : {
197 : public:
198 : explicit inline FlyWebDiscoveryCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, nsIGlobalObject* aIncumbentGlobal)
199 : : CallbackInterface(aCx, aCallback, aIncumbentGlobal)
200 : {
201 : }
202 :
203 0 : explicit inline FlyWebDiscoveryCallback(JS::Handle<JSObject*> aCallback, const FastCallbackConstructor& )
204 0 : : CallbackInterface(aCallback, FastCallbackConstructor())
205 : {
206 0 : }
207 :
208 : explicit inline FlyWebDiscoveryCallback(JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
209 : : CallbackInterface(aCallback, aAsyncStack, aIncumbentGlobal)
210 : {
211 : }
212 :
213 : template <typename T>
214 : inline void
215 : OnDiscoveredServicesChanged(const T& thisVal, const Sequence<FlyWebDiscoveredService>& serviceList, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr)
216 : {
217 : MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
218 : if (!aExecutionReason) {
219 : aExecutionReason = "FlyWebDiscoveryCallback.onDiscoveredServicesChanged";
220 : }
221 : CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aCompartment);
222 : if (!s.GetContext()) {
223 : MOZ_ASSERT(aRv.Failed());
224 : return;
225 : }
226 : JS::Rooted<JS::Value> thisValJS(s.GetContext());
227 : if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) {
228 : aRv.Throw(NS_ERROR_FAILURE);
229 : return;
230 : }
231 : return OnDiscoveredServicesChanged(s.GetContext(), thisValJS, serviceList, aRv);
232 : }
233 :
234 : inline void
235 0 : OnDiscoveredServicesChanged(const Sequence<FlyWebDiscoveredService>& serviceList, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr)
236 : {
237 0 : MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
238 0 : if (!aExecutionReason) {
239 0 : aExecutionReason = "FlyWebDiscoveryCallback.onDiscoveredServicesChanged";
240 : }
241 0 : CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aCompartment);
242 0 : if (!s.GetContext()) {
243 0 : MOZ_ASSERT(aRv.Failed());
244 0 : return;
245 : }
246 0 : return OnDiscoveredServicesChanged(s.GetContext(), JS::UndefinedHandleValue, serviceList, aRv);
247 : }
248 :
249 : template <typename T>
250 : inline void
251 : OnDiscoveredServicesChanged(const T& thisVal, const Sequence<FlyWebDiscoveredService>& serviceList, const char* aExecutionReason = nullptr)
252 : {
253 : IgnoredErrorResult rv;
254 : return OnDiscoveredServicesChanged(thisVal, serviceList, rv, aExecutionReason);
255 : }
256 :
257 : inline void
258 : OnDiscoveredServicesChanged(const Sequence<FlyWebDiscoveredService>& serviceList, const char* aExecutionReason = nullptr)
259 : {
260 : IgnoredErrorResult rv;
261 : return OnDiscoveredServicesChanged(serviceList, rv, aExecutionReason, eReportExceptions, nullptr);
262 : }
263 :
264 : inline bool
265 : operator==(const FlyWebDiscoveryCallback& aOther) const
266 : {
267 : return CallbackInterface::operator==(aOther);
268 : }
269 :
270 : private:
271 : void OnDiscoveredServicesChanged(JSContext* cx, JS::Handle<JS::Value> aThisVal, const Sequence<FlyWebDiscoveredService>& serviceList, ErrorResult& aRv);
272 :
273 : static bool
274 : InitIds(JSContext* cx, FlyWebDiscoveryCallbackAtoms* atomsCache);
275 : };
276 :
277 :
278 0 : class FlyWebPairingCallback : public CallbackInterface
279 : {
280 : public:
281 : explicit inline FlyWebPairingCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, nsIGlobalObject* aIncumbentGlobal)
282 : : CallbackInterface(aCx, aCallback, aIncumbentGlobal)
283 : {
284 : }
285 :
286 0 : explicit inline FlyWebPairingCallback(JS::Handle<JSObject*> aCallback, const FastCallbackConstructor& )
287 0 : : CallbackInterface(aCallback, FastCallbackConstructor())
288 : {
289 0 : }
290 :
291 : explicit inline FlyWebPairingCallback(JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
292 : : CallbackInterface(aCallback, aAsyncStack, aIncumbentGlobal)
293 : {
294 : }
295 :
296 : void PairingSucceeded(const FlyWebPairedService& service, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr);
297 :
298 : void PairingFailed(const nsAString& error, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr);
299 :
300 : inline bool
301 : operator==(const FlyWebPairingCallback& aOther) const
302 : {
303 : return CallbackInterface::operator==(aOther);
304 : }
305 :
306 : private:
307 : static bool
308 : InitIds(JSContext* cx, FlyWebPairingCallbackAtoms* atomsCache);
309 : };
310 :
311 :
312 : namespace binding_detail {
313 0 : class FastFlyWebDiscoveryCallback : public FlyWebDiscoveryCallback
314 : {
315 : public:
316 0 : explicit inline FastFlyWebDiscoveryCallback(JS::Handle<JSObject*> aCallback)
317 0 : : FlyWebDiscoveryCallback(aCallback, FastCallbackConstructor())
318 : {
319 0 : }
320 :
321 : inline void
322 0 : Trace(JSTracer* aTracer)
323 : {
324 0 : FlyWebDiscoveryCallback::Trace(aTracer);
325 0 : }
326 :
327 : inline void
328 0 : FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx)
329 : {
330 0 : FlyWebDiscoveryCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx);
331 0 : }
332 : };
333 : } // namespace binding_detail
334 :
335 :
336 : namespace binding_detail {
337 0 : class FastFlyWebPairingCallback : public FlyWebPairingCallback
338 : {
339 : public:
340 0 : explicit inline FastFlyWebPairingCallback(JS::Handle<JSObject*> aCallback)
341 0 : : FlyWebPairingCallback(aCallback, FastCallbackConstructor())
342 : {
343 0 : }
344 :
345 : inline void
346 0 : Trace(JSTracer* aTracer)
347 : {
348 0 : FlyWebPairingCallback::Trace(aTracer);
349 0 : }
350 :
351 : inline void
352 0 : FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx)
353 : {
354 0 : FlyWebPairingCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx);
355 0 : }
356 : };
357 : } // namespace binding_detail
358 :
359 :
360 : } // namespace dom
361 : } // namespace mozilla
362 :
363 : #endif // mozilla_dom_FlyWebDiscoveryManagerBinding_h
|