michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_net_WyciwygChannelChild_h michael@0: #define mozilla_net_WyciwygChannelChild_h michael@0: michael@0: #include "mozilla/net/PWyciwygChannelChild.h" michael@0: #include "nsIWyciwygChannel.h" michael@0: #include "nsIChannel.h" michael@0: #include "PrivateBrowsingChannel.h" michael@0: michael@0: class nsIProgressEventSink; michael@0: michael@0: namespace mozilla { michael@0: namespace net { michael@0: michael@0: class ChannelEventQueue; michael@0: michael@0: // TODO: replace with IPDL states michael@0: enum WyciwygChannelChildState { michael@0: WCC_NEW, michael@0: WCC_INIT, michael@0: michael@0: // States when reading from the channel michael@0: WCC_OPENED, michael@0: WCC_ONSTART, michael@0: WCC_ONDATA, michael@0: WCC_ONSTOP, michael@0: michael@0: // States when writing to the cache michael@0: WCC_ONWRITE, michael@0: WCC_ONCLOSED michael@0: }; michael@0: michael@0: michael@0: // Header file contents michael@0: class WyciwygChannelChild : public PWyciwygChannelChild michael@0: , public nsIWyciwygChannel michael@0: , public PrivateBrowsingChannel michael@0: { michael@0: public: michael@0: NS_DECL_ISUPPORTS michael@0: NS_DECL_NSIREQUEST michael@0: NS_DECL_NSICHANNEL michael@0: NS_DECL_NSIWYCIWYGCHANNEL michael@0: michael@0: WyciwygChannelChild(); michael@0: virtual ~WyciwygChannelChild(); michael@0: michael@0: void AddIPDLReference(); michael@0: void ReleaseIPDLReference(); michael@0: michael@0: nsresult Init(nsIURI *uri); michael@0: michael@0: bool IsSuspended(); michael@0: michael@0: protected: michael@0: bool RecvOnStartRequest(const nsresult& statusCode, michael@0: const int64_t& contentLength, michael@0: const int32_t& source, michael@0: const nsCString& charset, michael@0: const nsCString& securityInfo) MOZ_OVERRIDE; michael@0: bool RecvOnDataAvailable(const nsCString& data, michael@0: const uint64_t& offset) MOZ_OVERRIDE; michael@0: bool RecvOnStopRequest(const nsresult& statusCode) MOZ_OVERRIDE; michael@0: bool RecvCancelEarly(const nsresult& statusCode) MOZ_OVERRIDE; michael@0: michael@0: void OnStartRequest(const nsresult& statusCode, michael@0: const int64_t& contentLength, michael@0: const int32_t& source, michael@0: const nsCString& charset, michael@0: const nsCString& securityInfo); michael@0: void OnDataAvailable(const nsCString& data, michael@0: const uint64_t& offset); michael@0: void OnStopRequest(const nsresult& statusCode); michael@0: void CancelEarly(const nsresult& statusCode); michael@0: michael@0: friend class PrivateBrowsingChannel; michael@0: michael@0: private: michael@0: nsresult mStatus; michael@0: bool mIsPending; michael@0: bool mCanceled; michael@0: uint32_t mLoadFlags; michael@0: int64_t mContentLength; michael@0: int32_t mCharsetSource; michael@0: nsCString mCharset; michael@0: nsCOMPtr mURI; michael@0: nsCOMPtr mOriginalURI; michael@0: nsCOMPtr mOwner; michael@0: nsCOMPtr mCallbacks; michael@0: nsCOMPtr mProgressSink; michael@0: nsCOMPtr mLoadGroup; michael@0: nsCOMPtr mListener; michael@0: nsCOMPtr mListenerContext; michael@0: nsCOMPtr mSecurityInfo; michael@0: michael@0: // FIXME: replace with IPDL states (bug 536319) michael@0: enum WyciwygChannelChildState mState; michael@0: michael@0: bool mIPCOpen; michael@0: bool mSentAppData; michael@0: nsRefPtr mEventQ; michael@0: michael@0: friend class WyciwygStartRequestEvent; michael@0: friend class WyciwygDataAvailableEvent; michael@0: friend class WyciwygStopRequestEvent; michael@0: friend class WyciwygCancelEvent; michael@0: }; michael@0: michael@0: inline bool michael@0: WyciwygChannelChild::IsSuspended() michael@0: { michael@0: return false; michael@0: } michael@0: michael@0: } // namespace net michael@0: } // namespace mozilla michael@0: michael@0: #endif // mozilla_net_WyciwygChannelChild_h