1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/netwerk/protocol/wyciwyg/WyciwygChannelChild.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,121 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#ifndef mozilla_net_WyciwygChannelChild_h 1.9 +#define mozilla_net_WyciwygChannelChild_h 1.10 + 1.11 +#include "mozilla/net/PWyciwygChannelChild.h" 1.12 +#include "nsIWyciwygChannel.h" 1.13 +#include "nsIChannel.h" 1.14 +#include "PrivateBrowsingChannel.h" 1.15 + 1.16 +class nsIProgressEventSink; 1.17 + 1.18 +namespace mozilla { 1.19 +namespace net { 1.20 + 1.21 +class ChannelEventQueue; 1.22 + 1.23 +// TODO: replace with IPDL states 1.24 +enum WyciwygChannelChildState { 1.25 + WCC_NEW, 1.26 + WCC_INIT, 1.27 + 1.28 + // States when reading from the channel 1.29 + WCC_OPENED, 1.30 + WCC_ONSTART, 1.31 + WCC_ONDATA, 1.32 + WCC_ONSTOP, 1.33 + 1.34 + // States when writing to the cache 1.35 + WCC_ONWRITE, 1.36 + WCC_ONCLOSED 1.37 +}; 1.38 + 1.39 + 1.40 +// Header file contents 1.41 +class WyciwygChannelChild : public PWyciwygChannelChild 1.42 + , public nsIWyciwygChannel 1.43 + , public PrivateBrowsingChannel<WyciwygChannelChild> 1.44 +{ 1.45 +public: 1.46 + NS_DECL_ISUPPORTS 1.47 + NS_DECL_NSIREQUEST 1.48 + NS_DECL_NSICHANNEL 1.49 + NS_DECL_NSIWYCIWYGCHANNEL 1.50 + 1.51 + WyciwygChannelChild(); 1.52 + virtual ~WyciwygChannelChild(); 1.53 + 1.54 + void AddIPDLReference(); 1.55 + void ReleaseIPDLReference(); 1.56 + 1.57 + nsresult Init(nsIURI *uri); 1.58 + 1.59 + bool IsSuspended(); 1.60 + 1.61 +protected: 1.62 + bool RecvOnStartRequest(const nsresult& statusCode, 1.63 + const int64_t& contentLength, 1.64 + const int32_t& source, 1.65 + const nsCString& charset, 1.66 + const nsCString& securityInfo) MOZ_OVERRIDE; 1.67 + bool RecvOnDataAvailable(const nsCString& data, 1.68 + const uint64_t& offset) MOZ_OVERRIDE; 1.69 + bool RecvOnStopRequest(const nsresult& statusCode) MOZ_OVERRIDE; 1.70 + bool RecvCancelEarly(const nsresult& statusCode) MOZ_OVERRIDE; 1.71 + 1.72 + void OnStartRequest(const nsresult& statusCode, 1.73 + const int64_t& contentLength, 1.74 + const int32_t& source, 1.75 + const nsCString& charset, 1.76 + const nsCString& securityInfo); 1.77 + void OnDataAvailable(const nsCString& data, 1.78 + const uint64_t& offset); 1.79 + void OnStopRequest(const nsresult& statusCode); 1.80 + void CancelEarly(const nsresult& statusCode); 1.81 + 1.82 + friend class PrivateBrowsingChannel<WyciwygChannelChild>; 1.83 + 1.84 +private: 1.85 + nsresult mStatus; 1.86 + bool mIsPending; 1.87 + bool mCanceled; 1.88 + uint32_t mLoadFlags; 1.89 + int64_t mContentLength; 1.90 + int32_t mCharsetSource; 1.91 + nsCString mCharset; 1.92 + nsCOMPtr<nsIURI> mURI; 1.93 + nsCOMPtr<nsIURI> mOriginalURI; 1.94 + nsCOMPtr<nsISupports> mOwner; 1.95 + nsCOMPtr<nsIInterfaceRequestor> mCallbacks; 1.96 + nsCOMPtr<nsIProgressEventSink> mProgressSink; 1.97 + nsCOMPtr<nsILoadGroup> mLoadGroup; 1.98 + nsCOMPtr<nsIStreamListener> mListener; 1.99 + nsCOMPtr<nsISupports> mListenerContext; 1.100 + nsCOMPtr<nsISupports> mSecurityInfo; 1.101 + 1.102 + // FIXME: replace with IPDL states (bug 536319) 1.103 + enum WyciwygChannelChildState mState; 1.104 + 1.105 + bool mIPCOpen; 1.106 + bool mSentAppData; 1.107 + nsRefPtr<ChannelEventQueue> mEventQ; 1.108 + 1.109 + friend class WyciwygStartRequestEvent; 1.110 + friend class WyciwygDataAvailableEvent; 1.111 + friend class WyciwygStopRequestEvent; 1.112 + friend class WyciwygCancelEvent; 1.113 +}; 1.114 + 1.115 +inline bool 1.116 +WyciwygChannelChild::IsSuspended() 1.117 +{ 1.118 + return false; 1.119 +} 1.120 + 1.121 +} // namespace net 1.122 +} // namespace mozilla 1.123 + 1.124 +#endif // mozilla_net_WyciwygChannelChild_h