sbTemporaryFileServiceModule.cpp
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set sw=2 :miv */
3 /*
4  *=BEGIN SONGBIRD GPL
5  *
6  * This file is part of the Songbird web player.
7  *
8  * Copyright(c) 2005-2010 POTI, Inc.
9  * http://www.songbirdnest.com
10  *
11  * This file may be licensed under the terms of of the
12  * GNU General Public License Version 2 (the ``GPL'').
13  *
14  * Software distributed under the License is distributed
15  * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
16  * express or implied. See the GPL for the specific language
17  * governing rights and limitations.
18  *
19  * You should have received a copy of the GPL along with this
20  * program. If not, go to http://www.gnu.org/licenses/gpl.html
21  * or write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23  *
24  *=END SONGBIRD GPL
25  */
26 
27 //------------------------------------------------------------------------------
28 //------------------------------------------------------------------------------
29 //
30 // Songbird temporary file service module services.
31 //
32 //------------------------------------------------------------------------------
33 //------------------------------------------------------------------------------
34 
41 //------------------------------------------------------------------------------
42 //
43 // Songbird temporary file service module imported services.
44 //
45 //------------------------------------------------------------------------------
46 
47 // Local imports.
48 #include "sbTemporaryFileFactory.h"
49 #include "sbTemporaryFileService.h"
50 
51 // Mozilla imports.
52 #include <nsICategoryManager.h>
53 #include <nsIGenericFactory.h>
54 #include <nsServiceManagerUtils.h>
55 
56 
57 //------------------------------------------------------------------------------
58 //
59 // Songbird temporary file service module temporary file services.
60 //
61 //------------------------------------------------------------------------------
62 
63 // Songbird temporary file service defs.
65 
66 
67 
71 static NS_METHOD
72 sbTemporaryFileServiceRegister(nsIComponentManager* aCompMgr,
73  nsIFile* aPath,
74  const char* aLoaderStr,
75  const char* aType,
76  const nsModuleComponentInfo* aInfo)
77 {
78  nsresult rv;
79 
80  // Get the category manager.
81  nsCOMPtr<nsICategoryManager> categoryManager =
82  do_GetService(NS_CATEGORYMANAGER_CONTRACTID,
83  &rv);
84  NS_ENSURE_SUCCESS(rv, rv);
85 
86  // Add self to the device marshall category.
87  rv = categoryManager->AddCategoryEntry
88  ("app-startup",
91  PR_TRUE,
92  PR_TRUE,
93  nsnull);
94  NS_ENSURE_SUCCESS(rv, rv);
95 
96  return NS_OK;
97 }
98 
99 
104 static NS_METHOD
105 sbTemporaryFileServiceUnregister(nsIComponentManager* aCompMgr,
106  nsIFile* aPath,
107  const char* aLoaderStr,
108  const nsModuleComponentInfo* aInfo)
109 {
110  nsresult rv;
111 
112  // Get the category manager.
113  nsCOMPtr<nsICategoryManager> categoryManager =
114  do_GetService(NS_CATEGORYMANAGER_CONTRACTID,
115  &rv);
116  NS_ENSURE_SUCCESS(rv, rv);
117 
118  // Delete self from the device marshall category.
119  rv = categoryManager->DeleteCategoryEntry("app-startup",
121  PR_TRUE);
122  NS_ENSURE_SUCCESS(rv, rv);
123 
124  return NS_OK;
125 }
126 
127 
128 //------------------------------------------------------------------------------
129 //
130 // Songbird temporary file service module temporary file factory services.
131 //
132 //------------------------------------------------------------------------------
133 
134 // Songbird temporary file factory defs.
136 
137 
138 //------------------------------------------------------------------------------
139 //
140 // Songbird temporary file service module registration services.
141 //
142 //------------------------------------------------------------------------------
143 
144 // Module component information.
145 static nsModuleComponentInfo sbTemporaryFileServiceComponents[] =
146 {
147  // Songbird temporary file service component info.
148  {
152  sbTemporaryFileServiceConstructor,
155  },
156 
157  // Songbird temporary file factory component info.
158  {
162  sbTemporaryFileFactoryConstructor
163  }
164 };
165 
166 // NSGetModule
167 NS_IMPL_NSGETMODULE(sbTemporaryFileServiceModule,
169 
return NS_OK
_updateCookies aPath
static NS_METHOD sbTemporaryFileServiceRegister(nsIComponentManager *aCompMgr, nsIFile *aPath, const char *aLoaderStr, const char *aType, const nsModuleComponentInfo *aInfo)
Register the Songbird temporary file service component.
#define SB_TEMPORARYFILEFACTORY_CID
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(sbMockDeviceFirmwareHandler, Init)
#define SB_TEMPORARYFILEFACTORY_CLASSNAME
#define SB_TEMPORARYFILESERVICE_CLASSNAME
#define SB_TEMPORARYFILEFACTORY_CONTRACTID
NS_IMPL_NSGETMODULE(SongbirdIdentityServiceComponent, sbIdentityServiceComponent)
static nsModuleComponentInfo sbTemporaryFileServiceComponents[]
#define SB_TEMPORARYFILESERVICE_CONTRACTID
Songbird Temporary File Factory Definitions.
Songbird Temporary File Service Definitions.
NS_GENERIC_FACTORY_CONSTRUCTOR(sbMediaSniffer)
#define SB_TEMPORARYFILESERVICE_CID
static NS_METHOD sbTemporaryFileServiceUnregister(nsIComponentManager *aCompMgr, nsIFile *aPath, const char *aLoaderStr, const nsModuleComponentInfo *aInfo)
Unregister the Songbird temporary file service component.