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_domarchiveevent_h__ michael@0: #define mozilla_dom_file_domarchiveevent_h__ michael@0: michael@0: #include "ArchiveReader.h" michael@0: michael@0: #include "nsISeekableStream.h" michael@0: #include "nsIMIMEService.h" michael@0: #include "nsDOMFile.h" michael@0: michael@0: #include "FileCommon.h" michael@0: michael@0: BEGIN_FILE_NAMESPACE michael@0: michael@0: /** michael@0: * This class contains all the info needed for a single item michael@0: * It must contain the implementation of the File() method. michael@0: */ michael@0: class ArchiveItem : public nsISupports michael@0: { michael@0: public: michael@0: NS_DECL_THREADSAFE_ISUPPORTS michael@0: michael@0: ArchiveItem(); michael@0: virtual ~ArchiveItem(); michael@0: michael@0: // Getter/Setter for the type michael@0: nsCString GetType(); michael@0: void SetType(const nsCString& aType); michael@0: michael@0: // Getter for the filename michael@0: virtual nsresult GetFilename(nsString& aFilename) = 0; michael@0: michael@0: // Generate a DOMFile michael@0: virtual nsIDOMFile* File(ArchiveReader* aArchiveReader) = 0; michael@0: michael@0: protected: michael@0: nsCString mType; michael@0: }; michael@0: michael@0: /** michael@0: * This class must be extended by any archive format supported by ArchiveReader API michael@0: * This class runs in a different thread and it calls the 'exec()' method. michael@0: * The exec() must populate mFileList and mStatus then it must call RunShare(); michael@0: */ michael@0: class ArchiveReaderEvent : public nsRunnable michael@0: { michael@0: public: michael@0: NS_DECL_NSIRUNNABLE michael@0: michael@0: ArchiveReaderEvent(ArchiveReader* aArchiveReader); michael@0: michael@0: virtual ~ArchiveReaderEvent(); michael@0: michael@0: // This must be implemented michael@0: virtual nsresult Exec() = 0; michael@0: michael@0: protected: michael@0: nsresult GetType(nsCString& aExt, michael@0: nsCString& aMimeType); michael@0: michael@0: nsresult RunShare(nsresult aStatus); michael@0: void ShareMainThread(); michael@0: michael@0: protected: // data michael@0: ArchiveReader* mArchiveReader; michael@0: michael@0: nsCOMPtr mMimeService; michael@0: michael@0: nsTArray > mFileList; // this must be populated michael@0: nsresult mStatus; michael@0: }; michael@0: michael@0: END_FILE_NAMESPACE michael@0: michael@0: #endif // mozilla_dom_file_domarchiveevent_h__ michael@0: