1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
3
* The contents of this file are subject to the Mozilla Public License
4
* Version 1.1 (the "License"); you may not use this file except in
5
* compliance with the License. You may obtain a copy of the License at
6
* http://www.mozilla.org/MPL/
8
* Software distributed under the License is distributed on an "AS IS"
9
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
10
* License for the specific language governing rights and limitations
13
* The Initial Developer of the Original Code is Aaron Leventhal.
14
* Portionsk created by Aaron Leventhal are Copyright (C) 2001
15
* Aaron Leventhal. All Rights Reserved.
17
* Alternatively, the contents of this file may be used under the terms
18
* of the GNU General Public License (the "GPL"), in which case the
19
* provisions of the GPL are applicable instead of those above. If you
20
* wish to allow use of your version of this file only under the terms of
21
* the GPL and not to allow others to use your version of this file under
22
* the MPL, indicate your decision by deleting the provisions above and
23
* replace them with the notice and other provisions required by the
24
* GPL. If you do not delete the provisions above, a recipient may use
25
* your version of this file under either the MPL or the GPL.
30
#include "nsIGenericFactory.h"
31
#include "nsAccessProxy.h"
32
#include "nsIServiceManager.h"
33
#include "nsIRegistry.h"
36
#include "nsICategoryManager.h"
38
////////////////////////////////////////////////////////////////////////
39
// Define a table of CIDs implemented by this module along with other
40
// information like the function to create an instance, contractid, and
43
// The Registration and Unregistration proc are optional in the structure.
47
// This function is called at component registration time
48
static NS_METHOD nsAccessProxyRegistrationProc(nsIComponentManager *aCompMgr,
49
nsIFile *aPath, const char *registryLocation, const char *componentType,
50
const nsModuleComponentInfo *info)
52
// This function performs the extra step of installing us as
53
// an application component. This makes sure that we're
54
// initialized on application startup.
57
nsCOMPtr<nsICategoryManager> categoryManager(do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv));
59
rv = categoryManager->AddCategoryEntry(APPSTARTUP_CATEGORY, "Access Proxy",
60
"service," NS_ACCESSPROXY_CONTRACTID, PR_TRUE, PR_TRUE, nsnull);
65
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsAccessProxy,nsAccessProxy::GetInstance)
67
static void PR_CALLBACK AccessProxyModuleDtor(nsIModule* self)
69
nsAccessProxy::ReleaseInstance();
72
static const nsModuleComponentInfo components[] =
74
{ "AccessProxy Component", NS_ACCESSPROXY_CID, NS_ACCESSPROXY_CONTRACTID,
75
nsAccessProxyConstructor, nsAccessProxyRegistrationProc,
76
nsnull // Unregistration proc
80
NS_IMPL_NSGETMODULE_WITH_DTOR(nsAccessProxy, components, AccessProxyModuleDtor)