Bumping manifests a=b2g-bump
[gecko.git] / modules / libjar / nsJARProtocolHandler.h
blob4687be7edd7393462d446d079d4cf503870853f5
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef nsJARProtocolHandler_h__
7 #define nsJARProtocolHandler_h__
9 #include "nsIJARProtocolHandler.h"
10 #include "nsIProtocolHandler.h"
11 #include "nsIJARURI.h"
12 #include "nsIZipReader.h"
13 #include "nsIMIMEService.h"
14 #include "nsWeakReference.h"
15 #include "nsCOMPtr.h"
16 #include "nsClassHashtable.h"
17 #include "nsHashKeys.h"
18 #include "nsTArrayForwardDeclare.h"
20 class nsIHashable;
21 class nsIRemoteOpenFileListener;
23 class nsJARProtocolHandler : public nsIJARProtocolHandler
24 , public nsSupportsWeakReference
26 typedef nsAutoTArray<nsCOMPtr<nsIRemoteOpenFileListener>, 5>
27 RemoteFileListenerArray;
29 public:
30 NS_DECL_THREADSAFE_ISUPPORTS
31 NS_DECL_NSIPROTOCOLHANDLER
32 NS_DECL_NSIJARPROTOCOLHANDLER
34 // nsJARProtocolHandler methods:
35 nsJARProtocolHandler();
37 static nsJARProtocolHandler *GetSingleton();
39 nsresult Init();
41 // returns non addref'ed pointer.
42 nsIMIMEService *MimeService();
43 nsIZipReaderCache *JarCache() { return mJARCache; }
45 bool IsMainProcess() const { return mIsMainProcess; }
47 bool RemoteOpenFileInProgress(nsIHashable *aRemoteFile,
48 nsIRemoteOpenFileListener *aListener);
49 void RemoteOpenFileComplete(nsIHashable *aRemoteFile, nsresult aStatus);
51 protected:
52 virtual ~nsJARProtocolHandler();
54 nsCOMPtr<nsIZipReaderCache> mJARCache;
55 nsCOMPtr<nsIMIMEService> mMimeService;
57 // Holds lists of RemoteOpenFileChild (not including the 1st) that have
58 // requested the same file from parent.
59 nsClassHashtable<nsHashableHashKey, RemoteFileListenerArray>
60 mRemoteFileListeners;
62 bool mIsMainProcess;
65 extern nsJARProtocolHandler *gJarHandler;
67 #define NS_JARPROTOCOLHANDLER_CID \
68 { /* 0xc7e410d4-0x85f2-11d3-9f63-006008a6efe9 */ \
69 0xc7e410d4, \
70 0x85f2, \
71 0x11d3, \
72 {0x9f, 0x63, 0x00, 0x60, 0x08, 0xa6, 0xef, 0xe9} \
75 #endif // !nsJARProtocolHandler_h__