LCOV - code coverage report
Current view: top level - xpfe/components/directory - nsDirectoryViewer.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 1 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 7 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; 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 nsdirectoryviewer__h____
       7             : #define nsdirectoryviewer__h____
       8             : 
       9             : #include "nsCOMPtr.h"
      10             : #include "nsIStreamListener.h"
      11             : #include "nsIContentViewer.h"
      12             : #include "nsIHTTPIndex.h"
      13             : #include "nsIRDFService.h"
      14             : #include "nsIRDFDataSource.h"
      15             : #include "nsIRDFLiteral.h"
      16             : #include "nsIDocumentLoaderFactory.h"
      17             : #include "nsITimer.h"
      18             : #include "nsXPIDLString.h"
      19             : #include "nsIDirIndexListener.h"
      20             : #include "nsIFTPChannel.h"
      21             : #include "nsCycleCollectionParticipant.h"
      22             : #include "nsIInterfaceRequestor.h"
      23             : #include "nsIURI.h"
      24             : 
      25             : class nsIMutableArray;
      26             : 
      27             : class nsDirectoryViewerFactory : public nsIDocumentLoaderFactory
      28             : {
      29             : public:
      30             :     nsDirectoryViewerFactory();
      31             : 
      32             :     // nsISupports interface
      33             :     NS_DECL_ISUPPORTS
      34             :     NS_DECL_NSIDOCUMENTLOADERFACTORY
      35             : 
      36             : protected:
      37             :     virtual ~nsDirectoryViewerFactory();
      38             : };
      39             : 
      40             : class nsHTTPIndex final : public nsIHTTPIndex,
      41             :                           public nsIRDFDataSource,
      42             :                           public nsIStreamListener,
      43             :                           public nsIDirIndexListener,
      44             :                           public nsIInterfaceRequestor,
      45             :                           public nsIFTPEventSink
      46             : {
      47             : private:
      48             : 
      49             :     // note: these are NOT statics due to the native of nsHTTPIndex
      50             :     // where it may or may not be treated as a singleton
      51             : 
      52             :     nsCOMPtr<nsIRDFResource>     kNC_Child;
      53             :     nsCOMPtr<nsIRDFResource>     kNC_Comment;
      54             :     nsCOMPtr<nsIRDFResource>     kNC_Loading;
      55             :     nsCOMPtr<nsIRDFResource>     kNC_URL;
      56             :     nsCOMPtr<nsIRDFResource>     kNC_Description;
      57             :     nsCOMPtr<nsIRDFResource>     kNC_ContentLength;
      58             :     nsCOMPtr<nsIRDFResource>     kNC_LastModified;
      59             :     nsCOMPtr<nsIRDFResource>     kNC_ContentType;
      60             :     nsCOMPtr<nsIRDFResource>     kNC_FileType;
      61             :     nsCOMPtr<nsIRDFResource>     kNC_IsContainer;
      62             :     nsCOMPtr<nsIRDFLiteral>      kTrueLiteral;
      63             :     nsCOMPtr<nsIRDFLiteral>      kFalseLiteral;
      64             : 
      65             :     nsCOMPtr<nsIRDFService>      mDirRDF;
      66             : 
      67             : protected:
      68             :     // We grab a reference to the content viewer container (which
      69             :     // indirectly owns us) so that we can insert ourselves as a global
      70             :     // in the script context _after_ the XUL doc has been embedded into
      71             :     // content viewer. We'll know that this has happened once we receive
      72             :     // an OnStartRequest() notification
      73             : 
      74             :     nsCOMPtr<nsIRDFDataSource>   mInner;
      75             :     nsCOMPtr<nsIMutableArray>    mConnectionList;
      76             :     nsCOMPtr<nsIMutableArray>    mNodeList;
      77             :     nsCOMPtr<nsITimer>           mTimer;
      78             :     nsCOMPtr<nsIDirIndexParser>  mParser;
      79             :     nsCString mBaseURL;
      80             :     nsCString                    mEncoding;
      81             :     bool                         mBindToGlobalObject;
      82             :     nsIInterfaceRequestor*       mRequestor; // WEAK
      83             :     nsCOMPtr<nsIRDFResource>     mDirectory;
      84             : 
      85             :     explicit nsHTTPIndex(nsIInterfaceRequestor* aRequestor);
      86             :     nsresult CommonInit(void);
      87             :     nsresult Init(nsIURI* aBaseURL);
      88             :     void        GetDestination(nsIRDFResource* r, nsXPIDLCString& dest);
      89             :     bool        isWellknownContainerURI(nsIRDFResource *r);
      90             :     nsresult    AddElement(nsIRDFResource *parent, nsIRDFResource *prop,
      91             :                            nsIRDFNode *child);
      92             : 
      93             :     static void FireTimer(nsITimer* aTimer, void* aClosure);
      94             : 
      95             :     virtual ~nsHTTPIndex();
      96             : 
      97             : public:
      98             :     nsHTTPIndex();
      99             :     nsresult Init(void);
     100             : 
     101             :     static nsresult Create(nsIURI* aBaseURI, nsIInterfaceRequestor* aContainer,
     102             :                            nsIHTTPIndex** aResult);
     103             : 
     104             :     // nsIHTTPIndex interface
     105             :     NS_DECL_NSIHTTPINDEX
     106             : 
     107             :     // NSIRDFDataSource interface
     108             :     NS_DECL_NSIRDFDATASOURCE
     109             : 
     110             :     NS_DECL_NSIREQUESTOBSERVER
     111             :     NS_DECL_NSISTREAMLISTENER
     112             : 
     113             :     NS_DECL_NSIDIRINDEXLISTENER
     114             :     NS_DECL_NSIINTERFACEREQUESTOR
     115             :     NS_DECL_NSIFTPEVENTSINK
     116             : 
     117             :     // nsISupports interface
     118             :     NS_DECL_CYCLE_COLLECTING_ISUPPORTS
     119           0 :     NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsHTTPIndex, nsIHTTPIndex)
     120             : };
     121             : 
     122             : // {82776710-5690-11d3-BE36-00104BDE6048}
     123             : #define NS_DIRECTORYVIEWERFACTORY_CID \
     124             : { 0x82776710, 0x5690, 0x11d3, { 0xbe, 0x36, 0x0, 0x10, 0x4b, 0xde, 0x60, 0x48 } }
     125             : 
     126             : #endif // nsdirectoryviewer__h____

Generated by: LCOV version 1.13