Bug 1814798 - pt 2. Add a PHCManager component to control PHC r=glandium,emilio
[gecko.git] / netwerk / streamconv / converters / nsIndexedToHTML.h
blob614793e4348a8cb6c5d6279b9f983fd345f17011
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 "nsString.h"
11 #include "nsIStreamConverter.h"
12 #include "nsIDirIndexListener.h"
14 #define NS_NSINDEXEDTOHTMLCONVERTER_CID \
15 { \
16 0xcf0f71fd, 0xfafd, 0x4e2b, { \
17 0x9f, 0xdc, 0x13, 0x4d, 0x97, 0x2e, 0x16, 0xe2 \
18 } \
21 class nsIStringBundle;
22 class nsITextToSubURI;
24 class nsIndexedToHTML : public nsIStreamConverter, public nsIDirIndexListener {
25 public:
26 NS_DECL_ISUPPORTS
27 NS_DECL_NSISTREAMCONVERTER
28 NS_DECL_NSIREQUESTOBSERVER
29 NS_DECL_NSISTREAMLISTENER
30 NS_DECL_NSIDIRINDEXLISTENER
32 nsIndexedToHTML() = default;
34 nsresult Init(nsIStreamListener* aListener);
36 static nsresult Create(REFNSIID aIID, void** aResult);
38 protected:
39 void FormatSizeString(int64_t inSize, nsCString& outSizeString);
40 nsresult SendToListener(nsIRequest* aRequest, const nsACString& aBuffer);
41 // Helper to properly implement OnStartRequest
42 nsresult DoOnStartRequest(nsIRequest* request, nsCString& aBuffer);
44 protected:
45 nsCOMPtr<nsIDirIndexParser> mParser;
46 nsCOMPtr<nsIStreamListener> mListener; // final listener (consumer)
48 nsCOMPtr<nsIStringBundle> mBundle;
50 nsCOMPtr<nsITextToSubURI> mTextToSubURI;
52 private:
53 // Expecting absolute locations, given by 201 lines.
54 bool mExpectAbsLoc{false};
56 virtual ~nsIndexedToHTML() = default;
59 #endif