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
4 : *
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/
9 : *
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
13 : * License.
14 : *
15 : * The Original Code is Mozilla Communicator client code, released
16 : * March 31, 1998.
17 : *
18 : * The Initial Developer of the Original Code is
19 : * Netscape Communications Corporation.
20 : * Portions created by the Initial Developer are Copyright (C) 1998
21 : * the Initial Developer. All Rights Reserved.
22 : *
23 : * Contributor(s):
24 : * Daniel Veditz <dveditz@netscape.com>
25 : *
26 : * Alternatively, the contents of this file may be used under the terms of
27 : * either the GNU General Public License Version 2 or later (the "GPL"), or
28 : * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 : * in which case the provisions of the GPL or the LGPL are applicable instead
30 : * of those above. If you wish to allow use of your version of this file only
31 : * under the terms of either the GPL or the LGPL, and not to allow others to
32 : * use your version of this file under the terms of the MPL, indicate your
33 : * decision by deleting the provisions above and replace them with the notice
34 : * and other provisions required by the GPL or the LGPL. If you do not delete
35 : * the provisions above, a recipient may use your version of this file under
36 : * the terms of any one of the MPL, the GPL or the LGPL.
37 : *
38 : * ***** END LICENSE BLOCK ***** */
39 :
40 : #include <string.h>
41 :
42 : #include "nscore.h"
43 : #include "pratom.h"
44 : #include "prmem.h"
45 : #include "prio.h"
46 : #include "plstr.h"
47 : #include "prlog.h"
48 :
49 : #include "nsIComponentManager.h"
50 : #include "nsIServiceManager.h"
51 : #include "nsCOMPtr.h"
52 : #include "mozilla/ModuleUtils.h"
53 : #include "nsIJARFactory.h"
54 : #include "nsJARProtocolHandler.h"
55 : #include "nsJARURI.h"
56 : #include "nsJAR.h"
57 :
58 3174 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsJAR)
59 2840 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsZipReaderCache)
60 1419 : NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsJARProtocolHandler,
61 1419 : nsJARProtocolHandler::GetSingleton)
62 0 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsJARURI)
63 :
64 : NS_DEFINE_NAMED_CID(NS_ZIPREADER_CID);
65 : NS_DEFINE_NAMED_CID(NS_ZIPREADERCACHE_CID);
66 : NS_DEFINE_NAMED_CID(NS_JARPROTOCOLHANDLER_CID);
67 : NS_DEFINE_NAMED_CID(NS_JARURI_CID);
68 :
69 : static const mozilla::Module::CIDEntry kJARCIDs[] = {
70 : { &kNS_ZIPREADER_CID, false, NULL, nsJARConstructor },
71 : { &kNS_ZIPREADERCACHE_CID, false, NULL, nsZipReaderCacheConstructor },
72 : { &kNS_JARPROTOCOLHANDLER_CID, false, NULL, nsJARProtocolHandlerConstructor },
73 : { &kNS_JARURI_CID, false, NULL, nsJARURIConstructor },
74 : { NULL }
75 : };
76 :
77 : static const mozilla::Module::ContractIDEntry kJARContracts[] = {
78 : { "@mozilla.org/libjar/zip-reader;1", &kNS_ZIPREADER_CID },
79 : { "@mozilla.org/libjar/zip-reader-cache;1", &kNS_ZIPREADERCACHE_CID },
80 : { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "jar", &kNS_JARPROTOCOLHANDLER_CID },
81 : { NULL }
82 : };
83 :
84 : // Jar module shutdown hook
85 1419 : static void nsJarShutdown()
86 : {
87 1419 : NS_IF_RELEASE(gJarHandler);
88 1419 : }
89 :
90 : static const mozilla::Module kJARModule = {
91 : mozilla::Module::kVersion,
92 : kJARCIDs,
93 : kJARContracts,
94 : NULL,
95 : NULL,
96 : NULL,
97 : nsJarShutdown
98 : };
99 :
100 : NSMODULE_DEFN(nsJarModule) = &kJARModule;
|