Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* vim: set sw=2 ts=8 et tw=80 : */ |
michael@0 | 3 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #ifndef RtspChannelParent_h |
michael@0 | 8 | #define RtspChannelParent_h |
michael@0 | 9 | |
michael@0 | 10 | #include "mozilla/net/PRtspChannelParent.h" |
michael@0 | 11 | #include "mozilla/net/NeckoParent.h" |
michael@0 | 12 | #include "nsBaseChannel.h" |
michael@0 | 13 | #include "nsIParentChannel.h" |
michael@0 | 14 | |
michael@0 | 15 | namespace mozilla { |
michael@0 | 16 | namespace net { |
michael@0 | 17 | |
michael@0 | 18 | //----------------------------------------------------------------------------- |
michael@0 | 19 | // Note: RtspChannel doesn't transport streams as normal channel does. |
michael@0 | 20 | // (See RtspChannelChild.h for detail). |
michael@0 | 21 | // The reason for the existence of RtspChannelParent is to support HTTP->RTSP |
michael@0 | 22 | // redirection. |
michael@0 | 23 | // When redirection happens, two instances of RtspChannelParent will be created: |
michael@0 | 24 | // - One will be created when HTTP creates the new channel for redirects, and |
michael@0 | 25 | // will be registered as an nsIChannel. |
michael@0 | 26 | // - The other will be created via IPDL by RtspChannelChild, and will be |
michael@0 | 27 | // registered as an nsIParentChannel. |
michael@0 | 28 | class RtspChannelParent : public PRtspChannelParent |
michael@0 | 29 | , public nsBaseChannel |
michael@0 | 30 | , public nsIParentChannel |
michael@0 | 31 | { |
michael@0 | 32 | public: |
michael@0 | 33 | NS_DECL_ISUPPORTS |
michael@0 | 34 | NS_DECL_NSIPARENTCHANNEL |
michael@0 | 35 | |
michael@0 | 36 | RtspChannelParent(nsIURI *aUri); |
michael@0 | 37 | ~RtspChannelParent(); |
michael@0 | 38 | |
michael@0 | 39 | // nsBaseChannel::nsIChannel |
michael@0 | 40 | NS_IMETHOD GetContentType(nsACString & aContentType) MOZ_OVERRIDE MOZ_FINAL; |
michael@0 | 41 | NS_IMETHOD AsyncOpen(nsIStreamListener *listener, |
michael@0 | 42 | nsISupports *aContext) MOZ_OVERRIDE MOZ_FINAL; |
michael@0 | 43 | |
michael@0 | 44 | // nsBaseChannel::nsIStreamListener::nsIRequestObserver |
michael@0 | 45 | NS_IMETHOD OnStartRequest(nsIRequest *aRequest, |
michael@0 | 46 | nsISupports *aContext) MOZ_OVERRIDE MOZ_FINAL; |
michael@0 | 47 | NS_IMETHOD OnStopRequest(nsIRequest *aRequest, |
michael@0 | 48 | nsISupports *aContext, |
michael@0 | 49 | nsresult aStatusCode) MOZ_OVERRIDE MOZ_FINAL; |
michael@0 | 50 | |
michael@0 | 51 | // nsBaseChannel::nsIStreamListener |
michael@0 | 52 | NS_IMETHOD OnDataAvailable(nsIRequest *aRequest, |
michael@0 | 53 | nsISupports *aContext, |
michael@0 | 54 | nsIInputStream *aInputStream, |
michael@0 | 55 | uint64_t aOffset, |
michael@0 | 56 | uint32_t aCount) MOZ_OVERRIDE MOZ_FINAL; |
michael@0 | 57 | |
michael@0 | 58 | // nsBaseChannel::nsIChannel::nsIRequest |
michael@0 | 59 | NS_IMETHOD Cancel(nsresult status) MOZ_OVERRIDE MOZ_FINAL; |
michael@0 | 60 | NS_IMETHOD Suspend() MOZ_OVERRIDE MOZ_FINAL; |
michael@0 | 61 | NS_IMETHOD Resume() MOZ_OVERRIDE MOZ_FINAL; |
michael@0 | 62 | |
michael@0 | 63 | // nsBaseChannel |
michael@0 | 64 | NS_IMETHOD OpenContentStream(bool aAsync, |
michael@0 | 65 | nsIInputStream **aStream, |
michael@0 | 66 | nsIChannel **aChannel) MOZ_OVERRIDE MOZ_FINAL; |
michael@0 | 67 | |
michael@0 | 68 | // RtspChannelParent |
michael@0 | 69 | bool Init(const RtspChannelConnectArgs& aArgs); |
michael@0 | 70 | |
michael@0 | 71 | protected: |
michael@0 | 72 | // Used to connect redirected-to channel in parent with just created |
michael@0 | 73 | // ChildChannel. Used during HTTP->RTSP redirection. |
michael@0 | 74 | bool ConnectChannel(const uint32_t& channelId); |
michael@0 | 75 | |
michael@0 | 76 | private: |
michael@0 | 77 | bool mIPCClosed; |
michael@0 | 78 | virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE; |
michael@0 | 79 | }; |
michael@0 | 80 | |
michael@0 | 81 | } // namespace net |
michael@0 | 82 | } // namespace mozilla |
michael@0 | 83 | |
michael@0 | 84 | #endif // RtspChannelParent_h |