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 #include "mozilla/dom/PExternalHelperAppParent.h"
8 #include "mozilla/ipc/BackgroundUtils.h"
9 #include "nsIChannel.h"
10 #include "nsIMultiPartChannel.h"
11 #include "nsIResumableChannel.h"
12 #include "nsIStreamListener.h"
13 #include "nsHashPropertyBag.h"
14 #include "mozilla/net/PrivateBrowsingChannel.h"
20 class nsExternalAppHandler
;
25 class PChannelDiverterParent
;
30 #define NS_IEXTERNALHELPERAPPPARENT_IID \
32 0x127a01bc, 0x2a49, 0x46a8, { \
33 0x8c, 0x63, 0x4b, 0x5d, 0x3c, 0xa4, 0x07, 0x9c \
37 class nsIExternalHelperAppParent
: public nsISupports
{
39 NS_DECLARE_STATIC_IID_ACCESSOR(NS_IEXTERNALHELPERAPPPARENT_IID
)
42 * Returns true if this fake channel represented a file channel in the child.
44 virtual bool WasFileChannel() = 0;
47 NS_DEFINE_STATIC_IID_ACCESSOR(nsIExternalHelperAppParent
,
48 NS_IEXTERNALHELPERAPPPARENT_IID
)
53 class ExternalHelperAppParent
54 : public PExternalHelperAppParent
,
55 public nsHashPropertyBag
,
57 public nsIMultiPartChannel
,
58 public nsIResumableChannel
,
59 public nsIStreamListener
,
60 public net::PrivateBrowsingChannel
<ExternalHelperAppParent
>,
61 public nsIExternalHelperAppParent
{
63 NS_DECL_ISUPPORTS_INHERITED
66 NS_DECL_NSIMULTIPARTCHANNEL
67 NS_DECL_NSIRESUMABLECHANNEL
68 NS_DECL_NSISTREAMLISTENER
69 NS_DECL_NSIREQUESTOBSERVER
71 mozilla::ipc::IPCResult
RecvOnStartRequest(
72 const nsCString
& entityID
) override
;
73 mozilla::ipc::IPCResult
RecvOnDataAvailable(const nsCString
& data
,
74 const uint64_t& offset
,
75 const uint32_t& count
) override
;
76 mozilla::ipc::IPCResult
RecvOnStopRequest(const nsresult
& code
) override
;
78 bool WasFileChannel() override
{ return mWasFileChannel
; }
80 ExternalHelperAppParent(nsIURI
* uri
, const int64_t& contentLength
,
81 const bool& wasFileChannel
,
82 const nsCString
& aContentDispositionHeader
,
83 const uint32_t& aContentDispositionHint
,
84 const nsString
& aContentDispositionFilename
);
85 void Init(const Maybe
<mozilla::net::LoadInfoArgs
>& aLoadInfoArgs
,
86 const nsCString
& aMimeContentType
, const bool& aForceSave
,
87 nsIURI
* aReferrer
, BrowsingContext
* aContext
,
88 const bool& aShouldCloseWindow
);
91 virtual ~ExternalHelperAppParent();
93 virtual void ActorDestroy(ActorDestroyReason why
) override
;
97 RefPtr
<nsIStreamListener
> mListener
;
98 nsCOMPtr
<nsIURI
> mURI
;
99 nsCOMPtr
<nsILoadInfo
> mLoadInfo
;
102 nsLoadFlags mLoadFlags
;
105 int64_t mContentLength
;
106 bool mWasFileChannel
;
107 uint32_t mContentDisposition
;
108 nsString mContentDispositionFilename
;
109 nsCString mContentDispositionHeader
;
114 } // namespace mozilla