netwerk/protocol/res/nsResProtocolHandler.h

branch
TOR_BUG_9701
changeset 14
925c144e1f1f
equal deleted inserted replaced
-1:000000000000 0:1baab07b434e
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/. */
5
6 #ifndef nsResProtocolHandler_h___
7 #define nsResProtocolHandler_h___
8
9 #include "nsIResProtocolHandler.h"
10 #include "nsInterfaceHashtable.h"
11 #include "nsWeakReference.h"
12 #include "nsStandardURL.h"
13
14 class nsIIOService;
15 struct ResourceMapping;
16
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 };
26
27 class nsResProtocolHandler : public nsIResProtocolHandler, public nsSupportsWeakReference
28 {
29 public:
30 NS_DECL_THREADSAFE_ISUPPORTS
31 NS_DECL_NSIPROTOCOLHANDLER
32 NS_DECL_NSIRESPROTOCOLHANDLER
33
34 nsResProtocolHandler();
35 virtual ~nsResProtocolHandler();
36
37 nsresult Init();
38
39 void CollectSubstitutions(InfallibleTArray<ResourceMapping>& aResources);
40
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;
46
47 friend class nsResURL;
48 };
49
50 #endif /* nsResProtocolHandler_h___ */

mercurial