michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim: set ts=2 et sw=2 tw=80: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_dom_file_domarchivefile_h__ michael@0: #define mozilla_dom_file_domarchivefile_h__ michael@0: michael@0: #include "mozilla/Attributes.h" michael@0: #include "nsDOMFile.h" michael@0: michael@0: #include "ArchiveReader.h" michael@0: michael@0: #include "FileCommon.h" michael@0: #include "zipstruct.h" michael@0: michael@0: BEGIN_FILE_NAMESPACE michael@0: michael@0: /** michael@0: * ZipFile to DOMFileCC michael@0: */ michael@0: class ArchiveZipFile : public nsDOMFileCC michael@0: { michael@0: public: michael@0: ArchiveZipFile(const nsAString& aName, michael@0: const nsAString& aContentType, michael@0: uint64_t aLength, michael@0: ZipCentral& aCentral, michael@0: ArchiveReader* aReader) michael@0: : nsDOMFileCC(aName, aContentType, aLength), michael@0: mCentral(aCentral), michael@0: mArchiveReader(aReader), michael@0: mFilename(aName) michael@0: { michael@0: NS_ASSERTION(mArchiveReader, "must have a reader"); michael@0: MOZ_COUNT_CTOR(ArchiveZipFile); michael@0: } michael@0: michael@0: ArchiveZipFile(const nsAString& aName, michael@0: const nsAString& aContentType, michael@0: uint64_t aStart, michael@0: uint64_t aLength, michael@0: ZipCentral& aCentral, michael@0: ArchiveReader* aReader) michael@0: : nsDOMFileCC(aContentType, aStart, aLength), michael@0: mCentral(aCentral), michael@0: mArchiveReader(aReader), michael@0: mFilename(aName) michael@0: { michael@0: NS_ASSERTION(mArchiveReader, "must have a reader"); michael@0: MOZ_COUNT_CTOR(ArchiveZipFile); michael@0: } michael@0: michael@0: virtual ~ArchiveZipFile() michael@0: { michael@0: MOZ_COUNT_DTOR(ArchiveZipFile); michael@0: } michael@0: michael@0: // Overrides: michael@0: NS_IMETHOD GetInternalStream(nsIInputStream**) MOZ_OVERRIDE; michael@0: michael@0: NS_DECL_ISUPPORTS_INHERITED michael@0: NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ArchiveZipFile, nsDOMFileCC) michael@0: michael@0: protected: michael@0: virtual already_AddRefed CreateSlice(uint64_t aStart, michael@0: uint64_t aLength, michael@0: const nsAString& aContentType) MOZ_OVERRIDE; michael@0: michael@0: private: // Data michael@0: ZipCentral mCentral; michael@0: nsRefPtr mArchiveReader; michael@0: michael@0: nsString mFilename; michael@0: }; michael@0: michael@0: END_FILE_NAMESPACE michael@0: michael@0: #endif // mozilla_dom_file_domarchivefile_h__