Thu, 15 Jan 2015 15:55:04 +0100
Back out 97036ab72558 which inappropriately compared turds to third parties.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef nsAboutProtocolHandler_h___ |
michael@0 | 7 | #define nsAboutProtocolHandler_h___ |
michael@0 | 8 | |
michael@0 | 9 | #include "nsIProtocolHandler.h" |
michael@0 | 10 | #include "nsSimpleNestedURI.h" |
michael@0 | 11 | #include "mozilla/Attributes.h" |
michael@0 | 12 | |
michael@0 | 13 | class nsIURI; |
michael@0 | 14 | |
michael@0 | 15 | class nsAboutProtocolHandler : public nsIProtocolHandler |
michael@0 | 16 | { |
michael@0 | 17 | public: |
michael@0 | 18 | NS_DECL_ISUPPORTS |
michael@0 | 19 | |
michael@0 | 20 | // nsIProtocolHandler methods: |
michael@0 | 21 | NS_DECL_NSIPROTOCOLHANDLER |
michael@0 | 22 | |
michael@0 | 23 | // nsAboutProtocolHandler methods: |
michael@0 | 24 | nsAboutProtocolHandler() {} |
michael@0 | 25 | virtual ~nsAboutProtocolHandler() {} |
michael@0 | 26 | }; |
michael@0 | 27 | |
michael@0 | 28 | class nsSafeAboutProtocolHandler MOZ_FINAL : public nsIProtocolHandler |
michael@0 | 29 | { |
michael@0 | 30 | public: |
michael@0 | 31 | NS_DECL_ISUPPORTS |
michael@0 | 32 | |
michael@0 | 33 | // nsIProtocolHandler methods: |
michael@0 | 34 | NS_DECL_NSIPROTOCOLHANDLER |
michael@0 | 35 | |
michael@0 | 36 | // nsSafeAboutProtocolHandler methods: |
michael@0 | 37 | nsSafeAboutProtocolHandler() {} |
michael@0 | 38 | |
michael@0 | 39 | private: |
michael@0 | 40 | ~nsSafeAboutProtocolHandler() {} |
michael@0 | 41 | }; |
michael@0 | 42 | |
michael@0 | 43 | |
michael@0 | 44 | // Class to allow us to propagate the base URI to about:blank correctly |
michael@0 | 45 | class nsNestedAboutURI : public nsSimpleNestedURI { |
michael@0 | 46 | public: |
michael@0 | 47 | nsNestedAboutURI(nsIURI* aInnerURI, nsIURI* aBaseURI) |
michael@0 | 48 | : nsSimpleNestedURI(aInnerURI) |
michael@0 | 49 | , mBaseURI(aBaseURI) |
michael@0 | 50 | {} |
michael@0 | 51 | |
michael@0 | 52 | // For use only from deserialization |
michael@0 | 53 | nsNestedAboutURI() : nsSimpleNestedURI() {} |
michael@0 | 54 | |
michael@0 | 55 | virtual ~nsNestedAboutURI() {} |
michael@0 | 56 | |
michael@0 | 57 | // Override QI so we can QI to our CID as needed |
michael@0 | 58 | NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr); |
michael@0 | 59 | |
michael@0 | 60 | // Override StartClone(), the nsISerializable methods, and |
michael@0 | 61 | // GetClassIDNoAlloc; this last is needed to make our nsISerializable impl |
michael@0 | 62 | // work right. |
michael@0 | 63 | virtual nsSimpleURI* StartClone(RefHandlingEnum aRefHandlingMode); |
michael@0 | 64 | NS_IMETHOD Read(nsIObjectInputStream* aStream); |
michael@0 | 65 | NS_IMETHOD Write(nsIObjectOutputStream* aStream); |
michael@0 | 66 | NS_IMETHOD GetClassIDNoAlloc(nsCID *aClassIDNoAlloc); |
michael@0 | 67 | |
michael@0 | 68 | nsIURI* GetBaseURI() const { |
michael@0 | 69 | return mBaseURI; |
michael@0 | 70 | } |
michael@0 | 71 | |
michael@0 | 72 | protected: |
michael@0 | 73 | nsCOMPtr<nsIURI> mBaseURI; |
michael@0 | 74 | }; |
michael@0 | 75 | |
michael@0 | 76 | #endif /* nsAboutProtocolHandler_h___ */ |