1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: MNSProfile.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_connectivity.hxx"
34 #include "MNSProfile.hxx"
35 #include "MNSProfileDirServiceProvider.hxx"
37 #include <com/sun/star/uno/Reference.hxx>
38 #include <com/sun/star/uno/Sequence.hxx>
39 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
40 #include <unotools/processfactory.hxx>
41 #include <com/sun/star/mozilla/XMozillaBootstrap.hpp>
43 using namespace com::sun::star::uno
;
44 using namespace com::sun::star::lang
;
45 using namespace com::sun::star::mozilla
;
50 static Reference
<XMozillaBootstrap
> xMozillaBootstrap
;
53 static PRInt32 gInstanceCount
= 0;
55 // Profile database to remember which profile has been
56 // created with UILocale and contentLocale on profileManager
57 static nsProfileDirServiceProvider
*gDirServiceProvider
= nsnull
;
63 * Constructor/Destructor
65 nsProfile::nsProfile()
67 mStartingUp
= PR_FALSE
;
68 mCurrentProfileAvailable
= PR_FALSE
;
70 mShutdownProfileToreDownNetwork
= PR_FALSE
;
72 mProfileChangeVetoed
= PR_FALSE
;
73 mProfileChangeFailed
= PR_FALSE
;
74 Reference
<XMultiServiceFactory
> xFactory
= ::comphelper::getProcessServiceFactory();
75 OSL_ENSURE( xFactory
.is(), "can't get service factory" );
77 Reference
<XInterface
> xInstance
= xFactory
->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap")) );
78 OSL_ENSURE( xInstance
.is(), "failed to create instance" );
79 xMozillaBootstrap
= Reference
<XMozillaBootstrap
>(xInstance
,UNO_QUERY
);
84 nsProfile::~nsProfile()
93 RegisterProfileManager(this);
94 if (gInstanceCount
++ == 0) {
95 rv
= NS_NewProfileDirServiceProvider( &gDirServiceProvider
);
97 rv
= gDirServiceProvider
->Register();
103 * nsISupports Implementation
105 NS_IMPL_THREADSAFE_ADDREF(nsProfile
)
106 NS_IMPL_THREADSAFE_RELEASE(nsProfile
)
108 NS_INTERFACE_MAP_BEGIN(nsProfile
)
109 NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports
, nsIProfile
)
110 NS_INTERFACE_MAP_ENTRY(nsIProfile
)
111 NS_INTERFACE_MAP_ENTRY(nsIProfileInternal
)
112 NS_INTERFACE_MAP_ENTRY(nsIProfileChangeStatus
)
113 NS_INTERFACE_MAP_ENTRY(nsIFactory
)
117 * nsIProfileChangeStatus Implementation
120 NS_IMETHODIMP
nsProfile::VetoChange()
122 mProfileChangeVetoed
= PR_TRUE
;
126 NS_IMETHODIMP
nsProfile::ChangeFailed()
128 mProfileChangeFailed
= PR_TRUE
;
132 * nsIProfile Implementation
135 NS_IMETHODIMP
nsProfile::GetProfileCount(PRInt32
*numProfiles
)
137 NS_ENSURE_ARG_POINTER(numProfiles
);
141 *numProfiles
= xMozillaBootstrap
->getProfileCount(xMozillaBootstrap
->getCurrentProduct());
144 NS_IMETHODIMP
nsProfile::GetProfileList(PRUint32
*length
, PRUnichar
***profileNames
)
146 NS_ENSURE_ARG_POINTER(length
);
147 NS_ENSURE_ARG_POINTER(profileNames
);
148 *profileNames
= nsnull
;
150 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> list
;
152 *length
= xMozillaBootstrap
->getProfileList(xMozillaBootstrap
->getCurrentProduct(),list
);
154 const OUString
* pArray
= list
.getConstArray();
157 PRInt32 count
= list
.getLength();
158 PRUnichar
**outArray
, **next
;
160 next
= outArray
= (PRUnichar
**)nsMemory::Alloc(count
* sizeof(PRUnichar
*));
162 return NS_ERROR_OUT_OF_MEMORY
;
164 for (PRInt32 index
=0; index
< count
; index
++)
166 *next
= (PRUnichar
*)nsMemory::Clone(pArray
[index
].getStr(),(pArray
[index
].getLength()+1) * sizeof(PRUnichar
));
169 rv
= NS_ERROR_OUT_OF_MEMORY
;
174 *profileNames
= outArray
;
177 NS_IMETHODIMP
nsProfile::ProfileExists(const PRUnichar
*profileName
, PRBool
*exists
)
179 NS_ENSURE_ARG_POINTER(profileName
);
180 NS_ENSURE_ARG_POINTER(exists
);
182 // PRUnichar != sal_Unicode in mingw
183 *exists
= xMozillaBootstrap
->getProfileExists(xMozillaBootstrap
->getCurrentProduct(),reinterpret_cast_mingw_only
<const sal_Unicode
*>(profileName
));
186 // Returns the name of the current profile i.e., the last used profile
188 nsProfile::GetCurrentProfile(PRUnichar
**profileName
)
190 NS_ENSURE_ARG_POINTER(profileName
);
191 *profileName
= nsnull
;
193 if (mCurrentProfileName
.Length())
194 *profileName
= (PRUnichar
*)nsMemory::Clone(mCurrentProfileName
.get(),(mCurrentProfileName
.Length() + 1) * sizeof(PRUnichar
));
197 rtl::OUString profile
= xMozillaBootstrap
->getDefaultProfile(xMozillaBootstrap
->getCurrentProduct());
198 *profileName
= (PRUnichar
*)nsMemory::Clone(profile
.getStr(),( profile
.getLength() + 1) * sizeof(PRUnichar
));
199 SetCurrentProfile(*profileName
);
202 return (*profileName
== nsnull
) ? NS_ERROR_FAILURE
: NS_OK
;
206 nsProfile::SetCurrentProfile(const PRUnichar
* aCurrentProfile
)
208 NS_ENSURE_ARG(aCurrentProfile
);
211 nsCOMPtr
<nsIFile
> profileDir
;
214 // Ensure that the profile exists and its directory too.
215 rv
= GetProfileDir(aCurrentProfile
, getter_AddRefs(profileDir
));
216 if (NS_FAILED(rv
)) return rv
;
217 rv
= profileDir
->Exists(&exists
);
218 if (NS_FAILED(rv
)) return rv
;
219 if (!exists
) return NS_ERROR_FILE_NOT_FOUND
;
221 PRBool isSwitch
= PRBool();
223 if (mCurrentProfileAvailable
)
225 nsXPIDLString currProfileName
;
226 rv
= GetCurrentProfile(getter_Copies(currProfileName
));
227 if (NS_FAILED(rv
)) return rv
;
228 if (nsCRT::strcmp(aCurrentProfile
, currProfileName
.get()) == 0)
237 nsCOMPtr
<nsIObserverService
> observerService
=
238 do_GetService("@mozilla.org/observer-service;1", &rv
);
239 NS_ENSURE_TRUE(observerService
, NS_ERROR_FAILURE
);
241 nsISupports
*subject
= (nsISupports
*)((nsIProfile
*)this);
242 NS_NAMED_LITERAL_STRING(switchString
, "switch");
243 NS_NAMED_LITERAL_STRING(startupString
, "startup");
244 const nsAFlatString
& context
= isSwitch
? switchString
: startupString
;
248 rv
= ShutDownCurrentProfile(nsIProfile::SHUTDOWN_PERSIST
);
249 if (NS_FAILED(rv
)) return NS_ERROR_ABORT
;
251 // Phase 1: See if anybody objects to the profile being changed.
252 mProfileChangeVetoed
= PR_FALSE
;
253 observerService
->NotifyObservers(subject
, "profile-approve-change", context
.get());
254 if (mProfileChangeVetoed
)
257 // Phase 2a: Send the network teardown notification
258 observerService
->NotifyObservers(subject
, "profile-change-net-teardown", context
.get());
259 mShutdownProfileToreDownNetwork
= PR_TRUE
;
261 // Phase 2b: Send the "teardown" notification
262 observerService
->NotifyObservers(subject
, "profile-change-teardown", context
.get());
263 if (mProfileChangeVetoed
)
265 // Notify we will not proceed with changing the profile
266 observerService
->NotifyObservers(subject
, "profile-change-teardown-veto", context
.get());
268 // Bring network back online and return
269 observerService
->NotifyObservers(subject
, "profile-change-net-restore", context
.get());
273 // Phase 3: Notify observers of a profile change
274 observerService
->NotifyObservers(subject
, "profile-before-change", context
.get());
275 if (mProfileChangeFailed
)
276 return NS_ERROR_ABORT
;
281 // // Do the profile switch
282 gDirServiceProvider
->SetProfileDir(profileDir
);
283 mCurrentProfileName
.Assign(aCurrentProfile
);
284 // gProfileDataAccess->SetCurrentProfile(aCurrentProfile);
286 if (NS_FAILED(rv
)) return rv
;
287 mCurrentProfileAvailable
= PR_TRUE
;
291 // Ensure that the prefs service exists so it can respond to
292 // the notifications we're about to send around. It needs to.
293 nsCOMPtr
<nsIPrefService
> prefs
= do_GetService(NS_PREFSERVICE_CONTRACTID
, &rv
);
294 NS_ASSERTION(NS_SUCCEEDED(rv
), "Could not get prefs service");
297 if (mShutdownProfileToreDownNetwork
)
299 // Bring network back online
300 observerService
->NotifyObservers(subject
, "profile-change-net-restore", context
.get());
301 mShutdownProfileToreDownNetwork
= PR_FALSE
;
302 if (mProfileChangeFailed
)
303 return NS_ERROR_ABORT
;
306 // Phase 4: Notify observers that the profile has changed - Here they respond to new profile
307 observerService
->NotifyObservers(subject
, "profile-do-change", context
.get());
308 if (mProfileChangeFailed
)
309 return NS_ERROR_ABORT
;
311 // Phase 5: Now observers can respond to something another observer did in phase 4
312 observerService
->NotifyObservers(subject
, "profile-after-change", context
.get());
313 if (mProfileChangeFailed
)
314 return NS_ERROR_ABORT
;
316 // Phase 6: One last notification after the new profile is established
317 observerService
->NotifyObservers(subject
, "profile-initial-state", context
.get());
318 if (mProfileChangeFailed
)
319 return NS_ERROR_ABORT
;
323 /* void shutDownCurrentProfile (in unsigned long shutDownType); */
324 NS_IMETHODIMP
nsProfile::ShutDownCurrentProfile(PRUint32 shutDownType
)
328 // if shutDownType is not a well know value, skip the notifications
329 // see DoOnShutdown() in nsAppRunner.cpp for where we use this behaviour to our benefit
330 if (shutDownType
== (PRUint32
)SHUTDOWN_PERSIST
|| shutDownType
== (PRUint32
)SHUTDOWN_CLEANSE
) {
331 nsCOMPtr
<nsIObserverService
> observerService
=
332 do_GetService("@mozilla.org/observer-service;1", &rv
);
333 NS_ENSURE_TRUE(observerService
, NS_ERROR_FAILURE
);
335 nsISupports
*subject
= (nsISupports
*)((nsIProfile
*)this);
337 NS_NAMED_LITERAL_STRING(cleanseString
, "shutdown-cleanse");
338 NS_NAMED_LITERAL_STRING(persistString
, "shutdown-persist");
339 const nsAFlatString
& context
= (shutDownType
== (PRUint32
)SHUTDOWN_CLEANSE
) ? cleanseString
: persistString
;
341 // Phase 1: See if anybody objects to the profile being changed.
342 mProfileChangeVetoed
= PR_FALSE
;
343 observerService
->NotifyObservers(subject
, "profile-approve-change", context
.get());
344 if (mProfileChangeVetoed
)
347 // Phase 2a: Send the network teardown notification
348 observerService
->NotifyObservers(subject
, "profile-change-net-teardown", context
.get());
349 mShutdownProfileToreDownNetwork
= PR_TRUE
;
351 // Phase 2b: Send the "teardown" notification
352 observerService
->NotifyObservers(subject
, "profile-change-teardown", context
.get());
355 // Phase 3: Notify observers of a profile change
356 observerService
->NotifyObservers(subject
, "profile-before-change", context
.get());
360 gDirServiceProvider
->SetProfileDir(nsnull
);
361 mCurrentProfileAvailable
= PR_FALSE
;
362 mCurrentProfileName
.Truncate(0);
366 /* void createNewProfile (in wstring profileName, in wstring nativeProfileDir, in wstring langcode, in boolean useExistingDir); */
367 NS_IMETHODIMP
nsProfile::CreateNewProfile(const PRUnichar
* /*profileName*/, const PRUnichar
* /*nativeProfileDir*/, const PRUnichar
* /*langcode*/, PRBool
/*useExistingDir*/)
369 return NS_ERROR_NOT_IMPLEMENTED
;
372 /* void renameProfile (in wstring oldName, in wstring newName); */
373 NS_IMETHODIMP
nsProfile::RenameProfile(const PRUnichar
* /*oldName*/, const PRUnichar
* /*newName*/)
375 return NS_ERROR_NOT_IMPLEMENTED
;
378 /* void deleteProfile (in wstring name, in boolean canDeleteFiles); */
379 NS_IMETHODIMP
nsProfile::DeleteProfile(const PRUnichar
* /*name*/, PRBool
/*canDeleteFiles*/)
381 return NS_ERROR_NOT_IMPLEMENTED
;
384 /* void cloneProfile (in wstring profileName); */
385 NS_IMETHODIMP
nsProfile::CloneProfile(const PRUnichar
* /*profileName*/)
387 return NS_ERROR_NOT_IMPLEMENTED
;
389 //nsIProfileInternal Implementation
391 /* [noscript] void startupWithArgs (in nsICmdLineService cmdLine, in boolean canInteract); */
392 class nsICmdLineService
;
394 NS_IMETHODIMP
nsProfile::StartupWithArgs(nsICmdLineService
* /*cmdLineArgs*/, PRBool
/*canInteract*/)
400 /* [noscript] readonly attribute boolean isStartingUp; */
401 NS_IMETHODIMP
nsProfile::GetIsStartingUp(PRBool
*aIsStartingUp
)
403 NS_ENSURE_ARG_POINTER(aIsStartingUp
);
404 *aIsStartingUp
= mStartingUp
;
408 /* long get4xProfileCount (); */
409 NS_IMETHODIMP
nsProfile::Get4xProfileCount(PRInt32
* /*_retval*/)
411 return NS_ERROR_NOT_IMPLEMENTED
;
414 /* void getProfileListX (in unsigned long which, out unsigned long length, [array, size_is (length), retval] out wstring profileNames); */
415 NS_IMETHODIMP
nsProfile::GetProfileListX(PRUint32
/*whichKind*/, PRUint32
* /*length*/, PRUnichar
*** /*profileNames*/)
417 return NS_ERROR_NOT_IMPLEMENTED
;
420 /* void migrateProfileInfo (); */
421 NS_IMETHODIMP
nsProfile::MigrateProfileInfo()
423 return NS_ERROR_NOT_IMPLEMENTED
;
426 /* void migrateAllProfiles (); */
427 NS_IMETHODIMP
nsProfile::MigrateAllProfiles()
429 return NS_ERROR_NOT_IMPLEMENTED
;
432 /* void migrateProfile (in wstring profileName); */
433 NS_IMETHODIMP
nsProfile::MigrateProfile(const PRUnichar
* /*profileName*/)
435 return NS_ERROR_NOT_IMPLEMENTED
;
438 /* void remigrateProfile (in wstring profileName); */
439 NS_IMETHODIMP
nsProfile::RemigrateProfile(const PRUnichar
* /*profileName*/)
441 return NS_ERROR_NOT_IMPLEMENTED
;
444 /* void forgetCurrentProfile (); */
445 NS_IMETHODIMP
nsProfile::ForgetCurrentProfile()
447 return NS_ERROR_NOT_IMPLEMENTED
;
450 /* void createDefaultProfile (); */
451 NS_IMETHODIMP
nsProfile::CreateDefaultProfile()
453 return NS_ERROR_NOT_IMPLEMENTED
;
456 /* nsIFile getProfileDir (in wstring profileName); */
457 // Gets the profiles directory for a given profile
458 // Sets the given profile to be a current profile
459 NS_IMETHODIMP
nsProfile::GetProfileDir(const PRUnichar
*profileName
, nsIFile
**profileDir
)
461 NS_ENSURE_ARG(profileName
);
462 NS_ENSURE_ARG_POINTER(profileDir
);
463 *profileDir
= nsnull
;
467 // PRUnichar != sal_Unicode in mingw
468 rtl::OUString path
= xMozillaBootstrap
->getProfilePath(xMozillaBootstrap
->getCurrentProduct(),reinterpret_cast_mingw_only
<const sal_Unicode
*>(profileName
));
470 nsCOMPtr
<nsILocalFile
> localFile
;
471 // PRUnichar != sal_Unicode in mingw
472 nsAutoString
filePath(reinterpret_cast_mingw_only
<const PRUnichar
*>(path
.getStr()));
474 rv
= NS_NewLocalFile(filePath
, PR_TRUE
,
475 getter_AddRefs(localFile
));
476 if (localFile
&& NS_SUCCEEDED(rv
))
477 return localFile
->QueryInterface(NS_GET_IID(nsIFile
), (void**)profileDir
);
481 /* wstring getProfilePath (in wstring profileName); */
482 NS_IMETHODIMP
nsProfile::GetProfilePath(const PRUnichar
* /*profileName*/, PRUnichar
** /*_retval*/)
484 return NS_ERROR_NOT_IMPLEMENTED
;
487 /* nsILocalFile getOriginalProfileDir (in wstring profileName); */
488 NS_IMETHODIMP
nsProfile::GetOriginalProfileDir(const PRUnichar
* /*profileName*/, nsILocalFile
** /*originalDir*/)
490 return NS_ERROR_NOT_IMPLEMENTED
;
493 /* PRInt64 getProfileLastModTime (in wstring profileName); */
494 NS_IMETHODIMP
nsProfile::GetProfileLastModTime(const PRUnichar
* /*profileName*/, PRInt64
* /*_retval*/)
496 return NS_ERROR_NOT_IMPLEMENTED
;
499 /* attribute boolean automigrate; */
500 NS_IMETHODIMP
nsProfile::GetAutomigrate(PRBool
* /*aAutomigrate*/)
502 return NS_ERROR_NOT_IMPLEMENTED
;
504 NS_IMETHODIMP
nsProfile::SetAutomigrate(PRBool
/*aAutomigrate*/)
506 return NS_ERROR_NOT_IMPLEMENTED
;
509 /* readonly attribute nsIFile defaultProfileParentDir; */
510 NS_IMETHODIMP
nsProfile::GetDefaultProfileParentDir(nsIFile
** /*aDefaultProfileParentDir*/)
512 return NS_ERROR_NOT_IMPLEMENTED
;
515 /* readonly attribute wstring firstProfile; */
516 NS_IMETHODIMP
nsProfile::GetFirstProfile(PRUnichar
**profileName
)
518 NS_ENSURE_ARG_POINTER(profileName
);
520 return GetCurrentProfile(profileName
);
523 /* attribute boolean startWithLastUsedProfile; */
524 NS_IMETHODIMP
nsProfile::GetStartWithLastUsedProfile(PRBool
* /*aStartWithLastUsedProfile*/)
526 return NS_ERROR_NOT_IMPLEMENTED
;
528 NS_IMETHODIMP
nsProfile::SetStartWithLastUsedProfile(PRBool
/*aStartWithLastUsedProfile*/)
530 return NS_ERROR_NOT_IMPLEMENTED
;
533 /* [noscript] void updateRegistry (in nsIFile regName); */
534 NS_IMETHODIMP
nsProfile::UpdateRegistry(nsIFile
* /*regName*/)
536 return NS_ERROR_NOT_IMPLEMENTED
;
539 /* [noscript] void getRegStrings (in wstring profileName, out wstring regString, out wstring regName, out wstring regEmail, out wstring regOption); */
540 NS_IMETHODIMP
nsProfile::GetRegStrings(const PRUnichar
* /*profileName*/, PRUnichar
** /*regString*/, PRUnichar
** /*regName*/, PRUnichar
** /*regEmail*/, PRUnichar
** /*regOption*/)
542 return NS_ERROR_NOT_IMPLEMENTED
;
545 /* [noscript] void setRegStrings (in wstring profileName, in wstring regString, in wstring regName, in wstring regEmail, in wstring regOption); */
546 NS_IMETHODIMP
nsProfile::SetRegStrings(const PRUnichar
* /*profileName*/, const PRUnichar
* /*regString*/, const PRUnichar
* /*regName*/, const PRUnichar
* /*regEmail*/, const PRUnichar
* /*regOption*/)
548 return NS_ERROR_NOT_IMPLEMENTED
;
551 /* [noscript] string isRegStringSet (in wstring profileName); */
552 NS_IMETHODIMP
nsProfile::IsRegStringSet(const PRUnichar
* /*profileName*/, char** /*_retval*/)
554 return NS_ERROR_NOT_IMPLEMENTED
;
557 /* void createNewProfileWithLocales (in wstring profileName, in wstring nativeProfileDir, in wstring UILocale, in wstring contentLocale, in boolean useExistingDir); */
558 NS_IMETHODIMP
nsProfile::CreateNewProfileWithLocales(const PRUnichar
* /*profileName*/, const PRUnichar
* /*nativeProfileDir*/, const PRUnichar
* /*UILocale*/, const PRUnichar
* /*contentLocale*/, PRBool
/*useExistingDir*/)
560 return NS_ERROR_NOT_IMPLEMENTED
;
563 /* boolean isCurrentProfileAvailable (); */
564 NS_IMETHODIMP
nsProfile::IsCurrentProfileAvailable(PRBool
*available
)
566 NS_ENSURE_ARG_POINTER(available
);
568 *available
= mCurrentProfileAvailable
;
572 /* [noscript] void getCurrentProfileDir (out nsIFile profileDir); */
573 // Returns the name of the current profile directory
574 NS_IMETHODIMP
nsProfile::GetCurrentProfileDir(nsIFile
**profileDir
)
576 NS_ENSURE_ARG_POINTER(profileDir
);
579 nsXPIDLString profileName
;
580 rv
= GetCurrentProfile(getter_Copies(profileName
));
581 if (NS_FAILED(rv
)) return rv
;
583 rv
= GetProfileDir(profileName
, profileDir
);
584 if (NS_FAILED(rv
)) return rv
;
589 //Implementation nsIFactory
591 nsProfile::LockFactory(PRBool
/*aVal*/)
593 return NS_ERROR_NOT_IMPLEMENTED
;
597 nsProfile::CreateInstance(nsISupports
* aOuter
, const nsID
& aIID
,
601 return NS_ERROR_NO_AGGREGATION
;
602 // return this object
603 return QueryInterface(aIID
, aResult
);
606 //Register profile manager
607 #include "nsIComponentManager.h"
608 #include "nsIComponentRegistrar.h"
610 static const nsCID kProfileManagerCID
= NS_PROFILE_CID
;
612 #define NS_PROFILE_CONTRACTID \
613 "@mozilla.org/profile/manager;1"
616 nsProfile::RegisterProfileManager(nsIProfile
* aProfileService
)
618 nsCOMPtr
<nsIServiceManager
> mgr
;
619 NS_GetServiceManager(getter_AddRefs(mgr
));
621 NS_ASSERTION(mgr
, "Not initialized!");
623 nsCOMPtr
<nsIFactory
> factory
= do_QueryInterface(aProfileService
);
624 NS_ASSERTION(factory
, "Supposed to be an nsIFactory!");
626 nsCOMPtr
<nsIComponentRegistrar
> reg (do_QueryInterface(mgr
));
628 return NS_ERROR_NO_INTERFACE
;
630 return reg
->RegisterFactory(kProfileManagerCID
,
632 NS_PROFILE_CONTRACTID
,