diff -r 000000000000 -r 6474c204b198 xpfe/components/directory/nsDirectoryViewer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xpfe/components/directory/nsDirectoryViewer.h Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,120 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef nsdirectoryviewer__h____ +#define nsdirectoryviewer__h____ + +#include "nsNetUtil.h" +#include "nsIStreamListener.h" +#include "nsIContentViewer.h" +#include "nsIHTTPIndex.h" +#include "nsIRDFService.h" +#include "nsIRDFDataSource.h" +#include "nsIRDFLiteral.h" +#include "nsIDocumentLoaderFactory.h" +#include "nsITimer.h" +#include "nsISupportsArray.h" +#include "nsXPIDLString.h" +#include "nsIDirIndexListener.h" +#include "nsIFTPChannel.h" +#include "nsCycleCollectionParticipant.h" + +class nsDirectoryViewerFactory : public nsIDocumentLoaderFactory +{ +public: + nsDirectoryViewerFactory(); + virtual ~nsDirectoryViewerFactory(); + + // nsISupports interface + NS_DECL_ISUPPORTS + NS_DECL_NSIDOCUMENTLOADERFACTORY +}; + +class nsHTTPIndex : public nsIHTTPIndex, + public nsIRDFDataSource, + public nsIStreamListener, + public nsIDirIndexListener, + public nsIInterfaceRequestor, + public nsIFTPEventSink +{ +private: + + // note: these are NOT statics due to the native of nsHTTPIndex + // where it may or may not be treated as a singleton + + nsCOMPtr kNC_Child; + nsCOMPtr kNC_Comment; + nsCOMPtr kNC_Loading; + nsCOMPtr kNC_URL; + nsCOMPtr kNC_Description; + nsCOMPtr kNC_ContentLength; + nsCOMPtr kNC_LastModified; + nsCOMPtr kNC_ContentType; + nsCOMPtr kNC_FileType; + nsCOMPtr kNC_IsContainer; + nsCOMPtr kTrueLiteral; + nsCOMPtr kFalseLiteral; + + nsCOMPtr mDirRDF; + +protected: + // We grab a reference to the content viewer container (which + // indirectly owns us) so that we can insert ourselves as a global + // in the script context _after_ the XUL doc has been embedded into + // content viewer. We'll know that this has happened once we receive + // an OnStartRequest() notification + + nsCOMPtr mInner; + nsCOMPtr mConnectionList; + nsCOMPtr mNodeList; + nsCOMPtr mTimer; + nsCOMPtr mParser; + nsCString mBaseURL; + nsCString mEncoding; + bool mBindToGlobalObject; + nsIInterfaceRequestor* mRequestor; // WEAK + nsCOMPtr mDirectory; + + nsHTTPIndex(nsIInterfaceRequestor* aRequestor); + nsresult CommonInit(void); + nsresult Init(nsIURI* aBaseURL); + void GetDestination(nsIRDFResource* r, nsXPIDLCString& dest); + bool isWellknownContainerURI(nsIRDFResource *r); + nsresult AddElement(nsIRDFResource *parent, nsIRDFResource *prop, + nsIRDFNode *child); + + static void FireTimer(nsITimer* aTimer, void* aClosure); + +public: + nsHTTPIndex(); + virtual ~nsHTTPIndex(); + nsresult Init(void); + + static nsresult Create(nsIURI* aBaseURI, nsIInterfaceRequestor* aContainer, + nsIHTTPIndex** aResult); + + // nsIHTTPIndex interface + NS_DECL_NSIHTTPINDEX + + // NSIRDFDataSource interface + NS_DECL_NSIRDFDATASOURCE + + NS_DECL_NSIREQUESTOBSERVER + NS_DECL_NSISTREAMLISTENER + + NS_DECL_NSIDIRINDEXLISTENER + NS_DECL_NSIINTERFACEREQUESTOR + NS_DECL_NSIFTPEVENTSINK + + // nsISupports interface + NS_DECL_CYCLE_COLLECTING_ISUPPORTS + NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsHTTPIndex, nsIHTTPIndex) +}; + +// {82776710-5690-11d3-BE36-00104BDE6048} +#define NS_DIRECTORYVIEWERFACTORY_CID \ +{ 0x82776710, 0x5690, 0x11d3, { 0xbe, 0x36, 0x0, 0x10, 0x4b, 0xde, 0x60, 0x48 } } + +#endif // nsdirectoryviewer__h____