Thu, 15 Jan 2015 15:59:08 +0100
Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
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 RtspChannelChild_h |
michael@0 | 8 | #define RtspChannelChild_h |
michael@0 | 9 | |
michael@0 | 10 | #include "mozilla/net/PRtspChannelChild.h" |
michael@0 | 11 | #include "mozilla/net/NeckoChild.h" |
michael@0 | 12 | #include "nsBaseChannel.h" |
michael@0 | 13 | #include "nsIChildChannel.h" |
michael@0 | 14 | #include "nsIStreamingProtocolController.h" |
michael@0 | 15 | #include "nsIStreamingProtocolService.h" |
michael@0 | 16 | |
michael@0 | 17 | namespace mozilla { |
michael@0 | 18 | namespace net { |
michael@0 | 19 | |
michael@0 | 20 | //----------------------------------------------------------------------------- |
michael@0 | 21 | // RtspChannelChild is a dummy channel used to aid MediaResource creation in |
michael@0 | 22 | // HTMLMediaElement. Network control and data flows are managed by an |
michael@0 | 23 | // RtspController object, which is created by us and manipulated by |
michael@0 | 24 | // RtspMediaResource. This object is also responsible for inter-process |
michael@0 | 25 | // communication with the parent process. |
michael@0 | 26 | // When RtspChannelChild::AsyncOpen is called, it should create an |
michael@0 | 27 | // RtspController object, dispatch an OnStartRequest and immediately return. |
michael@0 | 28 | // We expect an RtspMediaResource object will be created in the calling context |
michael@0 | 29 | // and it will use the RtpController we create. |
michael@0 | 30 | |
michael@0 | 31 | class RtspChannelChild : public PRtspChannelChild |
michael@0 | 32 | , public nsBaseChannel |
michael@0 | 33 | , public nsIChildChannel |
michael@0 | 34 | { |
michael@0 | 35 | public: |
michael@0 | 36 | NS_DECL_ISUPPORTS |
michael@0 | 37 | NS_DECL_NSICHILDCHANNEL |
michael@0 | 38 | |
michael@0 | 39 | RtspChannelChild(nsIURI *aUri); |
michael@0 | 40 | ~RtspChannelChild(); |
michael@0 | 41 | |
michael@0 | 42 | // nsBaseChannel::nsIChannel |
michael@0 | 43 | NS_IMETHOD GetContentType(nsACString & aContentType) MOZ_OVERRIDE MOZ_FINAL; |
michael@0 | 44 | NS_IMETHOD AsyncOpen(nsIStreamListener *listener, nsISupports *aContext) |
michael@0 | 45 | MOZ_OVERRIDE MOZ_FINAL; |
michael@0 | 46 | |
michael@0 | 47 | // nsBaseChannel::nsIStreamListener::nsIRequestObserver |
michael@0 | 48 | NS_IMETHOD OnStartRequest(nsIRequest *aRequest, nsISupports *aContext) |
michael@0 | 49 | MOZ_OVERRIDE MOZ_FINAL; |
michael@0 | 50 | NS_IMETHOD OnStopRequest(nsIRequest *aRequest, |
michael@0 | 51 | nsISupports *aContext, |
michael@0 | 52 | nsresult aStatusCode) MOZ_OVERRIDE MOZ_FINAL; |
michael@0 | 53 | |
michael@0 | 54 | // nsBaseChannel::nsIStreamListener |
michael@0 | 55 | NS_IMETHOD OnDataAvailable(nsIRequest *aRequest, |
michael@0 | 56 | nsISupports *aContext, |
michael@0 | 57 | nsIInputStream *aInputStream, |
michael@0 | 58 | uint64_t aOffset, |
michael@0 | 59 | uint32_t aCount) MOZ_OVERRIDE MOZ_FINAL; |
michael@0 | 60 | |
michael@0 | 61 | // nsBaseChannel::nsIChannel::nsIRequest |
michael@0 | 62 | NS_IMETHOD Cancel(nsresult status) MOZ_OVERRIDE MOZ_FINAL; |
michael@0 | 63 | NS_IMETHOD Suspend() MOZ_OVERRIDE MOZ_FINAL; |
michael@0 | 64 | NS_IMETHOD Resume() MOZ_OVERRIDE MOZ_FINAL; |
michael@0 | 65 | |
michael@0 | 66 | // nsBaseChannel |
michael@0 | 67 | NS_IMETHOD OpenContentStream(bool aAsync, |
michael@0 | 68 | nsIInputStream **aStream, |
michael@0 | 69 | nsIChannel **aChannel) MOZ_OVERRIDE MOZ_FINAL; |
michael@0 | 70 | |
michael@0 | 71 | // IPDL |
michael@0 | 72 | void AddIPDLReference(); |
michael@0 | 73 | void ReleaseIPDLReference(); |
michael@0 | 74 | |
michael@0 | 75 | // RtspChannelChild |
michael@0 | 76 | nsIStreamingProtocolController* GetController(); |
michael@0 | 77 | void ReleaseController(); |
michael@0 | 78 | |
michael@0 | 79 | private: |
michael@0 | 80 | bool mIPCOpen; |
michael@0 | 81 | bool mCanceled; |
michael@0 | 82 | nsCOMPtr<nsIStreamingProtocolController> mMediaStreamController; |
michael@0 | 83 | }; |
michael@0 | 84 | |
michael@0 | 85 | } // namespace net |
michael@0 | 86 | } // namespace mozilla |
michael@0 | 87 | |
michael@0 | 88 | #endif // RtspChannelChild_h |