tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

DocumentChannelParent.h (2037B)


      1 /* vim: set sw=2 ts=8 et tw=80 : */
      2 
      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 mozilla_net_DocumentChannelParent_h
      8 #define mozilla_net_DocumentChannelParent_h
      9 
     10 #include "mozilla/net/DocumentLoadListener.h"
     11 #include "mozilla/net/PDocumentChannelParent.h"
     12 
     13 namespace mozilla {
     14 namespace dom {
     15 class CanonicalBrowsingContext;
     16 }
     17 namespace net {
     18 
     19 class EarlyHintConnectArgs;
     20 
     21 /**
     22 * An actor that forwards all changes across to DocumentChannelChild, the
     23 * nsIChannel implementation owned by a content process docshell.
     24 */
     25 class DocumentChannelParent final
     26    : public PDocumentChannelParent,
     27      public DocumentLoadListener::ObjectUpgradeHandler {
     28 public:
     29  NS_INLINE_DECL_REFCOUNTING(DocumentChannelParent, override);
     30 
     31  explicit DocumentChannelParent();
     32 
     33  bool Init(dom::CanonicalBrowsingContext* aContext,
     34            const DocumentChannelCreationArgs& aArgs);
     35 
     36  // PDocumentChannelParent
     37  ipc::IPCResult RecvCancel(const nsresult& aStatus, const nsCString& aReason) {
     38    if (mDocumentLoadListener) {
     39      mDocumentLoadListener->Cancel(aStatus, aReason);
     40    }
     41    return IPC_OK();
     42  }
     43  void ActorDestroy(ActorDestroyReason aWhy) override {
     44    if (mDocumentLoadListener) {
     45      mDocumentLoadListener->Cancel(NS_BINDING_ABORTED,
     46                                    "DocumentChannelParent::ActorDestroy"_ns);
     47    }
     48  }
     49 
     50 private:
     51  RefPtr<ObjectUpgradePromise> UpgradeObjectLoad() override;
     52 
     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);
     59 
     60  virtual ~DocumentChannelParent();
     61 
     62  RefPtr<DocumentLoadListener> mDocumentLoadListener;
     63 };
     64 
     65 }  // namespace net
     66 }  // namespace mozilla
     67 
     68 #endif  // mozilla_net_DocumentChannelParent_h