1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/netwerk/protocol/res/nsResProtocolHandler.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,50 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef nsResProtocolHandler_h___ 1.10 +#define nsResProtocolHandler_h___ 1.11 + 1.12 +#include "nsIResProtocolHandler.h" 1.13 +#include "nsInterfaceHashtable.h" 1.14 +#include "nsWeakReference.h" 1.15 +#include "nsStandardURL.h" 1.16 + 1.17 +class nsIIOService; 1.18 +struct ResourceMapping; 1.19 + 1.20 +// nsResURL : overrides nsStandardURL::GetFile to provide nsIFile resolution 1.21 +class nsResURL : public nsStandardURL 1.22 +{ 1.23 +public: 1.24 + nsResURL() : nsStandardURL(true) {} 1.25 + virtual nsStandardURL* StartClone(); 1.26 + virtual nsresult EnsureFile(); 1.27 + NS_IMETHOD GetClassIDNoAlloc(nsCID *aCID); 1.28 +}; 1.29 + 1.30 +class nsResProtocolHandler : public nsIResProtocolHandler, public nsSupportsWeakReference 1.31 +{ 1.32 +public: 1.33 + NS_DECL_THREADSAFE_ISUPPORTS 1.34 + NS_DECL_NSIPROTOCOLHANDLER 1.35 + NS_DECL_NSIRESPROTOCOLHANDLER 1.36 + 1.37 + nsResProtocolHandler(); 1.38 + virtual ~nsResProtocolHandler(); 1.39 + 1.40 + nsresult Init(); 1.41 + 1.42 + void CollectSubstitutions(InfallibleTArray<ResourceMapping>& aResources); 1.43 + 1.44 +private: 1.45 + nsresult Init(nsIFile *aOmniJar); 1.46 + nsresult AddSpecialDir(const char* aSpecialDir, const nsACString& aSubstitution); 1.47 + nsInterfaceHashtable<nsCStringHashKey,nsIURI> mSubstitutions; 1.48 + nsCOMPtr<nsIIOService> mIOService; 1.49 + 1.50 + friend class nsResURL; 1.51 +}; 1.52 + 1.53 +#endif /* nsResProtocolHandler_h___ */