1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=2 et sw=2 tw=80: */
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 file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_archivereader_domarchivefile_h__
8 #define mozilla_dom_archivereader_domarchivefile_h__
10 #include "mozilla/Attributes.h"
11 #include "nsDOMFile.h"
13 #include "ArchiveReader.h"
15 #include "ArchiveReaderCommon.h"
16 #include "zipstruct.h"
18 BEGIN_ARCHIVEREADER_NAMESPACE
21 * ArchiveZipFileImpl to DOMFileImpl
23 class ArchiveZipFileImpl
: public DOMFileImplBase
26 NS_DECL_ISUPPORTS_INHERITED
28 ArchiveZipFileImpl(const nsAString
& aName
,
29 const nsAString
& aContentType
,
32 ArchiveReader
* aReader
)
33 : DOMFileImplBase(aName
, aContentType
, aLength
),
35 mArchiveReader(aReader
),
38 NS_ASSERTION(mArchiveReader
, "must have a reader");
39 MOZ_COUNT_CTOR(ArchiveZipFileImpl
);
42 ArchiveZipFileImpl(const nsAString
& aName
,
43 const nsAString
& aContentType
,
47 ArchiveReader
* aReader
)
48 : DOMFileImplBase(aContentType
, aStart
, aLength
),
50 mArchiveReader(aReader
),
53 NS_ASSERTION(mArchiveReader
, "must have a reader");
54 MOZ_COUNT_CTOR(ArchiveZipFileImpl
);
58 virtual nsresult
GetInternalStream(nsIInputStream
**) MOZ_OVERRIDE
;
60 virtual void Unlink() MOZ_OVERRIDE
;
61 virtual void Traverse(nsCycleCollectionTraversalCallback
&aCb
) MOZ_OVERRIDE
;
63 virtual bool IsCCed() const MOZ_OVERRIDE
69 virtual ~ArchiveZipFileImpl()
71 MOZ_COUNT_DTOR(ArchiveZipFileImpl
);
74 virtual already_AddRefed
<nsIDOMBlob
> CreateSlice(uint64_t aStart
,
76 const nsAString
& aContentType
) MOZ_OVERRIDE
;
80 nsRefPtr
<ArchiveReader
> mArchiveReader
;
85 END_ARCHIVEREADER_NAMESPACE
87 #endif // mozilla_dom_archivereader_domarchivefile_h__