sbCDDeviceModule.cpp
Go to the documentation of this file.
1 /*
2 //
3 // BEGIN SONGBIRD GPL
4 //
5 // This file is part of the Songbird web player.
6 //
7 // Copyright(c) 2005-2009 POTI, Inc.
8 // http://songbirdnest.com
9 //
10 // This file may be licensed under the terms of of the
11 // GNU General Public License Version 2 (the "GPL").
12 //
13 // Software distributed under the License is distributed
14 // on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
15 // express or implied. See the GPL for the specific language
16 // governing rights and limitations.
17 //
18 // You should have received a copy of the GPL along with this
19 // program. If not, go to http://www.gnu.org/licenses/gpl.html
20 // or write to the Free Software Foundation, Inc.,
21 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 //
23 // END SONGBIRD GPL
24 //
25 */
26 
27 #include <nsCOMPtr.h>
28 #include <nsServiceManagerUtils.h>
29 #include <nsIAppStartupNotifier.h>
30 #include <nsICategoryManager.h>
31 #include <nsIGenericFactory.h>
32 
33 #include "sbCDDeviceMarshall.h"
34 #include "sbCDDeviceController.h"
35 
38 
40 
41 // Registration functions for becoming a startup observer
42 static NS_METHOD
43 sbCDDeviceMarshallRegisterSelf(nsIComponentManager* aCompMgr,
44  nsIFile* aPath,
45  const char* registryLocation,
46  const char* componentType,
47  const nsModuleComponentInfo* info)
48 {
49  nsresult rv;
50  nsCOMPtr<nsICategoryManager> categoryManager =
51  do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);
52  NS_ENSURE_SUCCESS(rv, rv);
53 
54  rv = categoryManager->
55  AddCategoryEntry(SB_DEVICE_MARSHALL_CATEGORY,
58  PR_TRUE, PR_TRUE, nsnull);
59 
60  return rv;
61 }
62 
63 static NS_METHOD
64 sbCDDeviceMarshallUnregisterSelf(nsIComponentManager* aCompMgr,
65  nsIFile* aPath,
66  const char* registryLocation,
67  const nsModuleComponentInfo* info)
68 {
69  nsresult rv;
70  nsCOMPtr<nsICategoryManager> categoryManager =
71  do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);
72  NS_ENSURE_SUCCESS(rv, rv);
73 
74  rv = categoryManager->DeleteCategoryEntry(SB_DEVICE_MARSHALL_CATEGORY,
76  PR_TRUE);
77  return rv;
78 }
79 
80 static nsModuleComponentInfo sbDeviceMarshallComponents[] =
81 {
82  {
86  sbCDDeviceMarshallConstructor,
89  },
90  {
94  sbCDDeviceControllerConstructor,
95  sbCDDeviceControllerRegisterSelf,
96  sbCDDeviceControllerUnregisterSelf
97  }
98 };
99 
100 NS_IMPL_NSGETMODULE(SongbirdDeviceMarshall, sbDeviceMarshallComponents)
101 
_updateCookies aPath
SB_DEVICE_CONTROLLER_REGISTERSELF(sbCDDeviceController)
#define SB_CDDEVICE_CONTROLLER_CONTRACTID
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(sbMockDeviceFirmwareHandler, Init)
#define SB_DEVICE_MARSHALL_CATEGORY
static NS_METHOD sbCDDeviceMarshallRegisterSelf(nsIComponentManager *aCompMgr, nsIFile *aPath, const char *registryLocation, const char *componentType, const nsModuleComponentInfo *info)
function Init()
#define SB_CDDEVICE_CONTROLLER_CID
static NS_METHOD sbCDDeviceMarshallUnregisterSelf(nsIComponentManager *aCompMgr, nsIFile *aPath, const char *registryLocation, const nsModuleComponentInfo *info)
#define SB_CDDEVICE_MARSHALL_CLASSNAME
NS_IMPL_NSGETMODULE(SongbirdIdentityServiceComponent, sbIdentityServiceComponent)
#define SB_CDDEVICE_MARSHALL_DESC
#define SB_CDDEVICE_MARSHALL_CONTRACTID
#define SB_CDDEVICE_MARSHALL_CID
static nsModuleComponentInfo sbDeviceMarshallComponents[]
#define SB_CDDEVICE_CONTROLLER_CLASSNAME
NS_GENERIC_FACTORY_CONSTRUCTOR(sbMediaSniffer)