|
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
|
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 "nsString.h" |
|
11 #include "nsIStreamConverter.h" |
|
12 #include "nsIDirIndexListener.h" |
|
13 |
|
14 #define NS_NSINDEXEDTOHTMLCONVERTER_CID \ |
|
15 { 0xcf0f71fd, 0xfafd, 0x4e2b, {0x9f, 0xdc, 0x13, 0x4d, 0x97, 0x2e, 0x16, 0xe2} } |
|
16 |
|
17 class nsIDateTimeFormat; |
|
18 class nsIStringBundle; |
|
19 class nsITextToSubURI; |
|
20 class nsIUnicodeEncoder; |
|
21 |
|
22 class nsIndexedToHTML : public nsIStreamConverter, |
|
23 public nsIDirIndexListener |
|
24 { |
|
25 public: |
|
26 NS_DECL_ISUPPORTS |
|
27 NS_DECL_NSISTREAMCONVERTER |
|
28 NS_DECL_NSIREQUESTOBSERVER |
|
29 NS_DECL_NSISTREAMLISTENER |
|
30 NS_DECL_NSIDIRINDEXLISTENER |
|
31 |
|
32 nsIndexedToHTML(); |
|
33 virtual ~nsIndexedToHTML(); |
|
34 |
|
35 nsresult Init(nsIStreamListener *aListener); |
|
36 |
|
37 static nsresult |
|
38 Create(nsISupports *aOuter, REFNSIID aIID, void **aResult); |
|
39 |
|
40 protected: |
|
41 |
|
42 void FormatSizeString(int64_t inSize, nsCString& outSizeString); |
|
43 nsresult SendToListener(nsIRequest* aRequest, nsISupports *aContext, const nsACString &aBuffer); |
|
44 // Helper to properly implement OnStartRequest |
|
45 nsresult DoOnStartRequest(nsIRequest* request, nsISupports *aContext, |
|
46 nsCString& aBuffer); |
|
47 |
|
48 protected: |
|
49 nsCOMPtr<nsIDirIndexParser> mParser; |
|
50 nsCOMPtr<nsIStreamListener> mListener; // final listener (consumer) |
|
51 |
|
52 nsCOMPtr<nsIDateTimeFormat> mDateTime; |
|
53 nsCOMPtr<nsIStringBundle> mBundle; |
|
54 |
|
55 nsCOMPtr<nsITextToSubURI> mTextToSubURI; |
|
56 nsCOMPtr<nsIUnicodeEncoder> mUnicodeEncoder; |
|
57 |
|
58 private: |
|
59 // Expecting absolute locations, given by 201 lines. |
|
60 bool mExpectAbsLoc; |
|
61 }; |
|
62 |
|
63 #endif |
|
64 |