tor-browser

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

GeckoViewContentChannelChild.h (2815B)


      1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim:set ts=2 sw=2 sts=2 et cin: */
      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_GeckoViewContentChannelChild_h__
      8 #define mozilla_net_GeckoViewContentChannelChild_h__
      9 
     10 #include "nsBaseChannel.h"
     11 #include "nsIChildChannel.h"
     12 #include "mozilla/net/ChannelEventQueue.h"
     13 #include "mozilla/net/PGeckoViewContentChannelChild.h"
     14 #include "mozilla/NotNull.h"
     15 
     16 namespace mozilla::net {
     17 
     18 class GeckoViewContentChannelChild final
     19    : public nsBaseChannel,
     20      public nsIChildChannel,
     21      public PGeckoViewContentChannelChild {
     22 public:
     23  explicit GeckoViewContentChannelChild(nsIURI* aUri);
     24 
     25  NS_DECL_ISUPPORTS_INHERITED
     26  NS_DECL_NSICHILDCHANNEL
     27 
     28  NS_IMETHOD Cancel(nsresult aStatus) override;
     29  NS_IMETHOD Suspend() override;
     30  NS_IMETHOD Resume() override;
     31 
     32  NS_IMETHOD AsyncOpen(nsIStreamListener* aListener) override;
     33 
     34  nsresult OpenContentStream(bool aAsync, nsIInputStream** aStream,
     35                             nsIChannel** aChannel) override;
     36 
     37  mozilla::ipc::IPCResult RecvOnStartRequest(const nsresult& aChannelStatus,
     38                                             const nsACString& aContentType,
     39                                             const nsACString& aEntityID,
     40                                             mozilla::NotNull<nsIURI*> aURI);
     41 
     42  mozilla::ipc::IPCResult RecvOnDataAvailable(const nsresult& aChannelStatus,
     43                                              const nsACString& aData,
     44                                              const uint64_t& aOffset,
     45                                              const uint32_t& aCount);
     46 
     47  mozilla::ipc::IPCResult RecvOnStopRequest(const nsresult& aChannelStatus);
     48 
     49  mozilla::ipc::IPCResult RecvOnAsyncOpenFailed(const nsresult& aResult);
     50 
     51  mozilla::ipc::IPCResult RecvDeleteSelf();
     52 
     53  friend class NeckoTargetChannelFunctionEvent;
     54 
     55 protected:
     56  virtual void ActorDestroy(ActorDestroyReason why) override;
     57 
     58 private:
     59  virtual ~GeckoViewContentChannelChild() = default;
     60 
     61  void DoOnStartRequest(const nsresult& aChannelStatus,
     62                        const nsCString& aContentType,
     63                        const nsCString& aEntityID, nsIURI* aURI);
     64 
     65  void DoOnDataAvailable(const nsresult& aChannelStatus, const nsCString& aData,
     66                         const uint64_t& aOffset, const uint32_t& aCount);
     67 
     68  void DoOnStopRequest(const nsresult& aChannelStatus);
     69 
     70  void DoOnAsyncOpenFailed(const nsresult& aResult);
     71 
     72  void DoDeleteSelf();
     73 
     74  const RefPtr<ChannelEventQueue> mEventQ;
     75  uint32_t mSuspendCount = 0;
     76  bool mSuspendSent = false;
     77 };
     78 
     79 }  // namespace mozilla::net
     80 
     81 #endif