michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 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 michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsResProtocolHandler_h___ michael@0: #define nsResProtocolHandler_h___ michael@0: michael@0: #include "nsIResProtocolHandler.h" michael@0: #include "nsInterfaceHashtable.h" michael@0: #include "nsWeakReference.h" michael@0: #include "nsStandardURL.h" michael@0: michael@0: class nsIIOService; michael@0: struct ResourceMapping; michael@0: michael@0: // nsResURL : overrides nsStandardURL::GetFile to provide nsIFile resolution michael@0: class nsResURL : public nsStandardURL michael@0: { michael@0: public: michael@0: nsResURL() : nsStandardURL(true) {} michael@0: virtual nsStandardURL* StartClone(); michael@0: virtual nsresult EnsureFile(); michael@0: NS_IMETHOD GetClassIDNoAlloc(nsCID *aCID); michael@0: }; michael@0: michael@0: class nsResProtocolHandler : public nsIResProtocolHandler, public nsSupportsWeakReference michael@0: { michael@0: public: michael@0: NS_DECL_THREADSAFE_ISUPPORTS michael@0: NS_DECL_NSIPROTOCOLHANDLER michael@0: NS_DECL_NSIRESPROTOCOLHANDLER michael@0: michael@0: nsResProtocolHandler(); michael@0: virtual ~nsResProtocolHandler(); michael@0: michael@0: nsresult Init(); michael@0: michael@0: void CollectSubstitutions(InfallibleTArray& aResources); michael@0: michael@0: private: michael@0: nsresult Init(nsIFile *aOmniJar); michael@0: nsresult AddSpecialDir(const char* aSpecialDir, const nsACString& aSubstitution); michael@0: nsInterfaceHashtable mSubstitutions; michael@0: nsCOMPtr mIOService; michael@0: michael@0: friend class nsResURL; michael@0: }; michael@0: michael@0: #endif /* nsResProtocolHandler_h___ */