1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_PaymentRequestUpdateEvent_h
8 #define mozilla_dom_PaymentRequestUpdateEvent_h
10 #include "mozilla/Attributes.h"
11 #include "mozilla/dom/Event.h"
12 #include "mozilla/dom/PaymentRequestUpdateEventBinding.h"
13 #include "mozilla/dom/PromiseNativeHandler.h"
22 class PaymentRequestUpdateEvent
: public Event
, public PromiseNativeHandler
{
24 NS_DECL_ISUPPORTS_INHERITED
25 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(
26 PaymentRequestUpdateEvent
, Event
)
28 explicit PaymentRequestUpdateEvent(EventTarget
* aOwner
);
30 virtual JSObject
* WrapObjectInternal(
31 JSContext
* aCx
, JS::Handle
<JSObject
*> aGivenProto
) override
;
33 virtual void ResolvedCallback(JSContext
* aCx
, JS::Handle
<JS::Value
> aValue
,
34 ErrorResult
& aRv
) override
;
35 virtual void RejectedCallback(JSContext
* aCx
, JS::Handle
<JS::Value
> aValue
,
36 ErrorResult
& aRv
) override
;
38 static already_AddRefed
<PaymentRequestUpdateEvent
> Constructor(
39 EventTarget
* aOwner
, const nsAString
& aType
,
40 const PaymentRequestUpdateEventInit
& aEventInitDict
);
42 // Called by WebIDL constructor
43 static already_AddRefed
<PaymentRequestUpdateEvent
> Constructor(
44 const GlobalObject
& aGlobal
, const nsAString
& aType
,
45 const PaymentRequestUpdateEventInit
& aEventInitDict
);
47 void UpdateWith(Promise
& aPromise
, ErrorResult
& aRv
);
49 void SetRequest(PaymentRequest
* aRequest
);
52 ~PaymentRequestUpdateEvent();
53 // Indicating whether an updateWith()-initiated update is currently in
56 RefPtr
<PaymentRequest
> mRequest
;
60 } // namespace mozilla
62 #endif // mozilla_dom_PaymentRequestUpdateEvent_h