sbDirectoryProviderModule.cpp
Go to the documentation of this file.
1 /*
2  *=BEGIN SONGBIRD GPL
3  *
4  * This file is part of the Songbird web player.
5  *
6  * Copyright(c) 2005-2009 POTI, Inc.
7  * http://www.songbirdnest.com
8  *
9  * This file may be licensed under the terms of of the
10  * GNU General Public License Version 2 (the ``GPL'').
11  *
12  * Software distributed under the License is distributed
13  * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
14  * express or implied. See the GPL for the specific language
15  * governing rights and limitations.
16  *
17  * You should have received a copy of the GPL along with this
18  * program. If not, go to http://www.gnu.org/licenses/gpl.html
19  * or write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  *
22  *=END SONGBIRD GPL
23  */
24 
25 #include "sbDirectoryProvider.h"
26 
27 #include <nsCOMPtr.h>
28 #include <nsServiceManagerUtils.h>
29 #include <nsIGenericFactory.h>
30 #include <nsICategoryManager.h>
31 
33 
34 
38 static NS_METHOD
39 sbDirectoryProviderRegister(nsIComponentManager* aCompMgr,
40  nsIFile* aPath,
41  const char* aLoaderStr,
42  const char* aType,
43  const nsModuleComponentInfo* aInfo)
44 {
45  nsresult rv;
46 
47  // Get the category manager.
48  nsCOMPtr<nsICategoryManager> categoryManager =
49  do_GetService(NS_CATEGORYMANAGER_CONTRACTID,
50  &rv);
51  NS_ENSURE_SUCCESS(rv, rv);
52 
53  // Add self to the app-startup category.
54  rv = categoryManager->AddCategoryEntry
55  ("app-startup",
58  PR_TRUE,
59  PR_TRUE,
60  nsnull);
61  NS_ENSURE_SUCCESS(rv, rv);
62 
63  return NS_OK;
64 }
65 
66 
71 static NS_METHOD
72 sbDirectoryProviderUnregister(nsIComponentManager* aCompMgr,
73  nsIFile* aPath,
74  const char* aLoaderStr,
75  const nsModuleComponentInfo* aInfo)
76 {
77  nsresult rv;
78 
79  // Get the category manager.
80  nsCOMPtr<nsICategoryManager> categoryManager =
81  do_GetService(NS_CATEGORYMANAGER_CONTRACTID,
82  &rv);
83  NS_ENSURE_SUCCESS(rv, rv);
84 
85  // Delete self from the app-startup category.
86  rv = categoryManager->DeleteCategoryEntry("app-startup",
88  PR_TRUE);
89  NS_ENSURE_SUCCESS(rv, rv);
90 
91  return NS_OK;
92 }
93 
94 // fill out data struct to register with component system
95 static const nsModuleComponentInfo components[] =
96 {
97  {
101  sbDirectoryProviderConstructor,
104  }
105 };
106 
107 // create the module info struct that is used to register
108 NS_IMPL_NSGETMODULE(sbDirectoryProviderModule, components)
return NS_OK
_updateCookies aPath
static NS_METHOD sbDirectoryProviderRegister(nsIComponentManager *aCompMgr, nsIFile *aPath, const char *aLoaderStr, const char *aType, const nsModuleComponentInfo *aInfo)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(sbMockDeviceFirmwareHandler, Init)
#define SONGBIRD_DIRECTORY_PROVIDER_CLASSNAME
function Init()
static NS_METHOD sbDirectoryProviderUnregister(nsIComponentManager *aCompMgr, nsIFile *aPath, const char *aLoaderStr, const nsModuleComponentInfo *aInfo)
#define SONGBIRD_DIRECTORY_PROVIDER_CONTRACTID
NS_IMPL_NSGETMODULE(SongbirdIdentityServiceComponent, sbIdentityServiceComponent)
static const nsModuleComponentInfo components[]
#define SONGBIRD_DIRECTORY_PROVIDER_CID