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"
23 class nsExternalAppHandler
;
28 class PChannelDiverterParent
;
33 #define NS_IEXTERNALHELPERAPPPARENT_IID \
35 0x127a01bc, 0x2a49, 0x46a8, { \
36 0x8c, 0x63, 0x4b, 0x5d, 0x3c, 0xa4, 0x07, 0x9c \
40 class nsIExternalHelperAppParent
: public nsISupports
{
42 NS_DECLARE_STATIC_IID_ACCESSOR(NS_IEXTERNALHELPERAPPPARENT_IID
)
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
)
56 class ExternalHelperAppParent
57 : public PExternalHelperAppParent
,
58 public nsHashPropertyBag
,
60 public nsIMultiPartChannel
,
61 public nsIResumableChannel
,
62 public nsIStreamListener
,
63 public net::PrivateBrowsingChannel
<ExternalHelperAppParent
>,
64 public nsIExternalHelperAppParent
{
66 NS_DECL_ISUPPORTS_INHERITED
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
);
94 virtual ~ExternalHelperAppParent();
96 virtual void ActorDestroy(ActorDestroyReason why
) override
;
100 RefPtr
<nsIStreamListener
> mListener
;
101 nsCOMPtr
<nsIURI
> mURI
;
102 nsCOMPtr
<nsILoadInfo
> mLoadInfo
;
105 nsLoadFlags mLoadFlags
;
108 int64_t mContentLength
;
109 bool mWasFileChannel
;
110 uint32_t mContentDisposition
;
111 nsString mContentDispositionFilename
;
112 nsCString mContentDispositionHeader
;
117 } // namespace mozilla