/src/mozilla-central/netwerk/protocol/res/nsResProtocolHandler.h
Line | Count | Source (jump to first uncovered line) |
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 "SubstitutingProtocolHandler.h" |
10 | | |
11 | | #include "nsIResProtocolHandler.h" |
12 | | #include "nsInterfaceHashtable.h" |
13 | | #include "nsWeakReference.h" |
14 | | #include "nsStandardURL.h" |
15 | | |
16 | | class nsISubstitutionObserver; |
17 | | |
18 | | struct SubstitutionMapping; |
19 | | class nsResProtocolHandler final : public nsIResProtocolHandler, |
20 | | public mozilla::net::SubstitutingProtocolHandler, |
21 | | public nsSupportsWeakReference |
22 | | { |
23 | | public: |
24 | | NS_DECL_ISUPPORTS_INHERITED |
25 | | NS_DECL_NSIRESPROTOCOLHANDLER |
26 | | |
27 | | NS_FORWARD_NSIPROTOCOLHANDLER(mozilla::net::SubstitutingProtocolHandler::) |
28 | | |
29 | | nsResProtocolHandler() |
30 | | : mozilla::net::SubstitutingProtocolHandler("resource", URI_STD | |
31 | | URI_IS_UI_RESOURCE | |
32 | | URI_IS_LOCAL_RESOURCE | |
33 | | URI_IS_POTENTIALLY_TRUSTWORTHY, |
34 | | /* aEnforceFileOrJar = */ false) |
35 | 3 | {} |
36 | | |
37 | | MOZ_MUST_USE nsresult Init(); |
38 | | |
39 | | NS_IMETHOD SetSubstitution(const nsACString& aRoot, nsIURI* aBaseURI) override; |
40 | | NS_IMETHOD SetSubstitutionWithFlags(const nsACString& aRoot, nsIURI* aBaseURI, uint32_t aFlags) override; |
41 | | |
42 | | NS_IMETHOD GetSubstitution(const nsACString& aRoot, nsIURI** aResult) override |
43 | 0 | { |
44 | 0 | return mozilla::net::SubstitutingProtocolHandler::GetSubstitution(aRoot, aResult); |
45 | 0 | } |
46 | | |
47 | | NS_IMETHOD HasSubstitution(const nsACString& aRoot, bool* aResult) override |
48 | 0 | { |
49 | 0 | return mozilla::net::SubstitutingProtocolHandler::HasSubstitution(aRoot, aResult); |
50 | 0 | } |
51 | | |
52 | | NS_IMETHOD ResolveURI(nsIURI *aResURI, nsACString& aResult) override |
53 | 8 | { |
54 | 8 | return mozilla::net::SubstitutingProtocolHandler::ResolveURI(aResURI, aResult); |
55 | 8 | } |
56 | | |
57 | | NS_IMETHOD AddObserver(nsISubstitutionObserver *aObserver) override |
58 | 0 | { |
59 | 0 | return mozilla::net::SubstitutingProtocolHandler::AddObserver(aObserver); |
60 | 0 | } |
61 | | |
62 | | NS_IMETHOD RemoveObserver(nsISubstitutionObserver *aObserver) override |
63 | 0 | { |
64 | 0 | return mozilla::net::SubstitutingProtocolHandler::RemoveObserver(aObserver); |
65 | 0 | } |
66 | | |
67 | | protected: |
68 | | MOZ_MUST_USE nsresult GetSubstitutionInternal(const nsACString& aRoot, nsIURI** aResult, uint32_t* aFlags) override; |
69 | 0 | virtual ~nsResProtocolHandler() = default; |
70 | | |
71 | | MOZ_MUST_USE bool ResolveSpecialCases(const nsACString& aHost, |
72 | | const nsACString& aPath, |
73 | | const nsACString& aPathname, |
74 | | nsACString& aResult) override; |
75 | | |
76 | | private: |
77 | | nsCString mAppURI; |
78 | | nsCString mGREURI; |
79 | | }; |
80 | | |
81 | | #endif /* nsResProtocolHandler_h___ */ |