change the nsIProfileService interface and implemenation. add an Init() method

instead of doing things in the constructor.


git-svn-id: svn://10.0.0.236/trunk@46981 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
sspitzer%netscape.com
1999-09-11 22:15:24 +00:00
parent 70f273dbbf
commit e33d52ae4d
2 changed files with 18 additions and 3 deletions

View File

@@ -27,6 +27,7 @@
[scriptable, uuid(F4C0DA81-3887-11d3-9F5D-006008A6EFE9)]
interface nsIProfileServices : nsISupports
{
void Init();
void CreateNewProfile(in string data);
void RenameProfile(in string oldName, in string newName);
void DeleteProfile(in string profileName, in string canDeleteFiles);

View File

@@ -56,6 +56,8 @@ private:
nsresult
NS_NewProfileServices(nsIProfileServices** aProfile)
{
nsresult rv;
NS_PRECONDITION(aProfile != nsnull, "null ptr");
if (! aProfile)
return NS_ERROR_NULL_POINTER;
@@ -64,6 +66,13 @@ NS_NewProfileServices(nsIProfileServices** aProfile)
if (! *aProfile)
return NS_ERROR_OUT_OF_MEMORY;
rv = (*aProfile)->Init();
if (NS_FAILED(rv)) {
delete *aProfile;
*aProfile = nsnull;
return rv;
}
NS_ADDREF(*aProfile);
return NS_OK;
}
@@ -76,9 +85,6 @@ ProfileServicesImpl::ProfileServicesImpl()
{
NS_INIT_REFCNT();
nsresult rv = nsServiceManager::GetService(kProfileCID,
nsIProfile::GetIID(),
(nsISupports **)&mProfile);
}
@@ -90,6 +96,14 @@ ProfileServicesImpl::~ProfileServicesImpl()
NS_IMPL_ISUPPORTS(ProfileServicesImpl, nsIProfileServices::GetIID());
NS_IMETHODIMP
ProfileServicesImpl::Init()
{
nsresult rv = nsServiceManager::GetService(kProfileCID,
nsIProfile::GetIID(),
(nsISupports **)&mProfile);
return rv;
}
NS_IMETHODIMP
ProfileServicesImpl::CreateNewProfile(const char* data)