Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
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/. */
6 #ifndef nsAboutProtocolHandler_h___
7 #define nsAboutProtocolHandler_h___
9 #include "nsIProtocolHandler.h"
10 #include "nsSimpleNestedURI.h"
11 #include "mozilla/Attributes.h"
13 class nsIURI;
15 class nsAboutProtocolHandler : public nsIProtocolHandler
16 {
17 public:
18 NS_DECL_ISUPPORTS
20 // nsIProtocolHandler methods:
21 NS_DECL_NSIPROTOCOLHANDLER
23 // nsAboutProtocolHandler methods:
24 nsAboutProtocolHandler() {}
25 virtual ~nsAboutProtocolHandler() {}
26 };
28 class nsSafeAboutProtocolHandler MOZ_FINAL : public nsIProtocolHandler
29 {
30 public:
31 NS_DECL_ISUPPORTS
33 // nsIProtocolHandler methods:
34 NS_DECL_NSIPROTOCOLHANDLER
36 // nsSafeAboutProtocolHandler methods:
37 nsSafeAboutProtocolHandler() {}
39 private:
40 ~nsSafeAboutProtocolHandler() {}
41 };
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 {}
52 // For use only from deserialization
53 nsNestedAboutURI() : nsSimpleNestedURI() {}
55 virtual ~nsNestedAboutURI() {}
57 // Override QI so we can QI to our CID as needed
58 NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
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);
68 nsIURI* GetBaseURI() const {
69 return mBaseURI;
70 }
72 protected:
73 nsCOMPtr<nsIURI> mBaseURI;
74 };
76 #endif /* nsAboutProtocolHandler_h___ */