LCOV - code coverage report
Current view: top level - netwerk/protocol/ftp - nsFTPChannel.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 26 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 12 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /* vim:set ts=4 sw=4 sts=4 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 nsFTPChannel_h___
       8             : #define nsFTPChannel_h___
       9             : 
      10             : #include "nsBaseChannel.h"
      11             : 
      12             : #include "nsString.h"
      13             : #include "nsCOMPtr.h"
      14             : #include "nsIChannelWithDivertableParentListener.h"
      15             : #include "nsIFTPChannel.h"
      16             : #include "nsIForcePendingChannel.h"
      17             : #include "nsIUploadChannel.h"
      18             : #include "nsIProxyInfo.h"
      19             : #include "nsIProxiedChannel.h"
      20             : #include "nsIResumableChannel.h"
      21             : 
      22             : class nsIURI;
      23             : using mozilla::net::ADivertableParentChannel;
      24             : 
      25             : class nsFtpChannel final : public nsBaseChannel,
      26             :                            public nsIFTPChannel,
      27             :                            public nsIUploadChannel,
      28             :                            public nsIResumableChannel,
      29             :                            public nsIProxiedChannel,
      30             :                            public nsIForcePendingChannel,
      31             :                            public nsIChannelWithDivertableParentListener
      32             : {
      33             : public:
      34             :     NS_DECL_ISUPPORTS_INHERITED
      35             :     NS_DECL_NSIUPLOADCHANNEL
      36             :     NS_DECL_NSIRESUMABLECHANNEL
      37             :     NS_DECL_NSIPROXIEDCHANNEL
      38             :     NS_DECL_NSICHANNELWITHDIVERTABLEPARENTLISTENER
      39             : 
      40           0 :     nsFtpChannel(nsIURI *uri, nsIProxyInfo *pi)
      41           0 :         : mProxyInfo(pi)
      42             :         , mStartPos(0)
      43             :         , mResumeRequested(false)
      44             :         , mLastModifiedTime(0)
      45           0 :         , mForcePending(false)
      46             :     {
      47           0 :         SetURI(uri);
      48           0 :     }
      49             : 
      50           0 :     nsIProxyInfo *ProxyInfo() {
      51           0 :         return mProxyInfo;
      52             :     }
      53             : 
      54           0 :     void SetProxyInfo(nsIProxyInfo *pi)
      55             :     {
      56           0 :         mProxyInfo = pi;
      57           0 :     }
      58             : 
      59             :     NS_IMETHOD IsPending(bool *result) override;
      60             : 
      61             :     // This is a short-cut to calling nsIRequest::IsPending().
      62             :     // Overrides Pending in nsBaseChannel.
      63             :     bool Pending() const override;
      64             : 
      65             :     // Were we asked to resume a download?
      66           0 :     bool ResumeRequested() { return mResumeRequested; }
      67             : 
      68             :     // Download from this byte offset
      69           0 :     uint64_t StartPos() { return mStartPos; }
      70             : 
      71             :     // ID of the entity to resume downloading
      72           0 :     const nsCString &EntityID() {
      73           0 :         return mEntityID;
      74             :     }
      75           0 :     void SetEntityID(const nsACString& entityID) {
      76           0 :         mEntityID = entityID;
      77           0 :     }
      78             : 
      79           0 :     NS_IMETHOD GetLastModifiedTime(PRTime* lastModifiedTime) override {
      80           0 :         *lastModifiedTime = mLastModifiedTime;
      81           0 :         return NS_OK;
      82             :     }
      83             : 
      84           0 :     NS_IMETHOD SetLastModifiedTime(PRTime lastModifiedTime) override {
      85           0 :         mLastModifiedTime = lastModifiedTime;
      86           0 :         return NS_OK;
      87             :     }
      88             : 
      89             :     // Data stream to upload
      90           0 :     nsIInputStream *UploadStream() {
      91           0 :         return mUploadStream;
      92             :     }
      93             : 
      94             :     // Helper function for getting the nsIFTPEventSink.
      95             :     void GetFTPEventSink(nsCOMPtr<nsIFTPEventSink> &aResult);
      96             : 
      97             :     NS_IMETHOD Suspend() override;
      98             :     NS_IMETHOD Resume() override;
      99             : 
     100             : public:
     101             :     NS_IMETHOD ForcePending(bool aForcePending) override;
     102             : 
     103             : protected:
     104           0 :     virtual ~nsFtpChannel() {}
     105             :     virtual nsresult OpenContentStream(bool async, nsIInputStream **result,
     106             :                                        nsIChannel** channel) override;
     107             :     virtual bool GetStatusArg(nsresult status, nsString &statusArg) override;
     108             :     virtual void OnCallbacksChanged() override;
     109             : 
     110             : private:
     111             :     nsCOMPtr<nsIProxyInfo>           mProxyInfo;
     112             :     nsCOMPtr<nsIFTPEventSink>        mFTPEventSink;
     113             :     nsCOMPtr<nsIInputStream>         mUploadStream;
     114             :     uint64_t                         mStartPos;
     115             :     nsCString                        mEntityID;
     116             :     bool                             mResumeRequested;
     117             :     PRTime                           mLastModifiedTime;
     118             :     bool                             mForcePending;
     119             :     RefPtr<ADivertableParentChannel> mParentChannel;
     120             : };
     121             : 
     122             : #endif /* nsFTPChannel_h___ */

Generated by: LCOV version 1.13