tor-browser

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

nsIndexedToHTML.h (1723B)


      1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* This Source Code Form is subject to the terms of the Mozilla Public
      3 * License, v. 2.0. If a copy of the MPL was not distributed with this
      4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      5 
      6 #ifndef ____nsindexedtohtml___h___
      7 #define ____nsindexedtohtml___h___
      8 
      9 #include "nsCOMPtr.h"
     10 #include "nsIThreadRetargetableStreamListener.h"
     11 #include "nsString.h"
     12 #include "nsIStreamConverter.h"
     13 #include "nsIDirIndexListener.h"
     14 
     15 #define NS_NSINDEXEDTOHTMLCONVERTER_CID \
     16  {0xcf0f71fd, 0xfafd, 0x4e2b, {0x9f, 0xdc, 0x13, 0x4d, 0x97, 0x2e, 0x16, 0xe2}}
     17 
     18 class nsIStringBundle;
     19 class nsITextToSubURI;
     20 
     21 class nsIndexedToHTML : public nsIStreamConverter, public nsIDirIndexListener {
     22 public:
     23  NS_DECL_ISUPPORTS
     24  NS_DECL_NSISTREAMCONVERTER
     25  NS_DECL_NSIREQUESTOBSERVER
     26  NS_DECL_NSISTREAMLISTENER
     27  NS_DECL_NSITHREADRETARGETABLESTREAMLISTENER
     28  NS_DECL_NSIDIRINDEXLISTENER
     29 
     30  nsIndexedToHTML() = default;
     31 
     32  nsresult Init(nsIStreamListener* aListener);
     33 
     34  static nsresult Create(REFNSIID aIID, void** aResult);
     35 
     36 protected:
     37  void FormatSizeString(int64_t inSize, nsCString& outSizeString);
     38  nsresult SendToListener(nsIRequest* aRequest, const nsACString& aBuffer);
     39  // Helper to properly implement OnStartRequest
     40  nsresult DoOnStartRequest(nsIRequest* request, nsCString& aBuffer);
     41 
     42 protected:
     43  nsCOMPtr<nsIDirIndexParser> mParser;
     44  nsCOMPtr<nsIStreamListener> mListener;  // final listener (consumer)
     45 
     46  nsCOMPtr<nsIStringBundle> mBundle;
     47 
     48  nsCOMPtr<nsITextToSubURI> mTextToSubURI;
     49 
     50 private:
     51  // Expecting absolute locations, given by 201 lines.
     52  bool mExpectAbsLoc{false};
     53 
     54  virtual ~nsIndexedToHTML() = default;
     55 };
     56 
     57 #endif