PaymentRequestParent.h (2173B)
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_PaymentRequestParent_h 8 #define mozilla_dom_PaymentRequestParent_h 9 10 #include "mozilla/WeakPtr.h" 11 #include "mozilla/dom/PPaymentRequestParent.h" 12 #include "nsIPaymentActionResponse.h" 13 #include "nsIPaymentAddress.h" 14 15 namespace mozilla::dom { 16 17 class PaymentRequestParent final : public PPaymentRequestParent, 18 public SupportsWeakPtr { 19 friend class PPaymentRequestParent; 20 21 NS_INLINE_DECL_REFCOUNTING(PaymentRequestParent) 22 public: 23 PaymentRequestParent(); 24 25 nsresult RespondPayment(nsIPaymentActionResponse* aResponse); 26 nsresult ChangeShippingAddress(const nsAString& aRequestId, 27 nsIPaymentAddress* aAddress); 28 nsresult ChangeShippingOption(const nsAString& aRequestId, 29 const nsAString& aOption); 30 nsresult ChangePayerDetail(const nsAString& aRequestId, 31 const nsAString& aPayerName, 32 const nsAString& aPayerEmail, 33 const nsAString& aPayerPhone); 34 nsresult ChangePaymentMethod(const nsAString& aRequestId, 35 const nsAString& aMethodName, 36 nsIMethodChangeDetails* aMethodDetails); 37 38 protected: 39 mozilla::ipc::IPCResult RecvRequestPayment( 40 const IPCPaymentActionRequest& aRequest); 41 42 mozilla::ipc::IPCResult Recv__delete__() override; 43 44 void ActorDestroy(ActorDestroyReason aWhy) override; 45 46 private: 47 ~PaymentRequestParent() = default; 48 49 nsresult SerializeAddress(IPCPaymentAddress& ipcAddress, 50 nsIPaymentAddress* aAddress); 51 nsresult SerializeResponseData(IPCPaymentResponseData& ipcData, 52 nsIPaymentResponseData* aData); 53 54 bool mActorAlive; 55 nsString mRequestId; 56 }; 57 58 } // namespace mozilla::dom 59 60 #endif