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_MerchantValidationEvent_h
8 #define mozilla_dom_MerchantValidationEvent_h
10 #include "mozilla/Attributes.h"
11 #include "mozilla/Result.h"
12 #include "mozilla/dom/Event.h"
13 #include "mozilla/dom/MerchantValidationEventBinding.h"
14 #include "mozilla/dom/PromiseNativeHandler.h"
25 class MerchantValidationEvent
: public Event
, public PromiseNativeHandler
{
27 NS_DECL_ISUPPORTS_INHERITED
28 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(
29 MerchantValidationEvent
, Event
)
31 explicit MerchantValidationEvent(EventTarget
* aOwner
);
33 virtual JSObject
* WrapObjectInternal(
34 JSContext
* aCx
, JS::Handle
<JSObject
*> aGivenProto
) override
;
36 virtual void ResolvedCallback(JSContext
* aCx
, JS::Handle
<JS::Value
> aValue
,
37 ErrorResult
& aRv
) override
;
38 virtual void RejectedCallback(JSContext
* aCx
, JS::Handle
<JS::Value
> aValue
,
39 ErrorResult
& aRv
) override
;
41 static already_AddRefed
<MerchantValidationEvent
> Constructor(
42 EventTarget
* aOwner
, const nsAString
& aType
,
43 const MerchantValidationEventInit
& aEventInitDict
, ErrorResult
& aRv
);
45 // Called by WebIDL constructor
46 static already_AddRefed
<MerchantValidationEvent
> Constructor(
47 const GlobalObject
& aGlobal
, const nsAString
& aType
,
48 const MerchantValidationEventInit
& aEventInitDict
, ErrorResult
& aRv
);
50 void Complete(Promise
& aPromise
, ErrorResult
& aRv
);
52 void SetRequest(PaymentRequest
* aRequest
);
54 void GetValidationURL(nsAString
& aValidationURL
);
56 void GetMethodName(nsAString
& aMethodName
);
58 void SetMethodName(const nsAString
& aMethodName
);
61 void init(const MerchantValidationEventInit
& aEventInitDict
,
63 ~MerchantValidationEvent();
66 // Indicating whether an Complete()-initiated update is currently in progress.
68 nsCOMPtr
<nsIURI
> mValidationURL
;
69 RefPtr
<PaymentRequest
> mRequest
;
74 } // namespace mozilla
76 #endif // mozilla_dom_MerchantValidationEvent_h