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 #include "mozilla/Attributes.h"
12 
13 class nsILoadInfo;
14 
15 namespace mozilla {
16 namespace net {
17 
18 class nsViewSourceHandler final : public nsIProtocolHandler
19 {
20 public:
21     NS_DECL_ISUPPORTS
22     NS_DECL_NSIPROTOCOLHANDLER
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     nsresult NewSrcdocChannel(nsIURI *aURI,
29                               nsIURI *aBaseURI,
30                               const nsAString &aSrcdoc,
31                               nsILoadInfo *aLoadInfo,
32                               nsIChannel** outChannel);
33 
34     static nsViewSourceHandler* GetInstance();
35 
36 private:
37     ~nsViewSourceHandler();
38 
39     static nsViewSourceHandler* gInstance;
40 };
41 
42 } // namespace net
43 } // namespace mozilla
44 
45 #endif /* !defined( nsViewSourceHandler_h___ ) */
46