Backed out changeset 2450366cf7ca (bug 1891629) for causing win msix mochitest failures
[gecko.git] / netwerk / streamconv / converters / nsIndexedToHTML.h
blob736df3ebf7594dfb4ca60afe6a92490cc9508bec
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/. */
6 #ifndef ____nsindexedtohtml___h___
7 #define ____nsindexedtohtml___h___
9 #include "nsCOMPtr.h"
10 #include "nsIThreadRetargetableStreamListener.h"
11 #include "nsString.h"
12 #include "nsIStreamConverter.h"
13 #include "nsIDirIndexListener.h"
15 #define NS_NSINDEXEDTOHTMLCONVERTER_CID \
16 { \
17 0xcf0f71fd, 0xfafd, 0x4e2b, { \
18 0x9f, 0xdc, 0x13, 0x4d, 0x97, 0x2e, 0x16, 0xe2 \
19 } \
22 class nsIStringBundle;
23 class nsITextToSubURI;
25 class nsIndexedToHTML : public nsIStreamConverter, public nsIDirIndexListener {
26 public:
27 NS_DECL_ISUPPORTS
28 NS_DECL_NSISTREAMCONVERTER
29 NS_DECL_NSIREQUESTOBSERVER
30 NS_DECL_NSISTREAMLISTENER
31 NS_DECL_NSITHREADRETARGETABLESTREAMLISTENER
32 NS_DECL_NSIDIRINDEXLISTENER
34 nsIndexedToHTML() = default;
36 nsresult Init(nsIStreamListener* aListener);
38 static nsresult Create(REFNSIID aIID, void** aResult);
40 protected:
41 void FormatSizeString(int64_t inSize, nsCString& outSizeString);
42 nsresult SendToListener(nsIRequest* aRequest, const nsACString& aBuffer);
43 // Helper to properly implement OnStartRequest
44 nsresult DoOnStartRequest(nsIRequest* request, nsCString& aBuffer);
46 protected:
47 nsCOMPtr<nsIDirIndexParser> mParser;
48 nsCOMPtr<nsIStreamListener> mListener; // final listener (consumer)
50 nsCOMPtr<nsIStringBundle> mBundle;
52 nsCOMPtr<nsITextToSubURI> mTextToSubURI;
54 private:
55 // Expecting absolute locations, given by 201 lines.
56 bool mExpectAbsLoc{false};
58 virtual ~nsIndexedToHTML() = default;
61 #endif