diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /netwerk/protocol/ftp/nsFTPChannel.h | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'netwerk/protocol/ftp/nsFTPChannel.h')
-rw-r--r-- | netwerk/protocol/ftp/nsFTPChannel.h | 122 |
1 files changed, 122 insertions, 0 deletions
diff --git a/netwerk/protocol/ftp/nsFTPChannel.h b/netwerk/protocol/ftp/nsFTPChannel.h new file mode 100644 index 000000000..549e577b3 --- /dev/null +++ b/netwerk/protocol/ftp/nsFTPChannel.h @@ -0,0 +1,122 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* vim:set ts=4 sw=4 sts=4 et cindent: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef nsFTPChannel_h___ +#define nsFTPChannel_h___ + +#include "nsBaseChannel.h" + +#include "nsString.h" +#include "nsCOMPtr.h" +#include "nsIChannelWithDivertableParentListener.h" +#include "nsIFTPChannel.h" +#include "nsIForcePendingChannel.h" +#include "nsIUploadChannel.h" +#include "nsIProxyInfo.h" +#include "nsIProxiedChannel.h" +#include "nsIResumableChannel.h" + +class nsIURI; +using mozilla::net::ADivertableParentChannel; + +class nsFtpChannel final : public nsBaseChannel, + public nsIFTPChannel, + public nsIUploadChannel, + public nsIResumableChannel, + public nsIProxiedChannel, + public nsIForcePendingChannel, + public nsIChannelWithDivertableParentListener +{ +public: + NS_DECL_ISUPPORTS_INHERITED + NS_DECL_NSIUPLOADCHANNEL + NS_DECL_NSIRESUMABLECHANNEL + NS_DECL_NSIPROXIEDCHANNEL + NS_DECL_NSICHANNELWITHDIVERTABLEPARENTLISTENER + + nsFtpChannel(nsIURI *uri, nsIProxyInfo *pi) + : mProxyInfo(pi) + , mStartPos(0) + , mResumeRequested(false) + , mLastModifiedTime(0) + , mForcePending(false) + { + SetURI(uri); + } + + nsIProxyInfo *ProxyInfo() { + return mProxyInfo; + } + + void SetProxyInfo(nsIProxyInfo *pi) + { + mProxyInfo = pi; + } + + NS_IMETHOD IsPending(bool *result) override; + + // This is a short-cut to calling nsIRequest::IsPending(). + // Overrides Pending in nsBaseChannel. + bool Pending() const override; + + // Were we asked to resume a download? + bool ResumeRequested() { return mResumeRequested; } + + // Download from this byte offset + uint64_t StartPos() { return mStartPos; } + + // ID of the entity to resume downloading + const nsCString &EntityID() { + return mEntityID; + } + void SetEntityID(const nsCSubstring &entityID) { + mEntityID = entityID; + } + + NS_IMETHOD GetLastModifiedTime(PRTime* lastModifiedTime) override { + *lastModifiedTime = mLastModifiedTime; + return NS_OK; + } + + NS_IMETHOD SetLastModifiedTime(PRTime lastModifiedTime) override { + mLastModifiedTime = lastModifiedTime; + return NS_OK; + } + + // Data stream to upload + nsIInputStream *UploadStream() { + return mUploadStream; + } + + // Helper function for getting the nsIFTPEventSink. + void GetFTPEventSink(nsCOMPtr<nsIFTPEventSink> &aResult); + + NS_IMETHOD Suspend() override; + NS_IMETHOD Resume() override; + +public: + NS_IMETHOD ForcePending(bool aForcePending) override; + +protected: + virtual ~nsFtpChannel() {} + virtual nsresult OpenContentStream(bool async, nsIInputStream **result, + nsIChannel** channel) override; + virtual bool GetStatusArg(nsresult status, nsString &statusArg) override; + virtual void OnCallbacksChanged() override; + +private: + nsCOMPtr<nsIProxyInfo> mProxyInfo; + nsCOMPtr<nsIFTPEventSink> mFTPEventSink; + nsCOMPtr<nsIInputStream> mUploadStream; + uint64_t mStartPos; + nsCString mEntityID; + bool mResumeRequested; + PRTime mLastModifiedTime; + bool mForcePending; + RefPtr<ADivertableParentChannel> mParentChannel; +}; + +#endif /* nsFTPChannel_h___ */ |