2012-07-27 17:21:34 -07: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/. */
|
|
|
|
|
2014-05-07 07:32:12 -07:00
|
|
|
#ifndef mozilla_dom_archivereader_domarchivefile_h__
|
|
|
|
#define mozilla_dom_archivereader_domarchivefile_h__
|
2012-07-27 17:21:34 -07:00
|
|
|
|
2013-06-05 09:15:48 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2014-10-08 11:40:59 -07:00
|
|
|
#include "mozilla/ErrorResult.h"
|
2014-10-08 09:15:23 -07:00
|
|
|
#include "mozilla/dom/File.h"
|
2012-07-27 17:21:34 -07:00
|
|
|
|
|
|
|
#include "ArchiveReader.h"
|
|
|
|
|
2014-05-07 07:32:12 -07:00
|
|
|
#include "ArchiveReaderCommon.h"
|
2012-07-27 17:21:34 -07:00
|
|
|
#include "zipstruct.h"
|
|
|
|
|
2014-05-07 07:32:12 -07:00
|
|
|
BEGIN_ARCHIVEREADER_NAMESPACE
|
2012-07-27 17:21:34 -07:00
|
|
|
|
2012-11-06 15:23:13 -08:00
|
|
|
/**
|
2014-10-08 09:15:23 -07:00
|
|
|
* ArchiveZipFileImpl to FileImpl
|
2012-11-06 15:23:13 -08:00
|
|
|
*/
|
2014-10-08 09:15:23 -07:00
|
|
|
class ArchiveZipFileImpl : public FileImplBase
|
2012-07-27 17:21:34 -07:00
|
|
|
{
|
|
|
|
public:
|
2014-06-26 20:46:34 -07:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
2014-06-26 09:47:44 -07:00
|
|
|
ArchiveZipFileImpl(const nsAString& aName,
|
|
|
|
const nsAString& aContentType,
|
|
|
|
uint64_t aLength,
|
|
|
|
ZipCentral& aCentral,
|
|
|
|
ArchiveReader* aReader)
|
2014-10-08 09:15:23 -07:00
|
|
|
: FileImplBase(aName, aContentType, aLength),
|
2012-07-27 17:21:34 -07:00
|
|
|
mCentral(aCentral),
|
|
|
|
mArchiveReader(aReader),
|
|
|
|
mFilename(aName)
|
|
|
|
{
|
|
|
|
NS_ASSERTION(mArchiveReader, "must have a reader");
|
2014-06-26 09:47:44 -07:00
|
|
|
MOZ_COUNT_CTOR(ArchiveZipFileImpl);
|
2012-07-27 17:21:34 -07:00
|
|
|
}
|
|
|
|
|
2014-06-26 09:47:44 -07:00
|
|
|
ArchiveZipFileImpl(const nsAString& aName,
|
|
|
|
const nsAString& aContentType,
|
|
|
|
uint64_t aStart,
|
|
|
|
uint64_t aLength,
|
|
|
|
ZipCentral& aCentral,
|
|
|
|
ArchiveReader* aReader)
|
2014-10-08 09:15:23 -07:00
|
|
|
: FileImplBase(aContentType, aStart, aLength),
|
2012-07-27 17:21:34 -07:00
|
|
|
mCentral(aCentral),
|
|
|
|
mArchiveReader(aReader),
|
|
|
|
mFilename(aName)
|
|
|
|
{
|
|
|
|
NS_ASSERTION(mArchiveReader, "must have a reader");
|
2014-06-26 09:47:44 -07:00
|
|
|
MOZ_COUNT_CTOR(ArchiveZipFileImpl);
|
2012-08-08 11:11:15 -07:00
|
|
|
}
|
|
|
|
|
2012-07-27 17:21:34 -07:00
|
|
|
// Overrides:
|
2014-06-26 09:47:44 -07:00
|
|
|
virtual nsresult GetInternalStream(nsIInputStream**) MOZ_OVERRIDE;
|
2012-07-27 17:21:34 -07:00
|
|
|
|
2014-06-26 09:47:44 -07:00
|
|
|
virtual void Unlink() MOZ_OVERRIDE;
|
|
|
|
virtual void Traverse(nsCycleCollectionTraversalCallback &aCb) MOZ_OVERRIDE;
|
2012-07-27 17:21:34 -07:00
|
|
|
|
2014-06-26 20:46:34 -07:00
|
|
|
virtual bool IsCCed() const MOZ_OVERRIDE
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-07-27 17:21:34 -07:00
|
|
|
protected:
|
2014-07-08 14:23:17 -07:00
|
|
|
virtual ~ArchiveZipFileImpl()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_DTOR(ArchiveZipFileImpl);
|
|
|
|
}
|
|
|
|
|
2014-10-08 09:15:23 -07:00
|
|
|
virtual already_AddRefed<FileImpl>
|
2014-10-08 09:15:22 -07:00
|
|
|
CreateSlice(uint64_t aStart, uint64_t aLength, const nsAString& aContentType,
|
2014-10-08 12:39:25 -07:00
|
|
|
mozilla::ErrorResult& aRv) MOZ_OVERRIDE;
|
2012-07-27 17:21:34 -07:00
|
|
|
|
|
|
|
private: // Data
|
|
|
|
ZipCentral mCentral;
|
|
|
|
nsRefPtr<ArchiveReader> mArchiveReader;
|
|
|
|
|
|
|
|
nsString mFilename;
|
|
|
|
};
|
|
|
|
|
2014-05-07 07:32:12 -07:00
|
|
|
END_ARCHIVEREADER_NAMESPACE
|
2012-07-27 17:21:34 -07:00
|
|
|
|
2014-05-07 07:32:12 -07:00
|
|
|
#endif // mozilla_dom_archivereader_domarchivefile_h__
|