tor-browser

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

nsViewSourceHandler.h (1503B)


      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 nsViewSourceHandler_h___
      7 #define nsViewSourceHandler_h___
      8 
      9 #include "nsIProtocolHandler.h"
     10 #include "nsNetUtil.h"
     11 
     12 class nsILoadInfo;
     13 
     14 namespace mozilla {
     15 namespace net {
     16 
     17 class nsViewSourceHandler final : public nsIProtocolHandlerWithDynamicFlags,
     18                                  public nsIProtocolHandler {
     19 public:
     20  NS_DECL_ISUPPORTS
     21  NS_DECL_NSIPROTOCOLHANDLER
     22  NS_DECL_NSIPROTOCOLHANDLERWITHDYNAMICFLAGS
     23 
     24  nsViewSourceHandler();
     25 
     26  // Creates a new nsViewSourceChannel to view the source of an about:srcdoc
     27  // URI with contents specified by srcdoc.
     28  [[nodiscard]] nsresult NewSrcdocChannel(nsIURI* aURI, nsIURI* aBaseURI,
     29                                          const nsAString& aSrcdoc,
     30                                          nsILoadInfo* aLoadInfo,
     31                                          nsIChannel** outChannel);
     32 
     33  static nsViewSourceHandler* GetInstance();
     34 
     35  static nsresult CreateNewURI(const nsACString& aSpec, const char* aCharset,
     36                               nsIURI* aBaseURI, nsIURI** aResult);
     37 
     38 private:
     39  ~nsViewSourceHandler();
     40 
     41  static nsViewSourceHandler* gInstance;
     42 };
     43 
     44 }  // namespace net
     45 }  // namespace mozilla
     46 
     47 #endif /* !defined( nsViewSourceHandler_h___ ) */