Bumping gaia.json for 2 gaia revision(s) a=gaia-bump
[gecko.git] / dom / archivereader / ArchiveZipFile.h
blobdfede39fca857647842e0a3a5f48b2236514613e
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
20 /**
21 * ArchiveZipFileImpl to DOMFileImpl
23 class ArchiveZipFileImpl : public DOMFileImplBase
25 public:
26 NS_DECL_ISUPPORTS_INHERITED
28 ArchiveZipFileImpl(const nsAString& aName,
29 const nsAString& aContentType,
30 uint64_t aLength,
31 ZipCentral& aCentral,
32 ArchiveReader* aReader)
33 : DOMFileImplBase(aName, aContentType, aLength),
34 mCentral(aCentral),
35 mArchiveReader(aReader),
36 mFilename(aName)
38 NS_ASSERTION(mArchiveReader, "must have a reader");
39 MOZ_COUNT_CTOR(ArchiveZipFileImpl);
42 ArchiveZipFileImpl(const nsAString& aName,
43 const nsAString& aContentType,
44 uint64_t aStart,
45 uint64_t aLength,
46 ZipCentral& aCentral,
47 ArchiveReader* aReader)
48 : DOMFileImplBase(aContentType, aStart, aLength),
49 mCentral(aCentral),
50 mArchiveReader(aReader),
51 mFilename(aName)
53 NS_ASSERTION(mArchiveReader, "must have a reader");
54 MOZ_COUNT_CTOR(ArchiveZipFileImpl);
57 // Overrides:
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
65 return true;
68 protected:
69 virtual ~ArchiveZipFileImpl()
71 MOZ_COUNT_DTOR(ArchiveZipFileImpl);
74 virtual already_AddRefed<nsIDOMBlob> CreateSlice(uint64_t aStart,
75 uint64_t aLength,
76 const nsAString& aContentType) MOZ_OVERRIDE;
78 private: // Data
79 ZipCentral mCentral;
80 nsRefPtr<ArchiveReader> mArchiveReader;
82 nsString mFilename;
85 END_ARCHIVEREADER_NAMESPACE
87 #endif // mozilla_dom_archivereader_domarchivefile_h__