Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef nsResProtocolHandler_h___ |
michael@0 | 7 | #define nsResProtocolHandler_h___ |
michael@0 | 8 | |
michael@0 | 9 | #include "nsIResProtocolHandler.h" |
michael@0 | 10 | #include "nsInterfaceHashtable.h" |
michael@0 | 11 | #include "nsWeakReference.h" |
michael@0 | 12 | #include "nsStandardURL.h" |
michael@0 | 13 | |
michael@0 | 14 | class nsIIOService; |
michael@0 | 15 | struct ResourceMapping; |
michael@0 | 16 | |
michael@0 | 17 | // nsResURL : overrides nsStandardURL::GetFile to provide nsIFile resolution |
michael@0 | 18 | class nsResURL : public nsStandardURL |
michael@0 | 19 | { |
michael@0 | 20 | public: |
michael@0 | 21 | nsResURL() : nsStandardURL(true) {} |
michael@0 | 22 | virtual nsStandardURL* StartClone(); |
michael@0 | 23 | virtual nsresult EnsureFile(); |
michael@0 | 24 | NS_IMETHOD GetClassIDNoAlloc(nsCID *aCID); |
michael@0 | 25 | }; |
michael@0 | 26 | |
michael@0 | 27 | class nsResProtocolHandler : public nsIResProtocolHandler, public nsSupportsWeakReference |
michael@0 | 28 | { |
michael@0 | 29 | public: |
michael@0 | 30 | NS_DECL_THREADSAFE_ISUPPORTS |
michael@0 | 31 | NS_DECL_NSIPROTOCOLHANDLER |
michael@0 | 32 | NS_DECL_NSIRESPROTOCOLHANDLER |
michael@0 | 33 | |
michael@0 | 34 | nsResProtocolHandler(); |
michael@0 | 35 | virtual ~nsResProtocolHandler(); |
michael@0 | 36 | |
michael@0 | 37 | nsresult Init(); |
michael@0 | 38 | |
michael@0 | 39 | void CollectSubstitutions(InfallibleTArray<ResourceMapping>& aResources); |
michael@0 | 40 | |
michael@0 | 41 | private: |
michael@0 | 42 | nsresult Init(nsIFile *aOmniJar); |
michael@0 | 43 | nsresult AddSpecialDir(const char* aSpecialDir, const nsACString& aSubstitution); |
michael@0 | 44 | nsInterfaceHashtable<nsCStringHashKey,nsIURI> mSubstitutions; |
michael@0 | 45 | nsCOMPtr<nsIIOService> mIOService; |
michael@0 | 46 | |
michael@0 | 47 | friend class nsResURL; |
michael@0 | 48 | }; |
michael@0 | 49 | |
michael@0 | 50 | #endif /* nsResProtocolHandler_h___ */ |