Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM PaymentRequest.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #ifndef mozilla_dom_PaymentRequestBinding_h
4 : #define mozilla_dom_PaymentRequestBinding_h
5 :
6 : #include "PaymentRequestBinding.h"
7 : #include "js/RootingAPI.h"
8 : #include "jspubtd.h"
9 : #include "mozilla/ErrorResult.h"
10 : #include "mozilla/dom/BindingDeclarations.h"
11 : #include "mozilla/dom/Nullable.h"
12 :
13 : namespace mozilla {
14 : namespace dom {
15 :
16 : struct NativePropertyHooks;
17 : struct PaymentCurrencyAmount;
18 : struct PaymentCurrencyAmountAtoms;
19 : struct PaymentDetailsBaseAtoms;
20 : struct PaymentDetailsInitAtoms;
21 : struct PaymentDetailsModifier;
22 : struct PaymentDetailsModifierAtoms;
23 : struct PaymentItem;
24 : struct PaymentItemAtoms;
25 : struct PaymentMethodDataAtoms;
26 : struct PaymentOptionsAtoms;
27 : class PaymentRequest;
28 : struct PaymentRequestAtoms;
29 : struct PaymentShippingOption;
30 : struct PaymentShippingOptionAtoms;
31 : class ProtoAndIfaceCache;
32 :
33 : } // namespace dom
34 : } // namespace mozilla
35 :
36 : namespace mozilla {
37 : namespace dom {
38 :
39 : enum class PaymentShippingType : uint8_t {
40 : Shipping,
41 : Delivery,
42 : Pickup,
43 : EndGuard_
44 : };
45 :
46 : namespace PaymentShippingTypeValues {
47 : extern const EnumEntry strings[4];
48 : } // namespace PaymentShippingTypeValues
49 :
50 : bool
51 : ToJSValue(JSContext* aCx, PaymentShippingType aArgument, JS::MutableHandle<JS::Value> aValue);
52 :
53 :
54 0 : struct PaymentCurrencyAmount : public DictionaryBase
55 : {
56 : MOZ_INIT_OUTSIDE_CTOR nsString mCurrency;
57 : MOZ_INIT_OUTSIDE_CTOR nsString mCurrencySystem;
58 : MOZ_INIT_OUTSIDE_CTOR nsString mValue;
59 :
60 : PaymentCurrencyAmount();
61 :
62 0 : explicit inline PaymentCurrencyAmount(const FastDictionaryInitializer& )
63 0 : {
64 : // Do nothing here; this is used by our "Fast" subclass
65 0 : }
66 :
67 : explicit inline PaymentCurrencyAmount(const PaymentCurrencyAmount& aOther)
68 : {
69 : *this = aOther;
70 : }
71 :
72 : bool
73 : Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
74 :
75 : bool
76 : Init(const nsAString& aJSON);
77 :
78 : bool
79 : ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
80 :
81 : bool
82 : ToJSON(nsAString& aJSON) const;
83 :
84 : void
85 : TraceDictionary(JSTracer* trc);
86 :
87 : PaymentCurrencyAmount&
88 : operator=(const PaymentCurrencyAmount& aOther);
89 :
90 : private:
91 : static bool
92 : InitIds(JSContext* cx, PaymentCurrencyAmountAtoms* atomsCache);
93 : };
94 :
95 : namespace binding_detail {
96 : struct FastPaymentCurrencyAmount : public PaymentCurrencyAmount
97 : {
98 : inline FastPaymentCurrencyAmount()
99 : : PaymentCurrencyAmount(FastDictionaryInitializer())
100 : {
101 : // Doesn't matter what int we pass to the parent constructor
102 : }
103 : };
104 : } // namespace binding_detail
105 :
106 :
107 0 : struct PaymentMethodData : public DictionaryBase
108 : {
109 : MOZ_INIT_OUTSIDE_CTOR Optional<JSObject*> mData;
110 : MOZ_INIT_OUTSIDE_CTOR nsString mSupportedMethods;
111 :
112 : PaymentMethodData();
113 :
114 : explicit inline PaymentMethodData(const FastDictionaryInitializer& )
115 : {
116 : // Do nothing here; this is used by our "Fast" subclass
117 : }
118 :
119 : private:
120 : PaymentMethodData(const PaymentMethodData&) = delete;
121 : PaymentMethodData& operator=(const PaymentMethodData&) = delete;
122 :
123 : static bool
124 : InitIds(JSContext* cx, PaymentMethodDataAtoms* atomsCache);
125 :
126 : public:
127 : bool
128 : Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
129 :
130 : bool
131 : ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
132 :
133 : void
134 : TraceDictionary(JSTracer* trc);
135 : };
136 :
137 : namespace binding_detail {
138 : struct FastPaymentMethodData : public PaymentMethodData
139 : {
140 : inline FastPaymentMethodData()
141 : : PaymentMethodData(FastDictionaryInitializer())
142 : {
143 : // Doesn't matter what int we pass to the parent constructor
144 : }
145 : };
146 : } // namespace binding_detail
147 :
148 :
149 : struct PaymentOptions : public DictionaryBase
150 : {
151 : MOZ_INIT_OUTSIDE_CTOR bool mRequestPayerEmail;
152 : MOZ_INIT_OUTSIDE_CTOR bool mRequestPayerName;
153 : MOZ_INIT_OUTSIDE_CTOR bool mRequestPayerPhone;
154 : MOZ_INIT_OUTSIDE_CTOR bool mRequestShipping;
155 : MOZ_INIT_OUTSIDE_CTOR PaymentShippingType mShippingType;
156 :
157 : PaymentOptions();
158 :
159 0 : explicit inline PaymentOptions(const FastDictionaryInitializer& )
160 0 : {
161 : // Do nothing here; this is used by our "Fast" subclass
162 0 : }
163 :
164 : explicit inline PaymentOptions(const PaymentOptions& aOther)
165 : {
166 : *this = aOther;
167 : }
168 :
169 : bool
170 : Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
171 :
172 : bool
173 : Init(const nsAString& aJSON);
174 :
175 : bool
176 : ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
177 :
178 : bool
179 : ToJSON(nsAString& aJSON) const;
180 :
181 : void
182 : TraceDictionary(JSTracer* trc);
183 :
184 : PaymentOptions&
185 : operator=(const PaymentOptions& aOther);
186 :
187 : private:
188 : static bool
189 : InitIds(JSContext* cx, PaymentOptionsAtoms* atomsCache);
190 : };
191 :
192 : namespace binding_detail {
193 : struct FastPaymentOptions : public PaymentOptions
194 : {
195 0 : inline FastPaymentOptions()
196 0 : : PaymentOptions(FastDictionaryInitializer())
197 : {
198 : // Doesn't matter what int we pass to the parent constructor
199 0 : }
200 : };
201 : } // namespace binding_detail
202 :
203 :
204 0 : struct PaymentItem : public DictionaryBase
205 : {
206 : MOZ_INIT_OUTSIDE_CTOR PaymentCurrencyAmount mAmount;
207 : MOZ_INIT_OUTSIDE_CTOR nsString mLabel;
208 : MOZ_INIT_OUTSIDE_CTOR bool mPending;
209 :
210 : PaymentItem();
211 :
212 0 : explicit inline PaymentItem(const FastDictionaryInitializer& )
213 0 : : mAmount(FastDictionaryInitializer())
214 : {
215 : // Do nothing here; this is used by our "Fast" subclass
216 0 : }
217 :
218 : explicit inline PaymentItem(const PaymentItem& aOther)
219 : : mAmount(FastDictionaryInitializer())
220 : {
221 : *this = aOther;
222 : }
223 :
224 : bool
225 : Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
226 :
227 : bool
228 : Init(const nsAString& aJSON);
229 :
230 : bool
231 : ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
232 :
233 : bool
234 : ToJSON(nsAString& aJSON) const;
235 :
236 : void
237 : TraceDictionary(JSTracer* trc);
238 :
239 : PaymentItem&
240 : operator=(const PaymentItem& aOther);
241 :
242 : private:
243 : static bool
244 : InitIds(JSContext* cx, PaymentItemAtoms* atomsCache);
245 : };
246 :
247 : namespace binding_detail {
248 : struct FastPaymentItem : public PaymentItem
249 : {
250 : inline FastPaymentItem()
251 : : PaymentItem(FastDictionaryInitializer())
252 : {
253 : // Doesn't matter what int we pass to the parent constructor
254 : }
255 : };
256 : } // namespace binding_detail
257 :
258 :
259 0 : struct PaymentShippingOption : public DictionaryBase
260 : {
261 : MOZ_INIT_OUTSIDE_CTOR PaymentCurrencyAmount mAmount;
262 : MOZ_INIT_OUTSIDE_CTOR nsString mId;
263 : MOZ_INIT_OUTSIDE_CTOR nsString mLabel;
264 : MOZ_INIT_OUTSIDE_CTOR bool mSelected;
265 :
266 : PaymentShippingOption();
267 :
268 : explicit inline PaymentShippingOption(const FastDictionaryInitializer& )
269 : : mAmount(FastDictionaryInitializer())
270 : {
271 : // Do nothing here; this is used by our "Fast" subclass
272 : }
273 :
274 : explicit inline PaymentShippingOption(const PaymentShippingOption& aOther)
275 : : mAmount(FastDictionaryInitializer())
276 : {
277 : *this = aOther;
278 : }
279 :
280 : bool
281 : Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
282 :
283 : bool
284 : Init(const nsAString& aJSON);
285 :
286 : bool
287 : ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
288 :
289 : bool
290 : ToJSON(nsAString& aJSON) const;
291 :
292 : void
293 : TraceDictionary(JSTracer* trc);
294 :
295 : PaymentShippingOption&
296 : operator=(const PaymentShippingOption& aOther);
297 :
298 : private:
299 : static bool
300 : InitIds(JSContext* cx, PaymentShippingOptionAtoms* atomsCache);
301 : };
302 :
303 : namespace binding_detail {
304 : struct FastPaymentShippingOption : public PaymentShippingOption
305 : {
306 : inline FastPaymentShippingOption()
307 : : PaymentShippingOption(FastDictionaryInitializer())
308 : {
309 : // Doesn't matter what int we pass to the parent constructor
310 : }
311 : };
312 : } // namespace binding_detail
313 :
314 :
315 0 : struct PaymentDetailsModifier : public DictionaryBase
316 : {
317 : MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<PaymentItem>> mAdditionalDisplayItems;
318 : MOZ_INIT_OUTSIDE_CTOR Optional<JSObject*> mData;
319 : MOZ_INIT_OUTSIDE_CTOR nsString mSupportedMethods;
320 : MOZ_INIT_OUTSIDE_CTOR PaymentItem mTotal;
321 :
322 : PaymentDetailsModifier();
323 :
324 : explicit inline PaymentDetailsModifier(const FastDictionaryInitializer& )
325 : : mTotal(FastDictionaryInitializer())
326 : {
327 : // Do nothing here; this is used by our "Fast" subclass
328 : }
329 :
330 : private:
331 : PaymentDetailsModifier(const PaymentDetailsModifier&) = delete;
332 : PaymentDetailsModifier& operator=(const PaymentDetailsModifier&) = delete;
333 :
334 : static bool
335 : InitIds(JSContext* cx, PaymentDetailsModifierAtoms* atomsCache);
336 :
337 : public:
338 : bool
339 : Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
340 :
341 : bool
342 : ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
343 :
344 : void
345 : TraceDictionary(JSTracer* trc);
346 : };
347 :
348 : namespace binding_detail {
349 : struct FastPaymentDetailsModifier : public PaymentDetailsModifier
350 : {
351 : inline FastPaymentDetailsModifier()
352 : : PaymentDetailsModifier(FastDictionaryInitializer())
353 : {
354 : // Doesn't matter what int we pass to the parent constructor
355 : }
356 : };
357 : } // namespace binding_detail
358 :
359 :
360 0 : struct PaymentDetailsBase : public DictionaryBase
361 : {
362 : MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<PaymentItem>> mDisplayItems;
363 : MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<PaymentDetailsModifier>> mModifiers;
364 : MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<PaymentShippingOption>> mShippingOptions;
365 :
366 : PaymentDetailsBase();
367 :
368 0 : explicit inline PaymentDetailsBase(const FastDictionaryInitializer& )
369 0 : {
370 : // Do nothing here; this is used by our "Fast" subclass
371 0 : }
372 :
373 : private:
374 : PaymentDetailsBase(const PaymentDetailsBase&) = delete;
375 : PaymentDetailsBase& operator=(const PaymentDetailsBase&) = delete;
376 :
377 : static bool
378 : InitIds(JSContext* cx, PaymentDetailsBaseAtoms* atomsCache);
379 :
380 : public:
381 : bool
382 : Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
383 :
384 : bool
385 : ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
386 :
387 : void
388 : TraceDictionary(JSTracer* trc);
389 : };
390 :
391 : namespace binding_detail {
392 : struct FastPaymentDetailsBase : public PaymentDetailsBase
393 : {
394 : inline FastPaymentDetailsBase()
395 : : PaymentDetailsBase(FastDictionaryInitializer())
396 : {
397 : // Doesn't matter what int we pass to the parent constructor
398 : }
399 : };
400 : } // namespace binding_detail
401 :
402 :
403 0 : struct PaymentDetailsInit : public PaymentDetailsBase
404 : {
405 : MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mId;
406 : MOZ_INIT_OUTSIDE_CTOR PaymentItem mTotal;
407 :
408 : PaymentDetailsInit();
409 :
410 0 : explicit inline PaymentDetailsInit(const FastDictionaryInitializer& )
411 0 : : PaymentDetailsBase(FastDictionaryInitializer()),
412 0 : mTotal(FastDictionaryInitializer())
413 : {
414 : // Do nothing here; this is used by our "Fast" subclass
415 0 : }
416 :
417 : private:
418 : PaymentDetailsInit(const PaymentDetailsInit&) = delete;
419 : PaymentDetailsInit& operator=(const PaymentDetailsInit&) = delete;
420 :
421 : static bool
422 : InitIds(JSContext* cx, PaymentDetailsInitAtoms* atomsCache);
423 :
424 : public:
425 : bool
426 : Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
427 :
428 : bool
429 : Init(const nsAString& aJSON);
430 :
431 : bool
432 : ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
433 :
434 : bool
435 : ToJSON(nsAString& aJSON) const;
436 :
437 : void
438 : TraceDictionary(JSTracer* trc);
439 : };
440 :
441 : namespace binding_detail {
442 0 : struct FastPaymentDetailsInit : public PaymentDetailsInit
443 : {
444 0 : inline FastPaymentDetailsInit()
445 0 : : PaymentDetailsInit(FastDictionaryInitializer())
446 : {
447 : // Doesn't matter what int we pass to the parent constructor
448 0 : }
449 : };
450 : } // namespace binding_detail
451 :
452 :
453 : namespace PaymentRequestBinding {
454 :
455 : typedef mozilla::dom::PaymentRequest NativeType;
456 :
457 : bool
458 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
459 :
460 : JSObject*
461 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);
462 :
463 : const JSClass*
464 : GetJSClass();
465 :
466 : bool
467 : Wrap(JSContext* aCx, mozilla::dom::PaymentRequest* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
468 :
469 : template <class T>
470 0 : inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
471 : {
472 0 : JS::Rooted<JSObject*> reflector(aCx);
473 0 : return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
474 : }
475 :
476 : // We declare this as an array so that retrieving a pointer to this
477 : // binding's property hooks only requires compile/link-time resolvable
478 : // address arithmetic. Declaring it as a pointer instead would require
479 : // doing a run-time load to fetch a pointer to this binding's property
480 : // hooks. And then structures which embedded a pointer to this structure
481 : // would require a run-time load for proper initialization, which would
482 : // then induce static constructors. Lots of static constructors.
483 : extern const NativePropertyHooks sNativePropertyHooks[];
484 :
485 : void
486 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
487 :
488 : JS::Handle<JSObject*>
489 : GetProtoObjectHandle(JSContext* aCx);
490 :
491 : JS::Handle<JSObject*>
492 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);
493 :
494 : JSObject*
495 : GetConstructorObject(JSContext* aCx);
496 :
497 : } // namespace PaymentRequestBinding
498 :
499 :
500 :
501 : } // namespace dom
502 : } // namespace mozilla
503 :
504 : #endif // mozilla_dom_PaymentRequestBinding_h
|