sbStringsModule.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 strings components module.
31 //
32 //------------------------------------------------------------------------------
33 //------------------------------------------------------------------------------
34 
40 //------------------------------------------------------------------------------
41 //
42 // Songbird strings components module imported services.
43 //
44 //------------------------------------------------------------------------------
45 
46 // Local imports.
47 #include "sbStringBundleService.h"
48 #include "sbStringMap.h"
49 #include "sbCharsetDetector.h"
50 
51 // Mozilla imports.
52 #include <nsICategoryManager.h>
53 #include <nsIGenericFactory.h>
54 #include <nsServiceManagerUtils.h>
55 
56 
57 //------------------------------------------------------------------------------
58 //
59 // Songbird string bundle service.
60 //
61 //------------------------------------------------------------------------------
62 
63 // Construct the sbStringBundleService object and call its Initialize method.
65 
66 
67 
71 static NS_METHOD
72 sbStringBundleServiceRegister(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 profile-after-change category (so that the locales are ready)
87  rv = categoryManager->AddCategoryEntry
88  ("profile-after-change",
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 sbStringBundleServiceUnregister(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 app-startup category.
119  rv = categoryManager->DeleteCategoryEntry("profile-after-change",
121  PR_TRUE);
122  NS_ENSURE_SUCCESS(rv, rv);
123 
124  return NS_OK;
125 }
126 
127 //------------------------------------------------------------------------------
128 // sbStringMap stuff
129 //------------------------------------------------------------------------------
130 
131 #define SB_STRINGMAP_CLASSNAME "sbStringMap"
132 #define SB_STRINGMAP_CID \
133 { 0x56a00dd5, 0xcfae, 0x4910, \
134  { 0xae, 0x12, 0xef, 0x53, 0x93, 0x5d, 0xcf, 0x3e } }
135 
137 
138 // Songbird charset detect utilities defs.
140 
141 //------------------------------------------------------------------------------
142 //
143 // Songbird strings components module registration services.
144 //
145 //------------------------------------------------------------------------------
146 
147 // Module component information.
148 static nsModuleComponentInfo sbStringsComponents[] =
149 {
150  // String bundle service component info.
151  {
155  sbStringBundleServiceConstructor,
158  },
159  // sbStringMap
160  {
164  sbStringMapConstructor
165  },
166  // Songbird charset detect utilities component info.
167  {
171  sbCharsetDetectorConstructor
172  }
173 };
174 
175 // NSGetModule
177 
Songbird Charset Detector Definitions.
#define SB_STRINGMAP_CLASSNAME
return NS_OK
_updateCookies aPath
#define SB_STRINGBUNDLESERVICE_CLASSNAME
#define SB_STRINGBUNDLESERVICE_CONTRACTID
static nsModuleComponentInfo sbStringsComponents[]
static NS_METHOD sbStringBundleServiceUnregister(nsIComponentManager *aCompMgr, nsIFile *aPath, const char *aLoaderStr, const nsModuleComponentInfo *aInfo)
#define SB_STRINGMAP_CONTRACTID
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(sbMockDeviceFirmwareHandler, Init)
#define SB_CHARSETDETECTOR_CLASSNAME
static NS_METHOD sbStringBundleServiceRegister(nsIComponentManager *aCompMgr, nsIFile *aPath, const char *aLoaderStr, const char *aType, const nsModuleComponentInfo *aInfo)
#define SB_CHARSETDETECTOR_CID
#define SB_STRINGMAP_CID
NS_IMPL_NSGETMODULE(SongbirdIdentityServiceComponent, sbIdentityServiceComponent)
#define SB_STRINGBUNDLESERVICE_CID
#define SB_CHARSETDETECTOR_CONTRACTID
Songbird String Bundle Service Definitions.
NS_GENERIC_FACTORY_CONSTRUCTOR(sbMediaSniffer)