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_PaymentMethodChangeEvent_h
8 #define mozilla_dom_PaymentMethodChangeEvent_h
10 #include "mozilla/dom/PaymentMethodChangeEventBinding.h"
11 #include "mozilla/dom/PaymentRequestUpdateEvent.h"
12 #include "mozilla/dom/PaymentRequest.h"
16 class PaymentRequestUpdateEvent
;
17 struct PaymentMethodChangeEventInit
;
18 class PaymentMethodChangeEvent final
: public PaymentRequestUpdateEvent
{
20 NS_DECL_ISUPPORTS_INHERITED
21 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(
22 PaymentMethodChangeEvent
, PaymentRequestUpdateEvent
)
24 explicit PaymentMethodChangeEvent(EventTarget
* aOwner
);
26 virtual JSObject
* WrapObjectInternal(
27 JSContext
* aCx
, JS::Handle
<JSObject
*> aGivenProto
) override
;
29 static already_AddRefed
<PaymentMethodChangeEvent
> Constructor(
30 EventTarget
* aOwner
, const nsAString
& aType
,
31 const PaymentRequestUpdateEventInit
& aEventInitDict
,
32 const nsAString
& aMethodName
, const ChangeDetails
& aMethodDetails
);
34 // Called by WebIDL constructor
35 static already_AddRefed
<PaymentMethodChangeEvent
> Constructor(
36 const GlobalObject
& aGlobal
, const nsAString
& aType
,
37 const PaymentMethodChangeEventInit
& aEventInitDict
);
39 void GetMethodName(nsAString
& aMethodName
);
40 void SetMethodName(const nsAString
& aMethodName
);
42 void GetMethodDetails(JSContext
* cx
, JS::MutableHandle
<JSObject
*> retval
);
43 void SetMethodDetails(const ChangeDetails
& aMethodDetails
);
46 void init(const PaymentMethodChangeEventInit
& aEventInitDict
);
47 ~PaymentMethodChangeEvent();
50 JS::Heap
<JSObject
*> mMethodDetails
;
51 ChangeDetails mInternalDetails
;
56 } // namespace mozilla
58 #endif // mozilla_dom_PaymentMethodChangeEvent_h