dom/file/ArchiveEvent.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* vim: set ts=2 et sw=2 tw=80: */
michael@0 3 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
michael@0 5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #ifndef mozilla_dom_file_domarchiveevent_h__
michael@0 8 #define mozilla_dom_file_domarchiveevent_h__
michael@0 9
michael@0 10 #include "ArchiveReader.h"
michael@0 11
michael@0 12 #include "nsISeekableStream.h"
michael@0 13 #include "nsIMIMEService.h"
michael@0 14 #include "nsDOMFile.h"
michael@0 15
michael@0 16 #include "FileCommon.h"
michael@0 17
michael@0 18 BEGIN_FILE_NAMESPACE
michael@0 19
michael@0 20 /**
michael@0 21 * This class contains all the info needed for a single item
michael@0 22 * It must contain the implementation of the File() method.
michael@0 23 */
michael@0 24 class ArchiveItem : public nsISupports
michael@0 25 {
michael@0 26 public:
michael@0 27 NS_DECL_THREADSAFE_ISUPPORTS
michael@0 28
michael@0 29 ArchiveItem();
michael@0 30 virtual ~ArchiveItem();
michael@0 31
michael@0 32 // Getter/Setter for the type
michael@0 33 nsCString GetType();
michael@0 34 void SetType(const nsCString& aType);
michael@0 35
michael@0 36 // Getter for the filename
michael@0 37 virtual nsresult GetFilename(nsString& aFilename) = 0;
michael@0 38
michael@0 39 // Generate a DOMFile
michael@0 40 virtual nsIDOMFile* File(ArchiveReader* aArchiveReader) = 0;
michael@0 41
michael@0 42 protected:
michael@0 43 nsCString mType;
michael@0 44 };
michael@0 45
michael@0 46 /**
michael@0 47 * This class must be extended by any archive format supported by ArchiveReader API
michael@0 48 * This class runs in a different thread and it calls the 'exec()' method.
michael@0 49 * The exec() must populate mFileList and mStatus then it must call RunShare();
michael@0 50 */
michael@0 51 class ArchiveReaderEvent : public nsRunnable
michael@0 52 {
michael@0 53 public:
michael@0 54 NS_DECL_NSIRUNNABLE
michael@0 55
michael@0 56 ArchiveReaderEvent(ArchiveReader* aArchiveReader);
michael@0 57
michael@0 58 virtual ~ArchiveReaderEvent();
michael@0 59
michael@0 60 // This must be implemented
michael@0 61 virtual nsresult Exec() = 0;
michael@0 62
michael@0 63 protected:
michael@0 64 nsresult GetType(nsCString& aExt,
michael@0 65 nsCString& aMimeType);
michael@0 66
michael@0 67 nsresult RunShare(nsresult aStatus);
michael@0 68 void ShareMainThread();
michael@0 69
michael@0 70 protected: // data
michael@0 71 ArchiveReader* mArchiveReader;
michael@0 72
michael@0 73 nsCOMPtr<nsIMIMEService> mMimeService;
michael@0 74
michael@0 75 nsTArray<nsRefPtr<ArchiveItem> > mFileList; // this must be populated
michael@0 76 nsresult mStatus;
michael@0 77 };
michael@0 78
michael@0 79 END_FILE_NAMESPACE
michael@0 80
michael@0 81 #endif // mozilla_dom_file_domarchiveevent_h__
michael@0 82

mercurial