LCOV - code coverage report
Current view: top level - netwerk/protocol/about - nsAboutProtocolHandler.h (source / functions) Hit Total Coverage
Test: output.info Lines: 9 12 75.0 %
Date: 2017-07-14 16:53:18 Functions: 6 10 60.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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 "nsWeakReference.h"
      12             : #include "mozilla/Attributes.h"
      13             : 
      14             : class nsIURI;
      15             : 
      16             : namespace mozilla {
      17             : namespace net {
      18             : 
      19             : class nsAboutProtocolHandler : public nsIProtocolHandlerWithDynamicFlags
      20             :                              , public nsIProtocolHandler
      21             :                              , public nsSupportsWeakReference
      22             : {
      23             : public:
      24             :     NS_DECL_ISUPPORTS
      25             : 
      26             :     // nsIProtocolHandler methods:
      27             :     NS_DECL_NSIPROTOCOLHANDLER
      28             :     NS_DECL_NSIPROTOCOLHANDLERWITHDYNAMICFLAGS
      29             : 
      30             :     // nsAboutProtocolHandler methods:
      31           3 :     nsAboutProtocolHandler() {}
      32             : 
      33             : private:
      34           0 :     virtual ~nsAboutProtocolHandler() {}
      35             : };
      36             : 
      37             : class nsSafeAboutProtocolHandler final : public nsIProtocolHandler
      38             :                                        , public nsSupportsWeakReference
      39             : {
      40             : public:
      41             :     NS_DECL_ISUPPORTS
      42             : 
      43             :     // nsIProtocolHandler methods:
      44             :     NS_DECL_NSIPROTOCOLHANDLER
      45             : 
      46             :     // nsSafeAboutProtocolHandler methods:
      47           3 :     nsSafeAboutProtocolHandler() {}
      48             : 
      49             : private:
      50           0 :     ~nsSafeAboutProtocolHandler() {}
      51             : };
      52             : 
      53             : 
      54             : // Class to allow us to propagate the base URI to about:blank correctly
      55             : class nsNestedAboutURI : public nsSimpleNestedURI {
      56             : public:
      57          32 :     nsNestedAboutURI(nsIURI* aInnerURI, nsIURI* aBaseURI)
      58          32 :         : nsSimpleNestedURI(aInnerURI)
      59          32 :         , mBaseURI(aBaseURI)
      60          32 :     {}
      61             : 
      62             :     // For use only from deserialization
      63           0 :     nsNestedAboutURI() : nsSimpleNestedURI() {}
      64             : 
      65          15 :     virtual ~nsNestedAboutURI() {}
      66             : 
      67             :     // Override QI so we can QI to our CID as needed
      68             :     NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
      69             : 
      70             :     // Override StartClone(), the nsISerializable methods, and
      71             :     // GetClassIDNoAlloc; this last is needed to make our nsISerializable impl
      72             :     // work right.
      73             :     virtual nsSimpleURI* StartClone(RefHandlingEnum aRefHandlingMode,
      74             :                                     const nsACString& newRef);
      75             :     NS_IMETHOD Read(nsIObjectInputStream* aStream);
      76             :     NS_IMETHOD Write(nsIObjectOutputStream* aStream);
      77             :     NS_IMETHOD GetClassIDNoAlloc(nsCID *aClassIDNoAlloc);
      78             : 
      79           6 :     nsIURI* GetBaseURI() const {
      80           6 :         return mBaseURI;
      81             :     }
      82             : 
      83             : protected:
      84             :     nsCOMPtr<nsIURI> mBaseURI;
      85             : };
      86             : 
      87             : } // namespace net
      88             : } // namespace mozilla
      89             : 
      90             : #endif /* nsAboutProtocolHandler_h___ */

Generated by: LCOV version 1.13