Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
1 /* -*- Mode: C++; tab-width: 2; 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 nsResProtocolHandler_h___
7 #define nsResProtocolHandler_h___
9 #include "nsIResProtocolHandler.h"
10 #include "nsInterfaceHashtable.h"
11 #include "nsWeakReference.h"
12 #include "nsStandardURL.h"
14 class nsIIOService;
15 struct ResourceMapping;
17 // nsResURL : overrides nsStandardURL::GetFile to provide nsIFile resolution
18 class nsResURL : public nsStandardURL
19 {
20 public:
21 nsResURL() : nsStandardURL(true) {}
22 virtual nsStandardURL* StartClone();
23 virtual nsresult EnsureFile();
24 NS_IMETHOD GetClassIDNoAlloc(nsCID *aCID);
25 };
27 class nsResProtocolHandler : public nsIResProtocolHandler, public nsSupportsWeakReference
28 {
29 public:
30 NS_DECL_THREADSAFE_ISUPPORTS
31 NS_DECL_NSIPROTOCOLHANDLER
32 NS_DECL_NSIRESPROTOCOLHANDLER
34 nsResProtocolHandler();
35 virtual ~nsResProtocolHandler();
37 nsresult Init();
39 void CollectSubstitutions(InfallibleTArray<ResourceMapping>& aResources);
41 private:
42 nsresult Init(nsIFile *aOmniJar);
43 nsresult AddSpecialDir(const char* aSpecialDir, const nsACString& aSubstitution);
44 nsInterfaceHashtable<nsCStringHashKey,nsIURI> mSubstitutions;
45 nsCOMPtr<nsIIOService> mIOService;
47 friend class nsResURL;
48 };
50 #endif /* nsResProtocolHandler_h___ */