/src/mozilla-central/netwerk/protocol/file/nsFileChannel.h
Line | Count | Source (jump to first uncovered line) |
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 | | explicit nsFileChannel(nsIURI *uri); |
24 | | |
25 | | nsresult Init(); |
26 | | |
27 | | protected: |
28 | 0 | ~nsFileChannel() = default; |
29 | | |
30 | | // Called to construct a blocking file input stream for the given file. This |
31 | | // method also returns a best guess at the content-type for the data stream. |
32 | | // NOTE: If the channel has a type hint set, contentType will be left |
33 | | // untouched. The caller should not use it in that case. |
34 | | MOZ_MUST_USE nsresult MakeFileInputStream(nsIFile *file, |
35 | | nsCOMPtr<nsIInputStream> &stream, |
36 | | nsCString &contentType, bool async); |
37 | | |
38 | | virtual MOZ_MUST_USE nsresult OpenContentStream(bool async, |
39 | | nsIInputStream **result, |
40 | | nsIChannel** channel) override; |
41 | | |
42 | | private: |
43 | | nsCOMPtr<nsIInputStream> mUploadStream; |
44 | | int64_t mUploadLength; |
45 | | nsCOMPtr<nsIURI> mFileURI; |
46 | | }; |
47 | | |
48 | | #endif // !nsFileChannel_h__ |