nsJARProtocolHandler.h (1549B)
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 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/. */ 5 6 #ifndef nsJARProtocolHandler_h__ 7 #define nsJARProtocolHandler_h__ 8 9 #include "mozilla/StaticPtr.h" 10 #include "nsIProtocolHandler.h" 11 #include "nsIZipReader.h" 12 #include "nsIMIMEService.h" 13 #include "nsWeakReference.h" 14 #include "nsCOMPtr.h" 15 16 class nsJARProtocolHandler final : public nsIProtocolHandler, 17 public nsSupportsWeakReference { 18 public: 19 NS_DECL_THREADSAFE_ISUPPORTS 20 NS_DECL_NSIPROTOCOLHANDLER 21 22 // nsJARProtocolHandler methods: 23 nsJARProtocolHandler(); 24 25 static already_AddRefed<nsJARProtocolHandler> GetSingleton(); 26 27 nsresult Init(); 28 29 // returns non addref'ed pointer. 30 nsIMIMEService* MimeService(); 31 nsIZipReaderCache* JarCache() const { return mJARCache; } 32 33 protected: 34 virtual ~nsJARProtocolHandler(); 35 36 nsCOMPtr<nsIZipReaderCache> mJARCache; 37 nsCOMPtr<nsIMIMEService> mMimeService; 38 }; 39 40 extern mozilla::StaticRefPtr<nsJARProtocolHandler> gJarHandler; 41 42 #define NS_JARPROTOCOLHANDLER_CID \ 43 {/* 0xc7e410d4-0x85f2-11d3-9f63-006008a6efe9 */ \ 44 0xc7e410d4, \ 45 0x85f2, \ 46 0x11d3, \ 47 {0x9f, 0x63, 0x00, 0x60, 0x08, 0xa6, 0xef, 0xe9}} 48 49 #endif // !nsJARProtocolHandler_h__