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___
10 #include "nsIThreadRetargetableStreamListener.h"
12 #include "nsIStreamConverter.h"
13 #include "nsIDirIndexListener.h"
15 #define NS_NSINDEXEDTOHTMLCONVERTER_CID \
17 0xcf0f71fd, 0xfafd, 0x4e2b, { \
18 0x9f, 0xdc, 0x13, 0x4d, 0x97, 0x2e, 0x16, 0xe2 \
22 class nsIStringBundle
;
23 class nsITextToSubURI
;
25 class nsIndexedToHTML
: public nsIStreamConverter
, public nsIDirIndexListener
{
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
);
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
);
47 nsCOMPtr
<nsIDirIndexParser
> mParser
;
48 nsCOMPtr
<nsIStreamListener
> mListener
; // final listener (consumer)
50 nsCOMPtr
<nsIStringBundle
> mBundle
;
52 nsCOMPtr
<nsITextToSubURI
> mTextToSubURI
;
55 // Expecting absolute locations, given by 201 lines.
56 bool mExpectAbsLoc
{false};
58 virtual ~nsIndexedToHTML() = default;