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