|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* vim:set ts=2 sw=2 sts=2 et cin: */ |
|
3 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
4 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
6 |
|
7 #ifndef nsFileChannel_h__ |
|
8 #define nsFileChannel_h__ |
|
9 |
|
10 #include "nsBaseChannel.h" |
|
11 #include "nsIFileChannel.h" |
|
12 #include "nsIUploadChannel.h" |
|
13 |
|
14 class nsFileChannel : public nsBaseChannel |
|
15 , public nsIFileChannel |
|
16 , public nsIUploadChannel |
|
17 { |
|
18 public: |
|
19 NS_DECL_ISUPPORTS_INHERITED |
|
20 NS_DECL_NSIFILECHANNEL |
|
21 NS_DECL_NSIUPLOADCHANNEL |
|
22 |
|
23 nsFileChannel(nsIURI *uri); |
|
24 |
|
25 protected: |
|
26 // Called to construct a blocking file input stream for the given file. This |
|
27 // method also returns a best guess at the content-type for the data stream. |
|
28 // NOTE: If the channel has a type hint set, contentType will be left |
|
29 // untouched. The caller should not use it in that case. |
|
30 nsresult MakeFileInputStream(nsIFile *file, nsCOMPtr<nsIInputStream> &stream, |
|
31 nsCString &contentType, bool async); |
|
32 |
|
33 virtual nsresult OpenContentStream(bool async, nsIInputStream **result, |
|
34 nsIChannel** channel); |
|
35 |
|
36 private: |
|
37 nsCOMPtr<nsIInputStream> mUploadStream; |
|
38 int64_t mUploadLength; |
|
39 }; |
|
40 |
|
41 #endif // !nsFileChannel_h__ |