Bug 1845017 - Disable the TestPHCExhaustion test r=glandium
[gecko.git] / uriloader / exthandler / ExternalHelperAppParent.h
blobfdd8a665abb8ad0a2b177b1d9be3e9d8f073666a
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=2 et sw=2 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/. */
7 #ifndef mozilla_dom_ExternalHelperAppParent_h
8 #define mozilla_dom_ExternalHelperAppParent_h
10 #include "mozilla/dom/PExternalHelperAppParent.h"
11 #include "mozilla/ipc/BackgroundUtils.h"
12 #include "nsIChannel.h"
13 #include "nsIMultiPartChannel.h"
14 #include "nsIResumableChannel.h"
15 #include "nsIStreamListener.h"
16 #include "nsHashPropertyBag.h"
17 #include "mozilla/net/PrivateBrowsingChannel.h"
19 namespace IPC {
20 class URI;
21 } // namespace IPC
23 class nsExternalAppHandler;
25 namespace mozilla {
27 namespace net {
28 class PChannelDiverterParent;
29 } // namespace net
31 namespace dom {
33 #define NS_IEXTERNALHELPERAPPPARENT_IID \
34 { \
35 0x127a01bc, 0x2a49, 0x46a8, { \
36 0x8c, 0x63, 0x4b, 0x5d, 0x3c, 0xa4, 0x07, 0x9c \
37 } \
40 class nsIExternalHelperAppParent : public nsISupports {
41 public:
42 NS_DECLARE_STATIC_IID_ACCESSOR(NS_IEXTERNALHELPERAPPPARENT_IID)
44 /**
45 * Returns true if this fake channel represented a file channel in the child.
47 virtual bool WasFileChannel() = 0;
50 NS_DEFINE_STATIC_IID_ACCESSOR(nsIExternalHelperAppParent,
51 NS_IEXTERNALHELPERAPPPARENT_IID)
53 class ContentParent;
54 class PBrowserParent;
56 class ExternalHelperAppParent
57 : public PExternalHelperAppParent,
58 public nsHashPropertyBag,
59 public nsIChannel,
60 public nsIMultiPartChannel,
61 public nsIResumableChannel,
62 public nsIStreamListener,
63 public net::PrivateBrowsingChannel<ExternalHelperAppParent>,
64 public nsIExternalHelperAppParent {
65 public:
66 NS_DECL_ISUPPORTS_INHERITED
67 NS_DECL_NSIREQUEST
68 NS_DECL_NSICHANNEL
69 NS_DECL_NSIMULTIPARTCHANNEL
70 NS_DECL_NSIRESUMABLECHANNEL
71 NS_DECL_NSISTREAMLISTENER
72 NS_DECL_NSIREQUESTOBSERVER
74 mozilla::ipc::IPCResult RecvOnStartRequest(
75 const nsACString& entityID) override;
76 mozilla::ipc::IPCResult RecvOnDataAvailable(const nsACString& data,
77 const uint64_t& offset,
78 const uint32_t& count) override;
79 mozilla::ipc::IPCResult RecvOnStopRequest(const nsresult& code) override;
81 bool WasFileChannel() override { return mWasFileChannel; }
83 ExternalHelperAppParent(nsIURI* uri, const int64_t& contentLength,
84 const bool& wasFileChannel,
85 const nsACString& aContentDispositionHeader,
86 const uint32_t& aContentDispositionHint,
87 const nsAString& aContentDispositionFilename);
88 bool Init(const Maybe<mozilla::net::LoadInfoArgs>& aLoadInfoArgs,
89 const nsACString& aMimeContentType, const bool& aForceSave,
90 nsIURI* aReferrer, BrowsingContext* aContext,
91 const bool& aShouldCloseWindow);
93 protected:
94 virtual ~ExternalHelperAppParent();
96 virtual void ActorDestroy(ActorDestroyReason why) override;
97 void Delete();
99 private:
100 RefPtr<nsIStreamListener> mListener;
101 nsCOMPtr<nsIURI> mURI;
102 nsCOMPtr<nsILoadInfo> mLoadInfo;
103 bool mPending;
104 bool mIPCClosed;
105 nsLoadFlags mLoadFlags;
106 nsresult mStatus;
107 bool mCanceled;
108 int64_t mContentLength;
109 bool mWasFileChannel;
110 uint32_t mContentDisposition;
111 nsString mContentDispositionFilename;
112 nsCString mContentDispositionHeader;
113 nsCString mEntityID;
116 } // namespace dom
117 } // namespace mozilla
118 #endif