MozSrcProtocolHandler.h (1716B)
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 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 MozSrcProtocolHandler_h___ 7 #define MozSrcProtocolHandler_h___ 8 9 #include "nsIProtocolHandler.h" 10 #include "nsISubstitutingProtocolHandler.h" 11 #include "SubstitutingProtocolHandler.h" 12 13 namespace mozilla { 14 namespace net { 15 16 class MozSrcProtocolHandler final : public nsISubstitutingProtocolHandler, 17 public SubstitutingProtocolHandler, 18 public nsSupportsWeakReference { 19 public: 20 NS_DECL_ISUPPORTS_INHERITED 21 NS_FORWARD_NSIPROTOCOLHANDLER(SubstitutingProtocolHandler::) 22 NS_FORWARD_NSISUBSTITUTINGPROTOCOLHANDLER(SubstitutingProtocolHandler::) 23 24 static already_AddRefed<MozSrcProtocolHandler> GetSingleton(); 25 26 MozSrcProtocolHandler(); 27 28 protected: 29 ~MozSrcProtocolHandler() = default; 30 31 [[nodiscard]] virtual bool ResolveSpecialCases(const nsACString& aHost, 32 const nsACString& aPath, 33 const nsACString& aPathname, 34 nsACString& aResult) override; 35 36 [[nodiscard]] nsresult GetSubstitutionInternal(const nsACString& aRoot, 37 nsIURI** aResult) override; 38 39 private: 40 static mozilla::StaticRefPtr<MozSrcProtocolHandler> sSingleton; 41 nsresult Init(); 42 43 nsCString mGREURI; 44 }; 45 46 } // namespace net 47 } // namespace mozilla 48 49 #endif /* MozSrcProtocolHandler_h___ */