netwerk/protocol/about/nsAboutProtocolHandler.h

branch
TOR_BUG_9701
changeset 11
deefc01c0e14
equal deleted inserted replaced
-1:000000000000 0:005a3591d009
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 nsAboutProtocolHandler_h___
7 #define nsAboutProtocolHandler_h___
8
9 #include "nsIProtocolHandler.h"
10 #include "nsSimpleNestedURI.h"
11 #include "mozilla/Attributes.h"
12
13 class nsIURI;
14
15 class nsAboutProtocolHandler : public nsIProtocolHandler
16 {
17 public:
18 NS_DECL_ISUPPORTS
19
20 // nsIProtocolHandler methods:
21 NS_DECL_NSIPROTOCOLHANDLER
22
23 // nsAboutProtocolHandler methods:
24 nsAboutProtocolHandler() {}
25 virtual ~nsAboutProtocolHandler() {}
26 };
27
28 class nsSafeAboutProtocolHandler MOZ_FINAL : public nsIProtocolHandler
29 {
30 public:
31 NS_DECL_ISUPPORTS
32
33 // nsIProtocolHandler methods:
34 NS_DECL_NSIPROTOCOLHANDLER
35
36 // nsSafeAboutProtocolHandler methods:
37 nsSafeAboutProtocolHandler() {}
38
39 private:
40 ~nsSafeAboutProtocolHandler() {}
41 };
42
43
44 // Class to allow us to propagate the base URI to about:blank correctly
45 class nsNestedAboutURI : public nsSimpleNestedURI {
46 public:
47 nsNestedAboutURI(nsIURI* aInnerURI, nsIURI* aBaseURI)
48 : nsSimpleNestedURI(aInnerURI)
49 , mBaseURI(aBaseURI)
50 {}
51
52 // For use only from deserialization
53 nsNestedAboutURI() : nsSimpleNestedURI() {}
54
55 virtual ~nsNestedAboutURI() {}
56
57 // Override QI so we can QI to our CID as needed
58 NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
59
60 // Override StartClone(), the nsISerializable methods, and
61 // GetClassIDNoAlloc; this last is needed to make our nsISerializable impl
62 // work right.
63 virtual nsSimpleURI* StartClone(RefHandlingEnum aRefHandlingMode);
64 NS_IMETHOD Read(nsIObjectInputStream* aStream);
65 NS_IMETHOD Write(nsIObjectOutputStream* aStream);
66 NS_IMETHOD GetClassIDNoAlloc(nsCID *aClassIDNoAlloc);
67
68 nsIURI* GetBaseURI() const {
69 return mBaseURI;
70 }
71
72 protected:
73 nsCOMPtr<nsIURI> mBaseURI;
74 };
75
76 #endif /* nsAboutProtocolHandler_h___ */

mercurial