tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

nsGIOProtocolHandler.h (1059B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 #ifndef nsGIOProtocolHandler_h___
      6 #define nsGIOProtocolHandler_h___
      7 
      8 #include "nsIProtocolHandler.h"
      9 #include "nsIObserver.h"
     10 #include "nsIPrefBranch.h"
     11 #include "nsStringFwd.h"
     12 
     13 #include "mozilla/Logging.h"
     14 extern mozilla::LazyLogModule gGIOLog;
     15 
     16 class nsGIOProtocolHandler final : public nsIProtocolHandler,
     17                                   public nsIObserver {
     18 public:
     19  NS_DECL_ISUPPORTS
     20  NS_DECL_NSIPROTOCOLHANDLER
     21  NS_DECL_NSIOBSERVER
     22 
     23  static already_AddRefed<nsGIOProtocolHandler> GetSingleton();
     24  bool IsSupportedProtocol(const nsCString& aScheme);
     25 
     26 protected:
     27  ~nsGIOProtocolHandler() = default;
     28 
     29 private:
     30  nsresult Init();
     31 
     32  void InitSupportedProtocolsPref(nsIPrefBranch* prefs);
     33 
     34  static mozilla::StaticRefPtr<nsGIOProtocolHandler> sSingleton;
     35  nsTArray<nsCString> mSupportedProtocols;
     36 };
     37 
     38 #endif  // nsGIOProtocolHandler_h___