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 | #include "RtspChannelParent.h" |
michael@0 | 8 | |
michael@0 | 9 | using namespace mozilla::ipc; |
michael@0 | 10 | |
michael@0 | 11 | namespace mozilla { |
michael@0 | 12 | namespace net { |
michael@0 | 13 | |
michael@0 | 14 | //----------------------------------------------------------------------------- |
michael@0 | 15 | // RtspChannelParent |
michael@0 | 16 | //----------------------------------------------------------------------------- |
michael@0 | 17 | RtspChannelParent::RtspChannelParent(nsIURI *aUri) |
michael@0 | 18 | : mIPCClosed(false) |
michael@0 | 19 | { |
michael@0 | 20 | nsBaseChannel::SetURI(aUri); |
michael@0 | 21 | } |
michael@0 | 22 | |
michael@0 | 23 | RtspChannelParent::~RtspChannelParent() |
michael@0 | 24 | { |
michael@0 | 25 | } |
michael@0 | 26 | |
michael@0 | 27 | void |
michael@0 | 28 | RtspChannelParent::ActorDestroy(ActorDestroyReason why) |
michael@0 | 29 | { |
michael@0 | 30 | mIPCClosed = true; |
michael@0 | 31 | } |
michael@0 | 32 | |
michael@0 | 33 | //----------------------------------------------------------------------------- |
michael@0 | 34 | // nsISupports |
michael@0 | 35 | //----------------------------------------------------------------------------- |
michael@0 | 36 | NS_IMPL_ISUPPORTS_INHERITED(RtspChannelParent, |
michael@0 | 37 | nsBaseChannel, |
michael@0 | 38 | nsIParentChannel) |
michael@0 | 39 | |
michael@0 | 40 | //----------------------------------------------------------------------------- |
michael@0 | 41 | // RtspChannelParent methods |
michael@0 | 42 | //----------------------------------------------------------------------------- |
michael@0 | 43 | bool |
michael@0 | 44 | RtspChannelParent::Init(const RtspChannelConnectArgs& aArgs) |
michael@0 | 45 | { |
michael@0 | 46 | return ConnectChannel(aArgs.channelId()); |
michael@0 | 47 | } |
michael@0 | 48 | |
michael@0 | 49 | bool |
michael@0 | 50 | RtspChannelParent::ConnectChannel(const uint32_t& channelId) |
michael@0 | 51 | { |
michael@0 | 52 | nsresult rv; |
michael@0 | 53 | nsCOMPtr<nsIChannel> channel; |
michael@0 | 54 | rv = NS_LinkRedirectChannels(channelId, this, getter_AddRefs(channel)); |
michael@0 | 55 | |
michael@0 | 56 | return true; |
michael@0 | 57 | } |
michael@0 | 58 | |
michael@0 | 59 | //----------------------------------------------------------------------------- |
michael@0 | 60 | // nsBaseChannel::nsIChannel |
michael@0 | 61 | //----------------------------------------------------------------------------- |
michael@0 | 62 | NS_IMETHODIMP |
michael@0 | 63 | RtspChannelParent::GetContentType(nsACString& aContentType) |
michael@0 | 64 | { |
michael@0 | 65 | aContentType.AssignLiteral("RTSP"); |
michael@0 | 66 | return NS_OK; |
michael@0 | 67 | } |
michael@0 | 68 | |
michael@0 | 69 | NS_IMETHODIMP |
michael@0 | 70 | RtspChannelParent::AsyncOpen(nsIStreamListener *aListener, nsISupports *aContext) |
michael@0 | 71 | { |
michael@0 | 72 | return NS_OK; |
michael@0 | 73 | } |
michael@0 | 74 | |
michael@0 | 75 | //----------------------------------------------------------------------------- |
michael@0 | 76 | // nsBaseChannel::nsIStreamListener::nsIRequestObserver |
michael@0 | 77 | //----------------------------------------------------------------------------- |
michael@0 | 78 | NS_IMETHODIMP |
michael@0 | 79 | RtspChannelParent::OnStartRequest(nsIRequest *aRequest, |
michael@0 | 80 | nsISupports *aContext) |
michael@0 | 81 | { |
michael@0 | 82 | MOZ_CRASH("Should never be called"); |
michael@0 | 83 | } |
michael@0 | 84 | |
michael@0 | 85 | NS_IMETHODIMP |
michael@0 | 86 | RtspChannelParent::OnStopRequest(nsIRequest *aRequest, |
michael@0 | 87 | nsISupports *aContext, |
michael@0 | 88 | nsresult aStatusCode) |
michael@0 | 89 | { |
michael@0 | 90 | MOZ_CRASH("Should never be called"); |
michael@0 | 91 | } |
michael@0 | 92 | |
michael@0 | 93 | //----------------------------------------------------------------------------- |
michael@0 | 94 | // nsBaseChannel::nsIStreamListener |
michael@0 | 95 | //----------------------------------------------------------------------------- |
michael@0 | 96 | NS_IMETHODIMP |
michael@0 | 97 | RtspChannelParent::OnDataAvailable(nsIRequest *aRequest, |
michael@0 | 98 | nsISupports *aContext, |
michael@0 | 99 | nsIInputStream *aInputStream, |
michael@0 | 100 | uint64_t aOffset, |
michael@0 | 101 | uint32_t aCount) |
michael@0 | 102 | { |
michael@0 | 103 | MOZ_CRASH("Should never be called"); |
michael@0 | 104 | } |
michael@0 | 105 | |
michael@0 | 106 | //----------------------------------------------------------------------------- |
michael@0 | 107 | // nsBaseChannel::nsIChannel::nsIRequeset |
michael@0 | 108 | //----------------------------------------------------------------------------- |
michael@0 | 109 | NS_IMETHODIMP |
michael@0 | 110 | RtspChannelParent::Cancel(nsresult status) |
michael@0 | 111 | { |
michael@0 | 112 | // FIXME: This method will be called by |
michael@0 | 113 | // nsXMLHttpRequest::CloseRequestWithError while closing the browser app. |
michael@0 | 114 | // However, the root cause is RtspChannelParent will be created by |
michael@0 | 115 | // nsXMLHttpRequest::Open when we navigate away from an RTSP web page. |
michael@0 | 116 | // We should find out why it happens and decide how to fix it. |
michael@0 | 117 | return NS_OK; |
michael@0 | 118 | } |
michael@0 | 119 | |
michael@0 | 120 | NS_IMETHODIMP |
michael@0 | 121 | RtspChannelParent::Suspend() |
michael@0 | 122 | { |
michael@0 | 123 | MOZ_CRASH("Should never be called"); |
michael@0 | 124 | } |
michael@0 | 125 | |
michael@0 | 126 | NS_IMETHODIMP |
michael@0 | 127 | RtspChannelParent::Resume() |
michael@0 | 128 | { |
michael@0 | 129 | MOZ_CRASH("Should never be called"); |
michael@0 | 130 | } |
michael@0 | 131 | |
michael@0 | 132 | //----------------------------------------------------------------------------- |
michael@0 | 133 | // nsBaseChannel |
michael@0 | 134 | //----------------------------------------------------------------------------- |
michael@0 | 135 | NS_IMETHODIMP |
michael@0 | 136 | RtspChannelParent::OpenContentStream(bool aAsync, |
michael@0 | 137 | nsIInputStream **aStream, |
michael@0 | 138 | nsIChannel **aChannel) |
michael@0 | 139 | { |
michael@0 | 140 | MOZ_CRASH("Should never be called"); |
michael@0 | 141 | } |
michael@0 | 142 | |
michael@0 | 143 | //----------------------------------------------------------------------------- |
michael@0 | 144 | // nsIParentChannel |
michael@0 | 145 | //----------------------------------------------------------------------------- |
michael@0 | 146 | NS_IMETHODIMP |
michael@0 | 147 | RtspChannelParent::SetParentListener(HttpChannelParentListener *aListener) |
michael@0 | 148 | { |
michael@0 | 149 | return NS_OK; |
michael@0 | 150 | } |
michael@0 | 151 | |
michael@0 | 152 | NS_IMETHODIMP |
michael@0 | 153 | RtspChannelParent::Delete() |
michael@0 | 154 | { |
michael@0 | 155 | return NS_OK; |
michael@0 | 156 | } |
michael@0 | 157 | |
michael@0 | 158 | } // namespace net |
michael@0 | 159 | } // namespace mozilla |