1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
24 * Alternatively, the contents of this file may be used under the terms of
25 * either of the GNU General Public License Version 2 or later (the "GPL"),
26 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
38 #include "nsIGenericFactory.h"
39 #include "nsICategoryManager.h"
40 #include "nsNetUtil.h"
41 #include "nsXPIDLString.h"
42 #include "nsDirectoryViewer.h"
48 #ifdef SUITE_USING_XPFE_DM
49 #include "nsDownloadManager.h"
50 #include "nsDownloadProxy.h"
53 #if !defined(MOZ_MACBROWSER)
54 #include "nsBrowserStatusFilter.h"
55 #include "nsBrowserInstance.h"
57 #include "nsCURILoader.h"
58 #include "nsXPFEComponentsCID.h"
61 // Factory constructors
62 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsHTTPIndex
, Init
)
64 NS_GENERIC_FACTORY_CONSTRUCTOR(nsDirectoryViewerFactory
)
66 #if !defined(MOZ_MACBROWSER)
67 NS_GENERIC_FACTORY_CONSTRUCTOR(nsBrowserStatusFilter
)
68 NS_GENERIC_FACTORY_CONSTRUCTOR(nsBrowserInstance
)
71 #ifdef SUITE_USING_XPFE_DM
72 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsDownloadManager
, Init
)
73 NS_GENERIC_FACTORY_CONSTRUCTOR(nsDownloadProxy
)
77 RegisterProc(nsIComponentManager
*aCompMgr
,
79 const char *registryLocation
,
80 const char *componentType
,
81 const nsModuleComponentInfo
*info
)
84 nsCOMPtr
<nsICategoryManager
> catman
= do_GetService(NS_CATEGORYMANAGER_CONTRACTID
, &rv
);
85 if (NS_FAILED(rv
)) return rv
;
87 // add the MIME types layotu can handle to the handlers category.
88 // this allows users of layout's viewers (the docshell for example)
89 // to query the types of viewers layout can create.
90 return catman
->AddCategoryEntry("Gecko-Content-Viewers", "application/http-index-format",
91 "@mozilla.org/xpfe/http-index-format-factory-constructor",
92 PR_TRUE
, PR_TRUE
, nsnull
);
96 UnregisterProc(nsIComponentManager
*aCompMgr
,
98 const char *registryLocation
,
99 const nsModuleComponentInfo
*info
)
102 nsCOMPtr
<nsICategoryManager
> catman
= do_GetService(NS_CATEGORYMANAGER_CONTRACTID
, &rv
);
103 if (NS_FAILED(rv
)) return rv
;
105 return catman
->DeleteCategoryEntry("Gecko-Content-Viewers",
106 "application/http-index-format", PR_TRUE
);
109 static const nsModuleComponentInfo components
[] = {
110 { "Directory Viewer", NS_DIRECTORYVIEWERFACTORY_CID
,
111 "@mozilla.org/xpfe/http-index-format-factory-constructor",
112 nsDirectoryViewerFactoryConstructor
, RegisterProc
, UnregisterProc
},
114 { "Directory Viewer", NS_HTTPINDEX_SERVICE_CID
, NS_HTTPINDEX_SERVICE_CONTRACTID
,
115 nsHTTPIndexConstructor
},
116 { "Directory Viewer", NS_HTTPINDEX_SERVICE_CID
, NS_HTTPINDEX_DATASOURCE_CONTRACTID
,
117 nsHTTPIndexConstructor
},
120 #ifdef SUITE_USING_XPFE_DM
121 { "Download Manager", NS_DOWNLOADMANAGER_CID
, NS_DOWNLOADMANAGER_CONTRACTID
,
122 nsDownloadManagerConstructor
},
123 { "Download", NS_DOWNLOAD_CID
, NS_TRANSFER_CONTRACTID
,
124 nsDownloadProxyConstructor
},
127 #if !defined(MOZ_MACBROWSER)
128 { NS_BROWSERSTATUSFILTER_CLASSNAME
,
129 NS_BROWSERSTATUSFILTER_CID
,
130 NS_BROWSERSTATUSFILTER_CONTRACTID
,
131 nsBrowserStatusFilterConstructor
133 { "nsBrowserInstance",
134 NS_BROWSERINSTANCE_CID
,
135 NS_BROWSERINSTANCE_CONTRACTID
,
136 nsBrowserInstanceConstructor
142 NS_IMPL_NSGETMODULE(application
, components
)