netwerk/protocol/file/nsFileChannel.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/netwerk/protocol/file/nsFileChannel.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,41 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* vim:set ts=2 sw=2 sts=2 et cin: */
     1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#ifndef nsFileChannel_h__
    1.11 +#define nsFileChannel_h__
    1.12 +
    1.13 +#include "nsBaseChannel.h"
    1.14 +#include "nsIFileChannel.h"
    1.15 +#include "nsIUploadChannel.h"
    1.16 +
    1.17 +class nsFileChannel : public nsBaseChannel
    1.18 +                    , public nsIFileChannel
    1.19 +                    , public nsIUploadChannel
    1.20 +{
    1.21 +public: 
    1.22 +  NS_DECL_ISUPPORTS_INHERITED
    1.23 +  NS_DECL_NSIFILECHANNEL
    1.24 +  NS_DECL_NSIUPLOADCHANNEL
    1.25 +
    1.26 +  nsFileChannel(nsIURI *uri);
    1.27 +
    1.28 +protected:
    1.29 +  // Called to construct a blocking file input stream for the given file.  This
    1.30 +  // method also returns a best guess at the content-type for the data stream.
    1.31 +  // NOTE: If the channel has a type hint set, contentType will be left
    1.32 +  // untouched. The caller should not use it in that case.
    1.33 +  nsresult MakeFileInputStream(nsIFile *file, nsCOMPtr<nsIInputStream> &stream,
    1.34 +                               nsCString &contentType, bool async);
    1.35 +
    1.36 +  virtual nsresult OpenContentStream(bool async, nsIInputStream **result,
    1.37 +                                     nsIChannel** channel);
    1.38 +
    1.39 +private:
    1.40 +  nsCOMPtr<nsIInputStream> mUploadStream;
    1.41 +  int64_t mUploadLength;
    1.42 +};
    1.43 +
    1.44 +#endif // !nsFileChannel_h__

mercurial