michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsAboutProtocolHandler_h___ michael@0: #define nsAboutProtocolHandler_h___ michael@0: michael@0: #include "nsIProtocolHandler.h" michael@0: #include "nsSimpleNestedURI.h" michael@0: #include "mozilla/Attributes.h" michael@0: michael@0: class nsIURI; michael@0: michael@0: class nsAboutProtocolHandler : public nsIProtocolHandler michael@0: { michael@0: public: michael@0: NS_DECL_ISUPPORTS michael@0: michael@0: // nsIProtocolHandler methods: michael@0: NS_DECL_NSIPROTOCOLHANDLER michael@0: michael@0: // nsAboutProtocolHandler methods: michael@0: nsAboutProtocolHandler() {} michael@0: virtual ~nsAboutProtocolHandler() {} michael@0: }; michael@0: michael@0: class nsSafeAboutProtocolHandler MOZ_FINAL : public nsIProtocolHandler michael@0: { michael@0: public: michael@0: NS_DECL_ISUPPORTS michael@0: michael@0: // nsIProtocolHandler methods: michael@0: NS_DECL_NSIPROTOCOLHANDLER michael@0: michael@0: // nsSafeAboutProtocolHandler methods: michael@0: nsSafeAboutProtocolHandler() {} michael@0: michael@0: private: michael@0: ~nsSafeAboutProtocolHandler() {} michael@0: }; michael@0: michael@0: michael@0: // Class to allow us to propagate the base URI to about:blank correctly michael@0: class nsNestedAboutURI : public nsSimpleNestedURI { michael@0: public: michael@0: nsNestedAboutURI(nsIURI* aInnerURI, nsIURI* aBaseURI) michael@0: : nsSimpleNestedURI(aInnerURI) michael@0: , mBaseURI(aBaseURI) michael@0: {} michael@0: michael@0: // For use only from deserialization michael@0: nsNestedAboutURI() : nsSimpleNestedURI() {} michael@0: michael@0: virtual ~nsNestedAboutURI() {} michael@0: michael@0: // Override QI so we can QI to our CID as needed michael@0: NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr); michael@0: michael@0: // Override StartClone(), the nsISerializable methods, and michael@0: // GetClassIDNoAlloc; this last is needed to make our nsISerializable impl michael@0: // work right. michael@0: virtual nsSimpleURI* StartClone(RefHandlingEnum aRefHandlingMode); michael@0: NS_IMETHOD Read(nsIObjectInputStream* aStream); michael@0: NS_IMETHOD Write(nsIObjectOutputStream* aStream); michael@0: NS_IMETHOD GetClassIDNoAlloc(nsCID *aClassIDNoAlloc); michael@0: michael@0: nsIURI* GetBaseURI() const { michael@0: return mBaseURI; michael@0: } michael@0: michael@0: protected: michael@0: nsCOMPtr mBaseURI; michael@0: }; michael@0: michael@0: #endif /* nsAboutProtocolHandler_h___ */