2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* 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/. */
|
1999-09-17 20:12:41 +04:00
|
|
|
|
2003-01-18 05:15:14 +03:00
|
|
|
#ifndef nsJARProtocolHandler_h__
|
|
|
|
#define nsJARProtocolHandler_h__
|
1999-09-17 20:12:41 +04:00
|
|
|
|
1999-11-08 00:55:12 +03:00
|
|
|
#include "nsIJARProtocolHandler.h"
|
1999-09-17 20:12:41 +04:00
|
|
|
#include "nsIProtocolHandler.h"
|
1999-11-08 00:55:12 +03:00
|
|
|
#include "nsIJARURI.h"
|
2000-05-25 12:32:09 +04:00
|
|
|
#include "nsIZipReader.h"
|
2001-11-30 01:29:00 +03:00
|
|
|
#include "nsIMIMEService.h"
|
2001-12-20 06:46:21 +03:00
|
|
|
#include "nsWeakReference.h"
|
2000-05-25 12:32:09 +04:00
|
|
|
#include "nsCOMPtr.h"
|
2013-02-16 02:27:21 +04:00
|
|
|
#include "nsClassHashtable.h"
|
|
|
|
#include "nsHashKeys.h"
|
2014-05-09 05:03:35 +04:00
|
|
|
#include "nsTArrayForwardDeclare.h"
|
2013-02-16 02:27:21 +04:00
|
|
|
|
|
|
|
class nsIHashable;
|
|
|
|
class nsIRemoteOpenFileListener;
|
1999-09-17 20:12:41 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsJARProtocolHandler final : public nsIJARProtocolHandler
|
2015-03-27 21:52:19 +03:00
|
|
|
, public nsSupportsWeakReference
|
1999-09-17 20:12:41 +04:00
|
|
|
{
|
2016-02-02 18:36:30 +03:00
|
|
|
typedef AutoTArray<nsCOMPtr<nsIRemoteOpenFileListener>, 5>
|
2013-02-16 02:27:21 +04:00
|
|
|
RemoteFileListenerArray;
|
|
|
|
|
1999-09-17 20:12:41 +04:00
|
|
|
public:
|
2013-07-19 06:23:44 +04:00
|
|
|
NS_DECL_THREADSAFE_ISUPPORTS
|
2005-09-16 11:09:35 +04:00
|
|
|
NS_DECL_NSIPROTOCOLHANDLER
|
|
|
|
NS_DECL_NSIJARPROTOCOLHANDLER
|
1999-09-17 20:12:41 +04:00
|
|
|
|
|
|
|
// nsJARProtocolHandler methods:
|
|
|
|
nsJARProtocolHandler();
|
|
|
|
|
2005-09-16 11:09:35 +04:00
|
|
|
static nsJARProtocolHandler *GetSingleton();
|
1999-09-17 20:12:41 +04:00
|
|
|
|
|
|
|
nsresult Init();
|
|
|
|
|
2001-11-30 01:29:00 +03:00
|
|
|
// returns non addref'ed pointer.
|
2003-01-18 05:15:14 +03:00
|
|
|
nsIMIMEService *MimeService();
|
|
|
|
nsIZipReaderCache *JarCache() { return mJARCache; }
|
2001-11-30 01:29:00 +03:00
|
|
|
|
2013-02-16 02:27:21 +04:00
|
|
|
bool IsMainProcess() const { return mIsMainProcess; }
|
|
|
|
|
|
|
|
bool RemoteOpenFileInProgress(nsIHashable *aRemoteFile,
|
|
|
|
nsIRemoteOpenFileListener *aListener);
|
|
|
|
void RemoteOpenFileComplete(nsIHashable *aRemoteFile, nsresult aStatus);
|
|
|
|
|
1999-09-17 20:12:41 +04:00
|
|
|
protected:
|
2014-06-25 06:09:14 +04:00
|
|
|
virtual ~nsJARProtocolHandler();
|
|
|
|
|
2000-05-25 12:32:09 +04:00
|
|
|
nsCOMPtr<nsIZipReaderCache> mJARCache;
|
2001-11-30 01:29:00 +03:00
|
|
|
nsCOMPtr<nsIMIMEService> mMimeService;
|
2013-02-16 02:27:21 +04:00
|
|
|
|
|
|
|
// Holds lists of RemoteOpenFileChild (not including the 1st) that have
|
|
|
|
// requested the same file from parent.
|
|
|
|
nsClassHashtable<nsHashableHashKey, RemoteFileListenerArray>
|
|
|
|
mRemoteFileListeners;
|
|
|
|
|
|
|
|
bool mIsMainProcess;
|
1999-09-17 20:12:41 +04:00
|
|
|
};
|
|
|
|
|
2003-01-18 05:15:14 +03:00
|
|
|
extern nsJARProtocolHandler *gJarHandler;
|
|
|
|
|
2004-09-14 22:32:13 +04:00
|
|
|
#define NS_JARPROTOCOLHANDLER_CID \
|
|
|
|
{ /* 0xc7e410d4-0x85f2-11d3-9f63-006008a6efe9 */ \
|
|
|
|
0xc7e410d4, \
|
|
|
|
0x85f2, \
|
|
|
|
0x11d3, \
|
|
|
|
{0x9f, 0x63, 0x00, 0x60, 0x08, 0xa6, 0xef, 0xe9} \
|
|
|
|
}
|
|
|
|
|
2003-01-18 05:15:14 +03:00
|
|
|
#endif // !nsJARProtocolHandler_h__
|