DocumentChannelChild.h (2606B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set sw=2 ts=8 et tw=80 : */ 3 4 /* This Source Code Form is subject to the terms of the Mozilla Public 5 * License, v. 2.0. If a copy of the MPL was not distributed with this 6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 7 8 #ifndef mozilla_net_DocumentChannelChild_h 9 #define mozilla_net_DocumentChannelChild_h 10 11 #include "mozilla/net/PDocumentChannelChild.h" 12 #include "mozilla/net/DocumentChannel.h" 13 #include "nsIAsyncVerifyRedirectCallback.h" 14 #include "mozilla/dom/nsCSPContext.h" 15 16 namespace mozilla { 17 namespace net { 18 19 /** 20 * DocumentChannelChild is an implementation of DocumentChannel for nsDocShells 21 * in the content process, that uses PDocumentChannel to serialize everything 22 * across IPDL to the parent process. 23 */ 24 class DocumentChannelChild final : public DocumentChannel, 25 public nsIAsyncVerifyRedirectCallback, 26 public PDocumentChannelChild { 27 public: 28 DocumentChannelChild(nsDocShellLoadState* aLoadState, 29 class LoadInfo* aLoadInfo, nsLoadFlags aLoadFlags, 30 uint32_t aCacheKey, bool aUriModified, 31 bool aIsEmbeddingBlockedError); 32 33 NS_DECL_ISUPPORTS_INHERITED 34 NS_DECL_NSIASYNCVERIFYREDIRECTCALLBACK 35 36 NS_IMETHOD AsyncOpen(nsIStreamListener* aListener) override; 37 NS_IMETHOD Cancel(nsresult aStatusCode) override; 38 NS_IMETHOD CancelWithReason(nsresult aStatusCode, 39 const nsACString& aReason) override; 40 41 mozilla::ipc::IPCResult RecvFailedAsyncOpen(const nsresult& aStatusCode); 42 43 mozilla::ipc::IPCResult RecvDisconnectChildListeners( 44 const nsresult& aStatus, const nsresult& aLoadGroupStatus, 45 bool aSwitchedProcess); 46 47 mozilla::ipc::IPCResult RecvDeleteSelf(); 48 49 mozilla::ipc::IPCResult RecvRedirectToRealChannel( 50 RedirectToRealChannelArgs&& aArgs, 51 nsTArray<Endpoint<extensions::PStreamFilterParent>>&& aEndpoints, 52 RedirectToRealChannelResolver&& aResolve); 53 54 mozilla::ipc::IPCResult RecvUpgradeObjectLoad( 55 UpgradeObjectLoadResolver&& aResolve); 56 57 private: 58 void DeleteIPDL() override { 59 if (CanSend()) { 60 Send__delete__(this); 61 } 62 } 63 64 ~DocumentChannelChild(); 65 66 nsCOMPtr<nsIChannel> mRedirectChannel; 67 68 RedirectToRealChannelResolver mRedirectResolver; 69 nsTArray<Endpoint<extensions::PStreamFilterParent>> mStreamFilterEndpoints; 70 dom::BrowsingContext* mLoadingContext; 71 }; 72 73 } // namespace net 74 } // namespace mozilla 75 76 #endif // mozilla_net_DocumentChannelChild_h