1 /* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 * The contents of this file are subject to the Mozilla Public License Version
5 * 1.1 (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 * http://www.mozilla.org/MPL/
9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 * for the specific language governing rights and limitations under the
14 * The Original Code is Mozilla Communicator client code, released
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.
23 * Dave Townsend <dtownsend@oxymoronical.com>
25 * Alternatively, the contents of this file may be used under the terms of
26 * either of the GNU General Public License Version 2 or later (the "GPL"),
27 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
37 * ***** END LICENSE BLOCK ***** */
40 #include "nsIGenericFactory.h"
41 #include "nsIFactory.h"
42 #include "nsISupports.h"
43 #include "nsIComponentManager.h"
44 #include "nsIComponentRegistrar.h"
45 #include "nsIServiceManager.h"
46 #include "nsICategoryManager.h"
47 #include "nsIScriptNameSpaceManager.h"
48 #include "nsCURILoader.h"
50 #include "nsSoftwareUpdateIIDs.h"
52 #include "nsInstallTrigger.h"
53 #include "nsXPInstallManager.h"
55 //----------------------------------------------------------------------
57 // Functions used to create new instances of a given object by the
60 NS_GENERIC_FACTORY_CONSTRUCTOR(nsInstallTrigger
)
61 NS_GENERIC_FACTORY_CONSTRUCTOR(nsXPInstallManager
)
63 //----------------------------------------------------------------------
66 RegisterInstallTrigger( nsIComponentManager
*aCompMgr
,
68 const char *registryLocation
,
69 const char *componentType
,
70 const nsModuleComponentInfo
*info
)
74 nsCOMPtr
<nsICategoryManager
> catman
=
75 do_GetService(NS_CATEGORYMANAGER_CONTRACTID
, &rv
);
76 NS_ENSURE_SUCCESS(rv
, rv
);
78 nsXPIDLCString previous
;
79 rv
= catman
->AddCategoryEntry(JAVASCRIPT_GLOBAL_PROPERTY_CATEGORY
,
81 NS_INSTALLTRIGGERCOMPONENT_CONTRACTID
,
82 PR_TRUE
, PR_TRUE
, getter_Copies(previous
));
83 NS_ENSURE_SUCCESS(rv
, rv
);
89 // The list of components we register
90 static const nsModuleComponentInfo components
[] =
92 { "InstallTrigger Component",
93 NS_SoftwareUpdateInstallTrigger_CID
,
94 NS_INSTALLTRIGGERCOMPONENT_CONTRACTID
,
95 nsInstallTriggerConstructor
,
96 RegisterInstallTrigger
99 { "XPInstall Content Handler",
100 NS_SoftwareUpdateInstallTrigger_CID
,
101 NS_CONTENT_HANDLER_CONTRACTID_PREFIX
"application/x-xpinstall",
102 nsInstallTriggerConstructor
105 { "XPInstallManager Component",
106 NS_XPInstallManager_CID
,
107 NS_XPINSTALLMANAGERCOMPONENT_CONTRACTID
,
108 nsXPInstallManagerConstructor
112 NS_IMPL_NSGETMODULE(nsSoftwareUpdate
, components
)