sbWindowWatcherModule.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 //
5 // BEGIN SONGBIRD GPL
6 //
7 // This file is part of the Songbird web player.
8 //
9 // Copyright(c) 2005-2008 POTI, Inc.
10 // http://songbirdnest.com
11 //
12 // This file may be licensed under the terms of of the
13 // GNU General Public License Version 2 (the "GPL").
14 //
15 // Software distributed under the License is distributed
16 // on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
17 // express or implied. See the GPL for the specific language
18 // governing rights and limitations.
19 //
20 // You should have received a copy of the GPL along with this
21 // program. If not, go to http://www.gnu.org/licenses/gpl.html
22 // or write to the Free Software Foundation, Inc.,
23 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 //
25 // END SONGBIRD GPL
26 //
27 */
28 
34 //------------------------------------------------------------------------------
35 //
36 // Songbird window watcher module imported services.
37 //
38 //------------------------------------------------------------------------------
39 
40 // Self imports.
41 #include "sbWindowWatcher.h"
42 
43 // Mozilla imports.
44 #include <nsICategoryManager.h>
45 #include <nsIGenericFactory.h>
46 #include <nsServiceManagerUtils.h>
47 
48 
49 //------------------------------------------------------------------------------
50 //
51 // Songbird window watcher module services.
52 //
53 //------------------------------------------------------------------------------
54 
55 // Construct the sbWindowWatcher object and call its Init method.
57 
58 
59 
63 static NS_METHOD
64 sbWindowWatcherRegister(nsIComponentManager* aCompMgr,
65  nsIFile* aPath,
66  const char* aLoaderStr,
67  const char* aType,
68  const nsModuleComponentInfo* aInfo)
69 {
70  nsresult rv;
71 
72  // Get the category manager.
73  nsCOMPtr<nsICategoryManager> categoryManager =
74  do_GetService(NS_CATEGORYMANAGER_CONTRACTID,
75  &rv);
76  NS_ENSURE_SUCCESS(rv, rv);
77 
78  // Add self to the device marshall category.
79  rv = categoryManager->AddCategoryEntry("app-startup",
81  "service," SB_WINDOWWATCHER_CONTRACTID,
82  PR_TRUE,
83  PR_TRUE,
84  nsnull);
85  NS_ENSURE_SUCCESS(rv, rv);
86 
87  return NS_OK;
88 }
89 
90 
95 static NS_METHOD
96 sbWindowWatcherUnregister(nsIComponentManager* aCompMgr,
97  nsIFile* aPath,
98  const char* aLoaderStr,
99  const nsModuleComponentInfo* aInfo)
100 {
101  nsresult rv;
102 
103  // Get the category manager.
104  nsCOMPtr<nsICategoryManager> categoryManager =
105  do_GetService(NS_CATEGORYMANAGER_CONTRACTID,
106  &rv);
107  NS_ENSURE_SUCCESS(rv, rv);
108 
109  // Delete self from the device marshall category.
110  rv = categoryManager->DeleteCategoryEntry("app-startup",
112  PR_TRUE);
113  NS_ENSURE_SUCCESS(rv, rv);
114 
115  return NS_OK;
116 }
117 
118 
119 // Module component information.
120 static const nsModuleComponentInfo components[] =
121 {
122  {
126  sbWindowWatcherConstructor,
129  }
130 };
131 
132 // NSGetModule
134 
return NS_OK
_updateCookies aPath
Songbird Window Watcher Definitions.
static NS_METHOD sbWindowWatcherUnregister(nsIComponentManager *aCompMgr, nsIFile *aPath, const char *aLoaderStr, const nsModuleComponentInfo *aInfo)
Unregister the Songbird window watcher component.
#define SB_WINDOWWATCHER_CID
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(sbMockDeviceFirmwareHandler, Init)
#define SB_WINDOWWATCHER_CLASSNAME
#define SB_WINDOWWATCHER_CONTRACTID
function Init()
static const nsModuleComponentInfo components[]
NS_IMPL_NSGETMODULE(SongbirdIdentityServiceComponent, sbIdentityServiceComponent)
static NS_METHOD sbWindowWatcherRegister(nsIComponentManager *aCompMgr, nsIFile *aPath, const char *aLoaderStr, const char *aType, const nsModuleComponentInfo *aInfo)
Register the Songbird window watcher component.