~ubuntu-branches/ubuntu/precise/kompozer/precise

« back to all changes in this revision

Viewing changes to mozilla/extensions/access-builtin/accessproxy/nsAccessProxyRegistration.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Yarusso
  • Date: 2007-08-27 01:11:03 UTC
  • Revision ID: james.westby@ubuntu.com-20070827011103-2jgf4s6532gqu2ka
Tags: upstream-0.7.10
ImportĀ upstreamĀ versionĀ 0.7.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 
2
 * 
 
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/
 
7
 *
 
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
 
11
 * under the License.
 
12
 *
 
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.
 
16
 *
 
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.
 
26
 *
 
27
 * Contributor(s):
 
28
 */
 
29
 
 
30
#include "nsIGenericFactory.h"
 
31
#include "nsAccessProxy.h"
 
32
#include "nsIServiceManager.h"
 
33
#include "nsIRegistry.h"
 
34
#include "prprf.h"
 
35
#include "nsCRT.h"
 
36
#include "nsICategoryManager.h"
 
37
 
 
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
 
41
// class name.
 
42
//
 
43
// The Registration and Unregistration proc are optional in the structure.
 
44
//
 
45
 
 
46
 
 
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)
 
51
{
 
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.
 
55
 
 
56
  nsresult rv;
 
57
  nsCOMPtr<nsICategoryManager> categoryManager(do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv));
 
58
  if (NS_SUCCEEDED(rv)) 
 
59
    rv = categoryManager->AddCategoryEntry(APPSTARTUP_CATEGORY, "Access Proxy", 
 
60
      "service," NS_ACCESSPROXY_CONTRACTID, PR_TRUE, PR_TRUE, nsnull);
 
61
  return rv;
 
62
}
 
63
 
 
64
 
 
65
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsAccessProxy,nsAccessProxy::GetInstance)
 
66
 
 
67
static void PR_CALLBACK AccessProxyModuleDtor(nsIModule* self)
 
68
{
 
69
    nsAccessProxy::ReleaseInstance();
 
70
}
 
71
 
 
72
static const nsModuleComponentInfo components[] =
 
73
{
 
74
  { "AccessProxy Component", NS_ACCESSPROXY_CID, NS_ACCESSPROXY_CONTRACTID,
 
75
    nsAccessProxyConstructor, nsAccessProxyRegistrationProc,
 
76
    nsnull  // Unregistration proc
 
77
  }
 
78
};
 
79
 
 
80
NS_IMPL_NSGETMODULE_WITH_DTOR(nsAccessProxy, components, AccessProxyModuleDtor)
 
81
 
 
82
 
 
83
 
 
84