netwerk/protocol/wyciwyg/WyciwygChannelChild.h

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 #ifndef mozilla_net_WyciwygChannelChild_h
michael@0 6 #define mozilla_net_WyciwygChannelChild_h
michael@0 7
michael@0 8 #include "mozilla/net/PWyciwygChannelChild.h"
michael@0 9 #include "nsIWyciwygChannel.h"
michael@0 10 #include "nsIChannel.h"
michael@0 11 #include "PrivateBrowsingChannel.h"
michael@0 12
michael@0 13 class nsIProgressEventSink;
michael@0 14
michael@0 15 namespace mozilla {
michael@0 16 namespace net {
michael@0 17
michael@0 18 class ChannelEventQueue;
michael@0 19
michael@0 20 // TODO: replace with IPDL states
michael@0 21 enum WyciwygChannelChildState {
michael@0 22 WCC_NEW,
michael@0 23 WCC_INIT,
michael@0 24
michael@0 25 // States when reading from the channel
michael@0 26 WCC_OPENED,
michael@0 27 WCC_ONSTART,
michael@0 28 WCC_ONDATA,
michael@0 29 WCC_ONSTOP,
michael@0 30
michael@0 31 // States when writing to the cache
michael@0 32 WCC_ONWRITE,
michael@0 33 WCC_ONCLOSED
michael@0 34 };
michael@0 35
michael@0 36
michael@0 37 // Header file contents
michael@0 38 class WyciwygChannelChild : public PWyciwygChannelChild
michael@0 39 , public nsIWyciwygChannel
michael@0 40 , public PrivateBrowsingChannel<WyciwygChannelChild>
michael@0 41 {
michael@0 42 public:
michael@0 43 NS_DECL_ISUPPORTS
michael@0 44 NS_DECL_NSIREQUEST
michael@0 45 NS_DECL_NSICHANNEL
michael@0 46 NS_DECL_NSIWYCIWYGCHANNEL
michael@0 47
michael@0 48 WyciwygChannelChild();
michael@0 49 virtual ~WyciwygChannelChild();
michael@0 50
michael@0 51 void AddIPDLReference();
michael@0 52 void ReleaseIPDLReference();
michael@0 53
michael@0 54 nsresult Init(nsIURI *uri);
michael@0 55
michael@0 56 bool IsSuspended();
michael@0 57
michael@0 58 protected:
michael@0 59 bool RecvOnStartRequest(const nsresult& statusCode,
michael@0 60 const int64_t& contentLength,
michael@0 61 const int32_t& source,
michael@0 62 const nsCString& charset,
michael@0 63 const nsCString& securityInfo) MOZ_OVERRIDE;
michael@0 64 bool RecvOnDataAvailable(const nsCString& data,
michael@0 65 const uint64_t& offset) MOZ_OVERRIDE;
michael@0 66 bool RecvOnStopRequest(const nsresult& statusCode) MOZ_OVERRIDE;
michael@0 67 bool RecvCancelEarly(const nsresult& statusCode) MOZ_OVERRIDE;
michael@0 68
michael@0 69 void OnStartRequest(const nsresult& statusCode,
michael@0 70 const int64_t& contentLength,
michael@0 71 const int32_t& source,
michael@0 72 const nsCString& charset,
michael@0 73 const nsCString& securityInfo);
michael@0 74 void OnDataAvailable(const nsCString& data,
michael@0 75 const uint64_t& offset);
michael@0 76 void OnStopRequest(const nsresult& statusCode);
michael@0 77 void CancelEarly(const nsresult& statusCode);
michael@0 78
michael@0 79 friend class PrivateBrowsingChannel<WyciwygChannelChild>;
michael@0 80
michael@0 81 private:
michael@0 82 nsresult mStatus;
michael@0 83 bool mIsPending;
michael@0 84 bool mCanceled;
michael@0 85 uint32_t mLoadFlags;
michael@0 86 int64_t mContentLength;
michael@0 87 int32_t mCharsetSource;
michael@0 88 nsCString mCharset;
michael@0 89 nsCOMPtr<nsIURI> mURI;
michael@0 90 nsCOMPtr<nsIURI> mOriginalURI;
michael@0 91 nsCOMPtr<nsISupports> mOwner;
michael@0 92 nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
michael@0 93 nsCOMPtr<nsIProgressEventSink> mProgressSink;
michael@0 94 nsCOMPtr<nsILoadGroup> mLoadGroup;
michael@0 95 nsCOMPtr<nsIStreamListener> mListener;
michael@0 96 nsCOMPtr<nsISupports> mListenerContext;
michael@0 97 nsCOMPtr<nsISupports> mSecurityInfo;
michael@0 98
michael@0 99 // FIXME: replace with IPDL states (bug 536319)
michael@0 100 enum WyciwygChannelChildState mState;
michael@0 101
michael@0 102 bool mIPCOpen;
michael@0 103 bool mSentAppData;
michael@0 104 nsRefPtr<ChannelEventQueue> mEventQ;
michael@0 105
michael@0 106 friend class WyciwygStartRequestEvent;
michael@0 107 friend class WyciwygDataAvailableEvent;
michael@0 108 friend class WyciwygStopRequestEvent;
michael@0 109 friend class WyciwygCancelEvent;
michael@0 110 };
michael@0 111
michael@0 112 inline bool
michael@0 113 WyciwygChannelChild::IsSuspended()
michael@0 114 {
michael@0 115 return false;
michael@0 116 }
michael@0 117
michael@0 118 } // namespace net
michael@0 119 } // namespace mozilla
michael@0 120
michael@0 121 #endif // mozilla_net_WyciwygChannelChild_h

mercurial