LCOV - code coverage report
Current view: top level - dom/payments - PaymentResponse.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 3 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 8 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim:set ts=2 sw=2 sts=2 et cindent: */
       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_PaymentResponse_h
       8             : #define mozilla_dom_PaymentResponse_h
       9             : 
      10             : #include "mozilla/dom/PaymentResponseBinding.h" // PaymentComplete
      11             : #include "nsPIDOMWindow.h"
      12             : #include "nsWrapperCache.h"
      13             : 
      14             : namespace mozilla {
      15             : namespace dom {
      16             : 
      17             : class PaymentAddress;
      18             : class Promise;
      19             : 
      20             : class PaymentResponse final : public nsISupports,
      21             :                               public nsWrapperCache
      22             : {
      23             : public:
      24             :   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
      25           0 :   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(PaymentResponse)
      26             : 
      27             :   PaymentResponse(nsPIDOMWindowInner* aWindow,
      28             :                   const nsAString& aInternalId,
      29             :                   const nsAString& aRequestId,
      30             :                   const nsAString& aMethodName,
      31             :                   const nsAString& aShippingOption,
      32             :                   RefPtr<PaymentAddress> aShippingAddress,
      33             :                   const nsAString& aDetails,
      34             :                   const nsAString& aPayerName,
      35             :                   const nsAString& aPayerEmail,
      36             :                   const nsAString& aPayerPhone);
      37             : 
      38           0 :   nsPIDOMWindowInner* GetParentObject() const
      39             :   {
      40           0 :     return mOwner;
      41             :   }
      42             : 
      43             :   virtual JSObject* WrapObject(JSContext* aCx,
      44             :                                JS::Handle<JSObject*> aGivenProto) override;
      45             : 
      46             :   void GetRequestId(nsString& aRetVal) const;
      47             : 
      48             :   void GetMethodName(nsString& aRetVal) const;
      49             : 
      50             :   void GetDetails(JSContext* cx, JS::MutableHandle<JSObject*> aRetVal) const;
      51             : 
      52             :   already_AddRefed<PaymentAddress> GetShippingAddress() const;
      53             : 
      54             :   void GetShippingOption(nsString& aRetVal) const;
      55             : 
      56             :   void GetPayerName(nsString& aRetVal) const;
      57             : 
      58             :   void GetPayerEmail(nsString& aRetVal) const;
      59             : 
      60             :   void GetPayerPhone(nsString& aRetVal) const;
      61             : 
      62             :   // Return a raw pointer here to avoid refcounting, but make sure it's safe
      63             :   // (the object should be kept alive by the callee).
      64             :   already_AddRefed<Promise> Complete(PaymentComplete result, ErrorResult& aRv);
      65             : 
      66             :   void RespondComplete();
      67             : 
      68             : protected:
      69             :   ~PaymentResponse();
      70             : 
      71             : private:
      72             :   nsCOMPtr<nsPIDOMWindowInner> mOwner;
      73             :   bool mCompleteCalled;
      74             :   nsString mInternalId;
      75             :   nsString mRequestId;
      76             :   nsString mMethodName;
      77             :   nsString mDetails;
      78             :   nsString mShippingOption;
      79             :   nsString mPayerName;
      80             :   nsString mPayerEmail;
      81             :   nsString mPayerPhone;
      82             :   RefPtr<PaymentAddress> mShippingAddress;
      83             :   // Promise for "PaymentResponse::Complete"
      84             :   RefPtr<Promise> mPromise;
      85             : };
      86             : 
      87             : } // namespace dom
      88             : } // namespace mozilla
      89             : 
      90             : #endif // mozilla_dom_PaymentResponse_h

Generated by: LCOV version 1.13