2012-07-28 04:21:34 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_dom_file_domarchivefile_h__
|
|
|
|
#define mozilla_dom_file_domarchivefile_h__
|
|
|
|
|
2013-06-05 20:15:48 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2012-07-28 04:21:34 +04:00
|
|
|
#include "nsDOMFile.h"
|
|
|
|
|
|
|
|
#include "ArchiveReader.h"
|
|
|
|
|
|
|
|
#include "FileCommon.h"
|
|
|
|
#include "zipstruct.h"
|
|
|
|
|
|
|
|
BEGIN_FILE_NAMESPACE
|
|
|
|
|
2012-11-07 03:23:13 +04:00
|
|
|
/**
|
|
|
|
* ZipFile to DOMFileCC
|
|
|
|
*/
|
2012-07-28 04:21:34 +04:00
|
|
|
class ArchiveZipFile : public nsDOMFileCC
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ArchiveZipFile(const nsAString& aName,
|
|
|
|
const nsAString& aContentType,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint64_t aLength,
|
2012-07-28 04:21:34 +04:00
|
|
|
ZipCentral& aCentral,
|
|
|
|
ArchiveReader* aReader)
|
|
|
|
: nsDOMFileCC(aName, aContentType, aLength),
|
|
|
|
mCentral(aCentral),
|
|
|
|
mArchiveReader(aReader),
|
|
|
|
mFilename(aName)
|
|
|
|
{
|
|
|
|
NS_ASSERTION(mArchiveReader, "must have a reader");
|
2012-08-08 22:11:15 +04:00
|
|
|
MOZ_COUNT_CTOR(ArchiveZipFile);
|
2012-07-28 04:21:34 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
ArchiveZipFile(const nsAString& aName,
|
|
|
|
const nsAString& aContentType,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint64_t aStart,
|
|
|
|
uint64_t aLength,
|
2012-07-28 04:21:34 +04:00
|
|
|
ZipCentral& aCentral,
|
|
|
|
ArchiveReader* aReader)
|
|
|
|
: nsDOMFileCC(aContentType, aStart, aLength),
|
|
|
|
mCentral(aCentral),
|
|
|
|
mArchiveReader(aReader),
|
|
|
|
mFilename(aName)
|
|
|
|
{
|
|
|
|
NS_ASSERTION(mArchiveReader, "must have a reader");
|
2012-08-08 22:11:15 +04:00
|
|
|
MOZ_COUNT_CTOR(ArchiveZipFile);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual ~ArchiveZipFile()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_DTOR(ArchiveZipFile);
|
2012-07-28 04:21:34 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Overrides:
|
2013-06-05 20:15:48 +04:00
|
|
|
NS_IMETHOD GetInternalStream(nsIInputStream**) MOZ_OVERRIDE;
|
2012-07-28 04:21:34 +04:00
|
|
|
|
2013-03-01 03:09:59 +04:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ArchiveZipFile, nsDOMFileCC)
|
2012-07-28 04:21:34 +04:00
|
|
|
|
|
|
|
protected:
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual already_AddRefed<nsIDOMBlob> CreateSlice(uint64_t aStart,
|
|
|
|
uint64_t aLength,
|
2013-06-05 20:15:48 +04:00
|
|
|
const nsAString& aContentType) MOZ_OVERRIDE;
|
2012-07-28 04:21:34 +04:00
|
|
|
|
|
|
|
private: // Data
|
|
|
|
ZipCentral mCentral;
|
|
|
|
nsRefPtr<ArchiveReader> mArchiveReader;
|
|
|
|
|
|
|
|
nsString mFilename;
|
|
|
|
};
|
|
|
|
|
|
|
|
END_FILE_NAMESPACE
|
|
|
|
|
|
|
|
#endif // mozilla_dom_file_domarchivefile_h__
|