1 /* vim: set sw=2 ts=8 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/. */
7 #ifndef mozilla_net_DocumentChannelParent_h
8 #define mozilla_net_DocumentChannelParent_h
10 #include "mozilla/net/DocumentLoadListener.h"
11 #include "mozilla/net/PDocumentChannelParent.h"
15 class CanonicalBrowsingContext
;
19 class EarlyHintConnectArgs
;
22 * An actor that forwards all changes across to DocumentChannelChild, the
23 * nsIChannel implementation owned by a content process docshell.
25 class DocumentChannelParent final
26 : public PDocumentChannelParent
,
27 public DocumentLoadListener::ObjectUpgradeHandler
{
29 NS_INLINE_DECL_REFCOUNTING(DocumentChannelParent
, override
);
31 explicit DocumentChannelParent();
33 bool Init(dom::CanonicalBrowsingContext
* aContext
,
34 const DocumentChannelCreationArgs
& aArgs
);
36 // PDocumentChannelParent
37 ipc::IPCResult
RecvCancel(const nsresult
& aStatus
, const nsCString
& aReason
) {
38 if (mDocumentLoadListener
) {
39 mDocumentLoadListener
->Cancel(aStatus
, aReason
);
43 void ActorDestroy(ActorDestroyReason aWhy
) override
{
44 if (mDocumentLoadListener
) {
45 mDocumentLoadListener
->Cancel(NS_BINDING_ABORTED
,
46 "DocumentChannelParent::ActorDestroy"_ns
);
51 RefPtr
<ObjectUpgradePromise
> UpgradeObjectLoad() override
;
53 RefPtr
<PDocumentChannelParent::RedirectToRealChannelPromise
>
54 RedirectToRealChannel(
55 nsTArray
<ipc::Endpoint
<extensions::PStreamFilterParent
>>&&
56 aStreamFilterEndpoints
,
57 uint32_t aRedirectFlags
, uint32_t aLoadFlags
,
58 uint32_t aEarlyHintLinkType
);
60 virtual ~DocumentChannelParent();
62 RefPtr
<DocumentLoadListener
> mDocumentLoadListener
;
66 } // namespace mozilla
68 #endif // mozilla_net_DocumentChannelParent_h