GIOChannelParent.h (2407B)
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=4 sw=2 sts=2 et tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef NS_GIOCHANNELPARENT_H 8 #define NS_GIOCHANNELPARENT_H 9 10 #include "mozilla/net/PGIOChannelParent.h" 11 #include "mozilla/net/NeckoParent.h" 12 #include "nsIParentChannel.h" 13 #include "nsIInterfaceRequestor.h" 14 15 class nsILoadContext; 16 17 namespace mozilla { 18 19 namespace dom { 20 class BrowserParent; 21 } // namespace dom 22 23 namespace net { 24 class ChannelEventQueue; 25 26 class GIOChannelParent final : public PGIOChannelParent, 27 public nsIParentChannel, 28 public nsIInterfaceRequestor { 29 public: 30 NS_DECL_ISUPPORTS 31 NS_DECL_NSIREQUESTOBSERVER 32 NS_DECL_NSISTREAMLISTENER 33 NS_DECL_NSIPARENTCHANNEL 34 NS_DECL_NSIINTERFACEREQUESTOR 35 36 GIOChannelParent(dom::BrowserParent* aIframeEmbedding, 37 nsILoadContext* aLoadContext, 38 PBOverrideStatus aOverrideStatus); 39 40 bool Init(const GIOChannelCreationArgs& aOpenArgs); 41 42 protected: 43 virtual ~GIOChannelParent() = default; 44 45 bool DoAsyncOpen(const URIParams& aURI, const uint64_t& aStartPos, 46 const nsCString& aEntityID, 47 const Maybe<mozilla::ipc::IPCStream>& aUploadStream, 48 const LoadInfoArgs& aLoadInfoArgs, 49 const uint32_t& aLoadFlags); 50 51 // used to connect redirected-to channel in parent with just created 52 // ChildChannel. Used during HTTP->FTP redirects. 53 bool ConnectChannel(const uint64_t& channelId); 54 55 virtual mozilla::ipc::IPCResult RecvCancel(const nsresult& status) override; 56 virtual mozilla::ipc::IPCResult RecvSuspend() override; 57 virtual mozilla::ipc::IPCResult RecvResume() override; 58 59 virtual void ActorDestroy(ActorDestroyReason why) override; 60 61 nsCOMPtr<nsIChannel> mChannel; 62 63 bool mIPCClosed = false; 64 65 nsCOMPtr<nsILoadContext> mLoadContext; 66 67 PBOverrideStatus mPBOverride; 68 69 // Set to the canceled status value if the main channel was canceled. 70 nsresult mStatus = NS_OK; 71 72 RefPtr<mozilla::dom::BrowserParent> mBrowserParent; 73 74 RefPtr<ChannelEventQueue> mEventQ; 75 }; 76 77 } // namespace net 78 } // namespace mozilla 79 80 #endif /* NS_GIOCHANNELPARENT_H */