sbIPDModule.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-2009 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 // iPod device module services.
31 //
32 // These services provide support for registering the iPod device component
33 // module.
34 //
35 //------------------------------------------------------------------------------
36 //------------------------------------------------------------------------------
37 
44 //------------------------------------------------------------------------------
45 //
46 // iPod device module imported services.
47 //
48 //------------------------------------------------------------------------------
49 
50 // Local imports.
51 #include "sbIPDController.h"
52 #include "sbIPDMarshall.h"
53 
54 // Mozilla imports.
55 #include <nsCOMPtr.h>
56 #include <nsICategoryManager.h>
57 #include <nsIClassInfoImpl.h>
58 #include <nsIGenericFactory.h>
59 #include <nsServiceManagerUtils.h>
60 
61 
62 //------------------------------------------------------------------------------
63 //
64 // iPod device module marshall services.
65 //
66 //------------------------------------------------------------------------------
67 
68 // Marshall defs.
71 
72 
77 static NS_METHOD
78 sbIPDMarshallRegisterSelf(nsIComponentManager* aCompMgr,
79  nsIFile* aPath,
80  const char* aLoaderStr,
81  const char* aType,
82  const nsModuleComponentInfo* aInfo)
83 {
84  nsresult rv;
85 
86  // Get the category manager.
87  nsCOMPtr<nsICategoryManager> categoryManager =
88  do_GetService(NS_CATEGORYMANAGER_CONTRACTID,
89  &rv);
90  NS_ENSURE_SUCCESS(rv, rv);
91 
92  // Add self to the device marshall category.
93  rv = categoryManager->AddCategoryEntry(SB_DEVICE_MARSHALL_CATEGORY,
96  PR_TRUE,
97  PR_TRUE,
98  nsnull);
99  NS_ENSURE_SUCCESS(rv, rv);
100 
101  return NS_OK;
102 }
103 
104 
109 static NS_METHOD
110 sbIPDMarshallUnregisterSelf(nsIComponentManager* aCompMgr,
111  nsIFile* aPath,
112  const char* aLoaderStr,
113  const nsModuleComponentInfo* aInfo)
114 {
115  nsresult rv;
116 
117  // Get the category manager.
118  nsCOMPtr<nsICategoryManager> categoryManager =
119  do_GetService(NS_CATEGORYMANAGER_CONTRACTID,
120  &rv);
121  NS_ENSURE_SUCCESS(rv, rv);
122 
123  // Delete self from the device marshall category.
124  rv = categoryManager->DeleteCategoryEntry(SB_DEVICE_MARSHALL_CATEGORY,
126  PR_TRUE);
127  NS_ENSURE_SUCCESS(rv, rv);
128 
129  return NS_OK;
130 }
131 
132 
133 //------------------------------------------------------------------------------
134 //
135 // iPod device module controller services.
136 //
137 //------------------------------------------------------------------------------
138 
139 // Controller defs.
143 
144 
145 //------------------------------------------------------------------------------
146 //
147 // iPod device module registration services.
148 //
149 //------------------------------------------------------------------------------
150 
151 // Module component information.
152 static nsModuleComponentInfo sbIPDComponents[] =
153 {
154  // Marshall component info.
155  {
159  sbIPDMarshallConstructor,
162  nsnull,
163  NS_CI_INTERFACE_GETTER_NAME(sbIPDMarshall),
164  nsnull,
165  &NS_CLASSINFO_NAME(sbIPDMarshall)
166  },
167 
168  // Controller component info.
169  {
173  sbIPDControllerConstructor,
174  sbIPDControllerRegisterSelf,
175  sbIPDControllerUnregisterSelf,
176  nsnull,
177  NS_CI_INTERFACE_GETTER_NAME(sbIPDController),
178  nsnull,
179  &NS_CLASSINFO_NAME(sbIPDController)
180  }
181 };
182 
183 // NSGetModule
185 
return NS_OK
_updateCookies aPath
#define SB_DEVICE_MARSHALL_CATEGORY
static NS_METHOD sbIPDMarshallUnregisterSelf(nsIComponentManager *aCompMgr, nsIFile *aPath, const char *aLoaderStr, const nsModuleComponentInfo *aInfo)
Unregister the device marshall component.
SB_DEVICE_CONTROLLER_REGISTERSELF(sbIPDController)
static nsModuleComponentInfo sbIPDComponents[]
#define SB_IPDMARSHALL_CLASSNAME
Definition: sbIPDMarshall.h:74
#define SB_IPDCONTROLLER_CONTRACTID
NS_IMPL_NSGETMODULE(SongbirdIdentityServiceComponent, sbIdentityServiceComponent)
sbIJobCancelable NS_DECL_CLASSINFO(sbGstreamerMediaInspector)
static NS_METHOD sbIPDMarshallRegisterSelf(nsIComponentManager *aCompMgr, nsIFile *aPath, const char *aLoaderStr, const char *aType, const nsModuleComponentInfo *aInfo)
Register the device marshall component.
Definition: sbIPDModule.cpp:78
#define SB_IPDMARSHALL_CID
Definition: sbIPDMarshall.h:76
#define SB_IPDCONTROLLER_CID
NS_GENERIC_FACTORY_CONSTRUCTOR(sbMediaSniffer)
#define SB_IPDMARSHALL_CONTRACTID
Definition: sbIPDMarshall.h:73
#define SB_IPDCONTROLLER_CLASSNAME
#define SB_IPDMARSHALL_DESCRIPTION
Definition: sbIPDMarshall.h:75