mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-26 23:23:33 +00:00
fix for #14999. remove the profile appcore
This commit is contained in:
parent
e3c4ff9671
commit
e96fe99b53
@ -841,7 +841,6 @@ sub BuildIDLProjects()
|
||||
BuildIDLProject(":mozilla:widget:macbuild:widgetIDL.mcp", "widget");
|
||||
BuildIDLProject(":mozilla:editor:macbuild:EditorIDL.mcp", "editor");
|
||||
BuildIDLProject(":mozilla:editor:txmgr:macbuild:txmgrIDL.mcp", "txmgr");
|
||||
BuildIDLProject(":mozilla:profile:macbuild:ProfileServicesIDL.mcp", "profileservices");
|
||||
BuildIDLProject(":mozilla:profile:pref-migrator:macbuild:prefmigratorIDL.mcp", "prefm");
|
||||
|
||||
BuildIDLProject(":mozilla:rdf:macbuild:RDFIDL.mcp", "rdf");
|
||||
|
@ -22,7 +22,7 @@ VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = public src resources defaults idlservices pref-migrator
|
||||
DIRS = public src resources defaults pref-migrator
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
|
@ -1 +0,0 @@
|
||||
Makefile
|
@ -1,19 +0,0 @@
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
# This is a list of local files which get copied to the mozilla:dist:editor directory
|
||||
#
|
||||
|
||||
nsIProfileServices.idl
|
@ -1,42 +0,0 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
DEPTH = ../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = profileservices
|
||||
LIBRARY_NAME = profileservices
|
||||
IS_COMPONENT = 1
|
||||
|
||||
REQUIRES = profileservices raptor xpcom
|
||||
|
||||
CPPSRCS = \
|
||||
nsProfileServices.cpp \
|
||||
nsProfileServicesFactory.cpp \
|
||||
$(NULL)
|
||||
|
||||
XPIDLSRCS = nsIProfileServices.idl
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
install:: $(TARGETS)
|
||||
$(INSTALL) $(srcdir)/xpconnect-profile.html $(DIST)/bin/res/profile
|
||||
|
@ -1,49 +0,0 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
DEPTH=..\..
|
||||
MODULE=profidl
|
||||
|
||||
MAKE_OBJ_TYPE=DLL
|
||||
DLLNAME=$(MODULE)
|
||||
DLL=.\$(OBJDIR)\$(DLLNAME).dll
|
||||
|
||||
XPIDLSRCS= .\nsIProfileServices.idl \
|
||||
$(NULL)
|
||||
|
||||
CPP_OBJS=\
|
||||
.\$(OBJDIR)\nsProfileServices.obj \
|
||||
.\$(OBJDIR)\nsProfileServicesFactory.obj \
|
||||
$(NULL)
|
||||
|
||||
LLIBS=\
|
||||
$(DIST)\lib\xpcom.lib \
|
||||
$(DIST)\lib\plc3.lib \
|
||||
$(NULL)
|
||||
|
||||
LINCS=\
|
||||
-I$(PUBLIC)\profile \
|
||||
-I$(PUBLIC)\raptor \
|
||||
-I$(PUBLIC)\xpcom \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
install:: $(DLL)
|
||||
$(MAKE_INSTALL) $(DLL) $(DIST)\bin\components
|
||||
$(MAKE_INSTALL) xpconnect-profile.html $(DIST)\bin\res\profile
|
||||
|
@ -1,50 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
A sample of XPComized ProfileManager. This file contains a profile interface.
|
||||
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[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);
|
||||
string GetProfileList();
|
||||
void StartCommunicator(in string profileName);
|
||||
string GetCurrentProfile();
|
||||
void MigrateProfile(in string profileName);
|
||||
void ProcessPREGInfo(in string data);
|
||||
void CloneProfile(in string profileName);
|
||||
};
|
||||
|
||||
|
||||
%{ C++
|
||||
// {F4C0DA83-3887-11d3-9F5D-006008A6EFE9}
|
||||
#define NS_ProfileServices_CID \
|
||||
{ 0xf4c0da83, 0x3887, 0x11d3, { 0x9f, 0x5d, 0x00, 0x60, 0x08, 0xa6, 0xef, 0xe9 } }
|
||||
|
||||
extern nsresult
|
||||
NS_NewProfileServices(nsIProfileServices** aProfile);
|
||||
%}
|
@ -1,211 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
|
||||
A sample of XPConnect. This file contains an implementation of
|
||||
nsIProfileServices.
|
||||
|
||||
*/
|
||||
#include "nscore.h"
|
||||
#include "nsIProfileServices.h"
|
||||
#include "nsIAllocator.h"
|
||||
#include "plstr.h"
|
||||
#include "stdio.h"
|
||||
#include "nsIProfile.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsINetSupportDialogService.h"
|
||||
|
||||
static NS_DEFINE_CID(kCNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID);
|
||||
static NS_DEFINE_CID(kProfileCID, NS_PROFILE_CID);
|
||||
|
||||
class ProfileServicesImpl : public nsIProfileServices
|
||||
{
|
||||
public:
|
||||
ProfileServicesImpl();
|
||||
virtual ~ProfileServicesImpl();
|
||||
|
||||
// nsISupports interface
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIProfile interface
|
||||
NS_DECL_NSIPROFILESERVICES
|
||||
|
||||
private:
|
||||
nsIProfile *mProfile;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsresult
|
||||
NS_NewProfileServices(nsIProfileServices** aProfile)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
NS_PRECONDITION(aProfile != nsnull, "null ptr");
|
||||
if (! aProfile)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*aProfile = new ProfileServicesImpl();
|
||||
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;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
ProfileServicesImpl::ProfileServicesImpl()
|
||||
: mProfile(nsnull)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
NS_PRECONDITION(data != nsnull, "null ptr");
|
||||
if (! data)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
mProfile->CreateNewProfile((char *)data);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ProfileServicesImpl::RenameProfile(const char* oldName, const char* newName)
|
||||
{
|
||||
|
||||
mProfile->RenameProfile(oldName, newName);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ProfileServicesImpl::DeleteProfile(const char* profileName, const char *canDeleteFiles)
|
||||
{
|
||||
NS_PRECONDITION(profileName != nsnull, "null ptr");
|
||||
if (! profileName)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
mProfile->DeleteProfile(profileName, canDeleteFiles);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ProfileServicesImpl::GetProfileList(char** profileList)
|
||||
{
|
||||
nsString localVar;
|
||||
mProfile->GetProfileList(localVar);
|
||||
*profileList = PL_strdup(localVar.ToNewCString());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ProfileServicesImpl::StartCommunicator(const char* profileName)
|
||||
{
|
||||
NS_PRECONDITION(profileName != nsnull, "null ptr");
|
||||
if (! profileName)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
mProfile->StartCommunicator(profileName);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ProfileServicesImpl::GetCurrentProfile(char** profileName)
|
||||
{
|
||||
mProfile->GetCurrentProfile(profileName);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ProfileServicesImpl::MigrateProfile(const char* profileName)
|
||||
{
|
||||
nsresult rv;
|
||||
NS_PRECONDITION(profileName != nsnull, "null ptr");
|
||||
if (! profileName)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
rv = mProfile->MigrateProfile(profileName);
|
||||
if (NS_FAILED(rv)) {
|
||||
nsresult rv2;
|
||||
NS_WITH_SERVICE(nsIPrompt, dialog, kCNetSupportDialogCID, &rv2);
|
||||
if (NS_SUCCEEDED(rv2) || dialog) {
|
||||
nsString errorText("Failed to migrate the following profile: ");
|
||||
errorText += profileName;
|
||||
rv2 = dialog->Alert(errorText.GetUnicode());
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ProfileServicesImpl::ProcessPREGInfo(const char* data)
|
||||
{
|
||||
NS_PRECONDITION(data != nsnull, "null ptr");
|
||||
if (! data)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
mProfile->ProcessPREGInfo((char *)data);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
ProfileServicesImpl::CloneProfile(const char* aProfileName)
|
||||
{
|
||||
NS_PRECONDITION(aProfileName != nsnull, "null ptr");
|
||||
|
||||
if (! aProfileName)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
mProfile->CloneProfile(aProfileName);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1,206 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
A sample of XPConnect. This file contains the XPCOM factory the
|
||||
creates for ProfileServicesImpl objects.
|
||||
|
||||
*/
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nscore.h"
|
||||
#include "nsIProfileServices.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsXPComFactory.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
|
||||
static NS_DEFINE_CID(kProfileServicesCID, NS_ProfileServices_CID);
|
||||
|
||||
class ProfileServicesFactoryImpl : public nsIFactory
|
||||
{
|
||||
public:
|
||||
ProfileServicesFactoryImpl(const nsCID &aClass, const char* className, const char* progID);
|
||||
|
||||
// nsISupports methods
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIFactory methods
|
||||
NS_IMETHOD CreateInstance(nsISupports *aOuter,
|
||||
const nsIID &aIID,
|
||||
void **aResult);
|
||||
|
||||
NS_IMETHOD LockFactory(PRBool aLock);
|
||||
|
||||
protected:
|
||||
virtual ~ProfileServicesFactoryImpl();
|
||||
|
||||
protected:
|
||||
nsCID mClassID;
|
||||
const char* mClassName;
|
||||
const char* mProgID;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ProfileServicesFactoryImpl::ProfileServicesFactoryImpl(const nsCID &aClass,
|
||||
const char* className,
|
||||
const char* progID)
|
||||
: mClassID(aClass), mClassName(className), mProgID(progID)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
ProfileServicesFactoryImpl::~ProfileServicesFactoryImpl()
|
||||
{
|
||||
NS_ASSERTION(mRefCnt == 0, "non-zero refcnt at destruction");
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ProfileServicesFactoryImpl::QueryInterface(const nsIID &aIID, void **aResult)
|
||||
{
|
||||
if (! aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
// Always NULL result, in case of failure
|
||||
*aResult = nsnull;
|
||||
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aResult = NS_STATIC_CAST(nsISupports*, this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
} else if (aIID.Equals(kIFactoryIID)) {
|
||||
*aResult = NS_STATIC_CAST(nsIFactory*, this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(ProfileServicesFactoryImpl);
|
||||
NS_IMPL_RELEASE(ProfileServicesFactoryImpl);
|
||||
|
||||
NS_IMETHODIMP
|
||||
ProfileServicesFactoryImpl::CreateInstance(nsISupports *aOuter,
|
||||
const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
if (! aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (aOuter)
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
*aResult = nsnull;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
nsISupports *inst = nsnull;
|
||||
if (mClassID.Equals(kProfileServicesCID)) {
|
||||
if (NS_FAILED(rv = NS_NewProfileServices((nsIProfileServices**) &inst)))
|
||||
return rv;
|
||||
}
|
||||
else {
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
|
||||
if (! inst)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
if (NS_FAILED(rv = inst->QueryInterface(aIID, aResult))) {
|
||||
// We didn't get the right interface.
|
||||
NS_ERROR("didn't support the interface you wanted");
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(inst);
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult ProfileServicesFactoryImpl::LockFactory(PRBool aLock)
|
||||
{
|
||||
// Not implemented in simplest case.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
// return the proper factory to the caller
|
||||
extern "C" PR_IMPLEMENT(nsresult)
|
||||
NSGetFactory(nsISupports* aServMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
if (! aFactory)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
ProfileServicesFactoryImpl* factory = new ProfileServicesFactoryImpl(aClass, aClassName, aProgID);
|
||||
if (factory == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(factory);
|
||||
*aFactory = factory;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
extern "C" PR_IMPLEMENT(nsresult)
|
||||
NSRegisterSelf(nsISupports* aServMgr , const char* aPath)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIServiceManager> servMgr(do_QueryInterface(aServMgr, &rv));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
NS_WITH_SERVICE(nsIComponentManager, compMgr, kComponentManagerCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = compMgr->RegisterComponent(kProfileServicesCID,
|
||||
"Profile Services",
|
||||
"component://netscape/profile/profile-services",
|
||||
aPath, PR_TRUE, PR_TRUE);
|
||||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
extern "C" PR_IMPLEMENT(nsresult)
|
||||
NSUnregisterSelf(nsISupports* aServMgr, const char* aPath)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIServiceManager> servMgr(do_QueryInterface(aServMgr, &rv));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
NS_WITH_SERVICE(nsIComponentManager, compMgr, kComponentManagerCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = compMgr->UnregisterComponent(kProfileServicesCID, aPath);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return NS_OK;
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>XPConnect Example</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
var profile = Components.classes["component://netscape/profile/profile-services"].createInstance();
|
||||
profile = profile.QueryInterface(Components.interfaces.nsIProfileServices);
|
||||
dump("profile = " + profile + "\n");
|
||||
|
||||
function TestMe()
|
||||
{
|
||||
var field = document.getElementById('Value');
|
||||
//profile.CreateNewProfile("Test Succeeded!!");
|
||||
|
||||
var currentProfile = profile.GetCurrentProfile(); // GetCurrentProfile works
|
||||
|
||||
field.value = currentProfile;
|
||||
|
||||
//profile.RenameProfile(currentProfile, "NetscapeProfile"); // Rename works
|
||||
|
||||
var profileList = profile.GetProfileList(); // GetProfileList works
|
||||
dump("Profile List : " + profileList + "\n");
|
||||
|
||||
//profile.DeleteProfile(currentProfile); // Delete works
|
||||
|
||||
//profile.StartCommunicator("mozProfile44"); // StartCommunicator works
|
||||
|
||||
//profile.CreateNewProfile("ProfileName=hello%ProfileDir="); // CreateNewProfile works
|
||||
|
||||
//profile.MigrateProfile("test"); // Migration works
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<form name="form">
|
||||
<input type="button" value="Test" onclick="TestMe();">
|
||||
<input type="text" id="Value">
|
||||
<form>
|
||||
</body>
|
||||
</html>
|
@ -27,7 +27,6 @@ DIRS= \
|
||||
resources \
|
||||
pref-migrator \
|
||||
defaults \
|
||||
idlservices \
|
||||
!if "$(_MSC_VER)" != "" && "$(_MSC_VER)" != "1100"
|
||||
acct \
|
||||
acctidl \
|
||||
|
@ -43,7 +43,6 @@ interface nsIFileSpec;
|
||||
|
||||
[ptr] native nsFileSpec(nsFileSpec);
|
||||
[ref] native nsFileSpecRef(nsFileSpec);
|
||||
[ref] native nsStringRef(nsString);
|
||||
[scriptable, uuid(02b0625a-e7f3-11d2-9f5a-006008a6efe9)]
|
||||
interface nsIProfile : nsISupports {
|
||||
[noscript] void startupWithArgs(in nsICmdLineService cmdLine);
|
||||
@ -55,7 +54,6 @@ interface nsIProfile : nsISupports {
|
||||
readonly attribute long profileCount;
|
||||
string getSingleProfile();
|
||||
readonly attribute string currentProfile;
|
||||
|
||||
readonly attribute string firstProfile;
|
||||
|
||||
// eventually we need to depricate getCurrentProfileDir
|
||||
@ -72,14 +70,13 @@ interface nsIProfile : nsISupports {
|
||||
|
||||
void deleteProfile(in string name, in string canDeleteFiles);
|
||||
|
||||
[noscript] void getProfileList(in nsStringRef profileList);
|
||||
string getProfileList();
|
||||
|
||||
void startCommunicator(in string profileName);
|
||||
[noscript] void getCurrProfile(in nsStringRef currProfile);
|
||||
|
||||
void migrateProfile(in string profileName);
|
||||
|
||||
[noscript] void getCookie(in nsStringRef cookie);
|
||||
string getCookie();
|
||||
|
||||
void ProcessPRegCookie();
|
||||
|
||||
|
@ -16,9 +16,6 @@ var currentPageTag;
|
||||
var profName = "";
|
||||
var profDir = "";
|
||||
|
||||
var toolkitCore;
|
||||
|
||||
|
||||
// hack for inability to gray out finish button in first screen on first load
|
||||
var isProfileData = false;
|
||||
|
||||
@ -150,15 +147,7 @@ function getUrlFromTag(title)
|
||||
|
||||
function Startup()
|
||||
{
|
||||
//dump("Doing Startup...\n");
|
||||
toolkitCore = XPAppCoresManager.Find("toolkitCore");
|
||||
if (!toolkitCore) {
|
||||
toolkitCore = new ToolkitCore();
|
||||
|
||||
if (toolkitCore) {
|
||||
toolkitCore.Init("toolkitCore");
|
||||
}
|
||||
}
|
||||
dump("Doing Startup...\n");
|
||||
}
|
||||
|
||||
function Finish(opener)
|
||||
@ -205,30 +194,14 @@ function processCreateProfileData()
|
||||
}
|
||||
|
||||
dump("data: "+data+"\n");
|
||||
dump("calling javascript reflection\n");
|
||||
var profileCore = XPAppCoresManager.Find("ProfileCore");
|
||||
if (!profileCore)
|
||||
{
|
||||
//dump("!profileCore\n");
|
||||
profileCore = new ProfileCore();
|
||||
//dump("!profileCore\n");
|
||||
var profile = Components.classes[""component://netscape/profile/manager"].createInstance();
|
||||
profile = profile.QueryInterface(Components.interfaces.nsIProfile);
|
||||
dump("profile = " + profile + "\n");
|
||||
|
||||
if (profileCore) {
|
||||
//dump("after ! yes profileCore in if loop\n");
|
||||
profileCore.Init("ProfileCore");
|
||||
}
|
||||
else {
|
||||
dump("profile not created\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (profileCore) {
|
||||
//dump("yes profileCore\n");
|
||||
dump("********DATA: "+data+"\n\n");
|
||||
profileCore.CreateNewProfile(data);
|
||||
profileCore.StartCommunicator(profName);
|
||||
ExitApp();
|
||||
}
|
||||
dump("********DATA: "+data+"\n\n");
|
||||
profile.createNewProfile(data);
|
||||
profile.startCommunicator(profName);
|
||||
ExitApp();
|
||||
}
|
||||
|
||||
function ExitApp()
|
||||
|
@ -1,12 +1,14 @@
|
||||
var profileCore = "";
|
||||
var selected = null;
|
||||
var currProfile = "";
|
||||
var profile = Components.classes["component://netscape/profile/manager"].createInstance();
|
||||
profile = profile.QueryInterface(Components.interfaces.nsIProfile);
|
||||
dump("profile = " + profile + "\n");
|
||||
|
||||
function openCreateProfile()
|
||||
{
|
||||
// Need to call CreateNewProfile xuls
|
||||
var win = window.openDialog('cpw.xul', 'CPW', 'chrome');
|
||||
return win;
|
||||
return win;
|
||||
}
|
||||
|
||||
function CreateProfile()
|
||||
@ -33,7 +35,7 @@ function RenameProfile(w)
|
||||
}
|
||||
|
||||
//dump("RenameProfile : " + oldName + " to " + newName + "\n");
|
||||
profileCore.RenameProfile(oldName, newName);
|
||||
profile.RenameProfile(oldName, newName);
|
||||
//this.location.replace(this.location);
|
||||
this.location.href = "resource:/res/profile/pm.xul";
|
||||
}
|
||||
@ -50,7 +52,7 @@ function DeleteProfile(deleteFilesFlag)
|
||||
|
||||
var name = selected.getAttribute("rowName");
|
||||
//dump("Delete '" + name + "'\n");
|
||||
profileCore.DeleteProfile(name, deleteFilesFlag);
|
||||
profile.DeleteProfile(name, deleteFilesFlag);
|
||||
//this.location.replace(this.location);
|
||||
//this.location.href = this.location;
|
||||
this.location.href = "resource:/res/profile/pm.xul";
|
||||
@ -70,11 +72,11 @@ function StartCommunicator()
|
||||
|
||||
if (migrate == "true")
|
||||
{
|
||||
profileCore.MigrateProfile(name);
|
||||
profile.migrateProfile(name);
|
||||
}
|
||||
|
||||
dump("************name: "+name+"\n");
|
||||
profileCore.StartCommunicator(name);
|
||||
profile.startCommunicator(name);
|
||||
ExitApp();
|
||||
}
|
||||
|
||||
@ -139,15 +141,18 @@ function loadElements()
|
||||
dump("****************hacked onload handler adds elements to tree widget\n");
|
||||
var profileList = "";
|
||||
|
||||
profileCore = Components.classes["component://netscape/profile/profile-services"].createInstance();
|
||||
profileCore = profileCore.QueryInterface(Components.interfaces.nsIProfileServices);
|
||||
dump("profile = " + profileCore + "\n");
|
||||
|
||||
profileList = profileCore.GetProfileList();
|
||||
profileList = profile.getProfileList();
|
||||
|
||||
//dump("Got profile list of '" + profileList + "'\n");
|
||||
dump("Got profile list of '" + profileList + "'\n");
|
||||
profileList = profileList.split(",");
|
||||
currProfile = profileCore.GetCurrentProfile();
|
||||
try {
|
||||
currProfile = profile.currentProfile;
|
||||
}
|
||||
catch (ex) {
|
||||
if (profileList != "") {
|
||||
currProfile = profileList;
|
||||
}
|
||||
}
|
||||
|
||||
for (var i=0; i < profileList.length; i++)
|
||||
{
|
||||
|
@ -871,7 +871,8 @@ nsProfile::GetCurrentProfileDirFromJS(nsIFileSpec **spec)
|
||||
}
|
||||
|
||||
// Returns the name of the current profile i.e., the last used profile
|
||||
NS_IMETHODIMP nsProfile::GetCurrentProfile(char **profileName)
|
||||
NS_IMETHODIMP
|
||||
nsProfile::GetCurrentProfile(char **profileName)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
@ -946,7 +947,6 @@ NS_IMETHODIMP nsProfile::GetCurrentProfileDir(nsFileSpec* profileDir)
|
||||
#endif
|
||||
|
||||
char *profileName = nsnull;
|
||||
|
||||
rv = GetCurrentProfile(&profileName);
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
@ -970,7 +970,7 @@ NS_IMETHODIMP nsProfile::GetCurrentProfileDir(nsFileSpec* profileDir)
|
||||
|
||||
|
||||
if (profileName) {
|
||||
PR_DELETE(profileName);
|
||||
PR_DELETE(profileName);
|
||||
}
|
||||
|
||||
return rv;
|
||||
@ -1630,9 +1630,10 @@ void nsProfile::GetAllProfiles()
|
||||
// Essentially calls GetAllProfiles to fill mProfiles[].
|
||||
// This method is written to support the core service
|
||||
// call to get the names all profiles.
|
||||
NS_IMETHODIMP nsProfile::GetProfileList(nsString& profileList)
|
||||
NS_IMETHODIMP nsProfile::GetProfileList(char **profileListStr)
|
||||
{
|
||||
|
||||
nsCAutoString profileList("");
|
||||
|
||||
#if defined(DEBUG_profile)
|
||||
printf("Inside GetProfileList routine.\n" );
|
||||
#endif
|
||||
@ -1647,7 +1648,9 @@ NS_IMETHODIMP nsProfile::GetProfileList(nsString& profileList)
|
||||
}
|
||||
profileList += mProfiles[i];
|
||||
}
|
||||
return NS_OK;
|
||||
|
||||
*profileListStr = nsCRT::strdup((const char *)profileList);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@ -1703,24 +1706,6 @@ NS_IMETHODIMP nsProfile::StartCommunicator(const char* profileName)
|
||||
}
|
||||
|
||||
|
||||
// Get Current Profile (Support for Core service call).
|
||||
// Populate the input param with current profile.
|
||||
NS_IMETHODIMP nsProfile::GetCurrProfile(nsString& currProfile)
|
||||
{
|
||||
|
||||
#if defined(DEBUG_profile)
|
||||
printf("Inside GetCurrentProfile (JSReflec) routine.\n" );
|
||||
#endif
|
||||
|
||||
char *localCurProf = nsnull;
|
||||
|
||||
GetCurrentProfile(&localCurProf);
|
||||
|
||||
currProfile += localCurProf;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Migrate profile information from the 4x registry to 5x registry.
|
||||
NS_IMETHODIMP nsProfile::MigrateProfileInfo()
|
||||
{
|
||||
@ -2064,7 +2049,7 @@ NS_IMETHODIMP nsProfile::MigrateProfile(const char* profileName)
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsProfile::GetCookie(nsString& aCookie)
|
||||
NS_IMETHODIMP nsProfile::GetCookie(char **cookie)
|
||||
{
|
||||
#ifndef NECKO
|
||||
nsINetService *service;
|
||||
@ -2099,11 +2084,11 @@ NS_IMETHODIMP nsProfile::ProcessPRegCookie()
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsString aCookie;
|
||||
GetCookie(aCookie);
|
||||
|
||||
rv = ProcessPREGInfo(aCookie.ToNewCString());
|
||||
|
||||
char *aCookie = nsnull;
|
||||
GetCookie(&aCookie);
|
||||
rv = ProcessPREGInfo(aCookie);
|
||||
PR_FREEIF(aCookie);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -1,15 +0,0 @@
|
||||
interface ProfileCore : BaseAppCore
|
||||
{
|
||||
/* IID: { 0x0573a2a3, 0xf838, 0x11d2, \
|
||||
{0x90, 0x6d, 0x00, 0x80, 0x5f, 0x8a, 0x08, 0xdc}} */
|
||||
|
||||
void ProfileCore();
|
||||
|
||||
void CreateNewProfile(in wstring data);
|
||||
void RenameProfile(in wstring oldName, in wstring newName);
|
||||
void DeleteProfile(in wstring profileName, in wstring deleteFlag);
|
||||
wstring GetProfileList();
|
||||
void StartCommunicator(in wstring profileName);
|
||||
wstring GetCurrentProfile();
|
||||
void MigrateProfile(in wstring profileName);
|
||||
};
|
@ -31,7 +31,6 @@ DEPTH=..\..\..
|
||||
IDLSRCS= \
|
||||
AppCoresManager.idl \
|
||||
BaseAppCore.idl \
|
||||
ProfileCore.idl \
|
||||
ToolkitCore.idl
|
||||
!endif
|
||||
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
nsIDOMAppCoresManager.h
|
||||
nsIDOMBaseAppCore.h
|
||||
nsIDOMProfileCore.h
|
||||
nsIDOMToolkitCore.h
|
||||
nsIDOMBrowserAppCore.h
|
||||
nsAppCoresCIDs.h
|
||||
|
@ -25,7 +25,6 @@ include $(DEPTH)/config/autoconf.mk
|
||||
EXPORTS = \
|
||||
nsIDOMAppCoresManager.h \
|
||||
nsIDOMBaseAppCore.h \
|
||||
nsIDOMProfileCore.h \
|
||||
nsIDOMToolkitCore.h \
|
||||
nsIDOMBrowserAppCore.h \
|
||||
nsAppCoresCIDs.h \
|
||||
|
@ -24,7 +24,6 @@ MODULE=appcores
|
||||
EXPORTS= \
|
||||
nsIDOMAppCoresManager.h \
|
||||
nsIDOMBaseAppCore.h \
|
||||
nsIDOMProfileCore.h \
|
||||
nsIDOMToolkitCore.h \
|
||||
nsIDOMBrowserAppCore.h \
|
||||
nsAppCoresCIDs.h
|
||||
|
@ -1,78 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMProfileCore_h__
|
||||
#define nsIDOMProfileCore_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIDOMBaseAppCore.h"
|
||||
|
||||
|
||||
#define NS_IDOMPROFILECORE_IID \
|
||||
{ 0x0573a2a3, 0xf838, 0x11d2, \
|
||||
{0x90, 0x6d, 0x00, 0x80, 0x5f, 0x8a, 0x08, 0xdc}}
|
||||
|
||||
class nsIDOMProfileCore : public nsIDOMBaseAppCore {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMPROFILECORE_IID; return iid; }
|
||||
|
||||
NS_IMETHOD CreateNewProfile(const nsString& aData)=0;
|
||||
|
||||
NS_IMETHOD RenameProfile(const nsString& aOldName, const nsString& aNewName)=0;
|
||||
|
||||
NS_IMETHOD DeleteProfile(const nsString& aProfileName, const nsString& aDeleteFlag)=0;
|
||||
|
||||
NS_IMETHOD GetProfileList(nsString& aReturn)=0;
|
||||
|
||||
NS_IMETHOD StartCommunicator(const nsString& aProfileName)=0;
|
||||
|
||||
NS_IMETHOD GetCurrentProfile(nsString& aReturn)=0;
|
||||
|
||||
NS_IMETHOD MigrateProfile(const nsString& aProfileName)=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMPROFILECORE \
|
||||
NS_IMETHOD CreateNewProfile(const nsString& aData); \
|
||||
NS_IMETHOD RenameProfile(const nsString& aOldName, const nsString& aNewName); \
|
||||
NS_IMETHOD DeleteProfile(const nsString& aProfileName, const nsString& aDeleteFlag); \
|
||||
NS_IMETHOD GetProfileList(nsString& aReturn); \
|
||||
NS_IMETHOD StartCommunicator(const nsString& aProfileName); \
|
||||
NS_IMETHOD GetCurrentProfile(nsString& aReturn); \
|
||||
NS_IMETHOD MigrateProfile(const nsString& aProfileName); \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMPROFILECORE(_to) \
|
||||
NS_IMETHOD CreateNewProfile(const nsString& aData) { return _to CreateNewProfile(aData); } \
|
||||
NS_IMETHOD RenameProfile(const nsString& aOldName, const nsString& aNewName) { return _to RenameProfile(aOldName, aNewName); } \
|
||||
NS_IMETHOD DeleteProfile(const nsString& aProfileName, const nsString& aDeleteFlag) { return _to DeleteProfile(aProfileName, aDeleteFlag); } \
|
||||
NS_IMETHOD GetProfileList(nsString& aReturn) { return _to GetProfileList(aReturn); } \
|
||||
NS_IMETHOD StartCommunicator(const nsString& aProfileName) { return _to StartCommunicator(aProfileName); } \
|
||||
NS_IMETHOD GetCurrentProfile(nsString& aReturn) { return _to GetCurrentProfile(aReturn); } \
|
||||
NS_IMETHOD MigrateProfile(const nsString& aProfileName) { return _to MigrateProfile(aProfileName); } \
|
||||
|
||||
|
||||
extern "C" NS_DOM nsresult NS_InitProfileCoreClass(nsIScriptContext *aContext, void **aPrototype);
|
||||
|
||||
extern "C" NS_DOM nsresult NS_NewScriptProfileCore(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
|
||||
|
||||
#endif // nsIDOMProfileCore_h__
|
@ -29,16 +29,13 @@ REQUIRES = txtsvc
|
||||
|
||||
CPPSRCS = \
|
||||
nsBaseAppCore.cpp \
|
||||
nsProfileCore.cpp \
|
||||
nsAppCoresNameSet.cpp \
|
||||
nsToolkitCore.cpp \
|
||||
nsProfileCoreFactory.cpp \
|
||||
nsToolkitCoreFactory.cpp \
|
||||
nsAppCoresManager.cpp \
|
||||
nsAppCoresManagerFactory.cpp \
|
||||
nsJSBaseAppCore.cpp \
|
||||
nsJSAppCoresManager.cpp \
|
||||
nsJSProfileCore.cpp \
|
||||
nsJSToolkitCore.cpp \
|
||||
nsJSBrowserAppCore.cpp \
|
||||
nsAppCores.cpp \
|
||||
|
@ -75,16 +75,13 @@ LLIBS = \
|
||||
|
||||
OBJS = \
|
||||
.\$(OBJDIR)\nsBaseAppCore.obj \
|
||||
.\$(OBJDIR)\nsProfileCore.obj \
|
||||
.\$(OBJDIR)\nsAppCoresNameSet.obj \
|
||||
.\$(OBJDIR)\nsToolkitCore.obj \
|
||||
.\$(OBJDIR)\nsToolkitCoreFactory.obj \
|
||||
.\$(OBJDIR)\nsProfileCoreFactory.obj \
|
||||
.\$(OBJDIR)\nsAppCoresManager.obj \
|
||||
.\$(OBJDIR)\nsAppCoresManagerFactory.obj \
|
||||
.\$(OBJDIR)\nsJSBaseAppCore.obj \
|
||||
.\$(OBJDIR)\nsJSAppCoresManager.obj \
|
||||
.\$(OBJDIR)\nsJSProfileCore.obj \
|
||||
.\$(OBJDIR)\nsJSToolkitCore.obj \
|
||||
.\$(OBJDIR)\nsAppCores.obj \
|
||||
$(NULL)
|
||||
|
@ -21,7 +21,6 @@
|
||||
|
||||
#include "nsAppCoresCIDs.h"
|
||||
#include "nsAppCoresManagerFactory.h"
|
||||
#include "nsProfileCoreFactory.h"
|
||||
#include "nsToolkitCoreFactory.h"
|
||||
#include "nsIFactory.h"
|
||||
#include "nsIComponentManager.h"
|
||||
@ -33,7 +32,6 @@ static PRInt32 gInstanceCnt = 0;
|
||||
|
||||
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
|
||||
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
static NS_DEFINE_IID(kProfileCoreCID, NS_PROFILECORE_CID);
|
||||
static NS_DEFINE_IID(kToolkitCoreCID, NS_TOOLKITCORE_CID);
|
||||
static NS_DEFINE_IID(kAppCoresManagerCID, NS_APPCORESMANAGER_CID);
|
||||
|
||||
@ -53,7 +51,6 @@ NSRegisterSelf(nsISupports* serviceMgr, const char *path)
|
||||
{
|
||||
printf("*** AppCores object is being registered\n");
|
||||
nsComponentManager::RegisterComponent(kAppCoresManagerCID, NULL, NULL, path, PR_TRUE, PR_TRUE);
|
||||
nsComponentManager::RegisterComponent(kProfileCoreCID, NULL, NULL, path, PR_TRUE, PR_TRUE);
|
||||
nsComponentManager::RegisterComponent(kToolkitCoreCID, NULL, NULL, path, PR_TRUE, PR_TRUE);
|
||||
|
||||
return NS_OK;
|
||||
@ -65,7 +62,6 @@ NSUnregisterSelf(nsISupports* serviceMgr, const char *path)
|
||||
printf("*** AppCores object is being unregistered\n");
|
||||
|
||||
nsComponentManager::UnregisterComponent(kAppCoresManagerCID, path);
|
||||
nsComponentManager::UnregisterComponent(kProfileCoreCID, path);
|
||||
nsComponentManager::UnregisterComponent(kToolkitCoreCID, path);
|
||||
|
||||
return NS_OK;
|
||||
@ -92,10 +88,6 @@ NSGetFactory(nsISupports* serviceMgr,
|
||||
{
|
||||
inst = new nsAppCoresManagerFactory();
|
||||
}
|
||||
else if ( aClass.Equals(kProfileCoreCID) )
|
||||
{
|
||||
inst = new nsProfileCoreFactory();
|
||||
}
|
||||
else if ( aClass.Equals(kToolkitCoreCID) )
|
||||
{
|
||||
inst = new nsToolkitCoreFactory();
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include "nsIScriptNameSpaceManager.h"
|
||||
#include "nsIDOMAppCoresManager.h"
|
||||
#include "nsIDOMToolkitCore.h"
|
||||
#include "nsIDOMProfileCore.h"
|
||||
#include "nsIDOMBrowserAppCore.h"
|
||||
#include "nsAppCoresCIDs.h"
|
||||
|
||||
@ -34,7 +33,6 @@
|
||||
static NS_DEFINE_IID(kIScriptExternalNameSetIID, NS_ISCRIPTEXTERNALNAMESET_IID);
|
||||
static NS_DEFINE_IID(kAppCoresCID, NS_APPCORESMANAGER_CID);
|
||||
static NS_DEFINE_IID(kToolkitCoreCID, NS_TOOLKITCORE_CID);
|
||||
static NS_DEFINE_IID(kProfileCoreCID, NS_PROFILECORE_CID);
|
||||
|
||||
nsAppCoresNameSet::nsAppCoresNameSet()
|
||||
{
|
||||
@ -58,7 +56,6 @@ nsAppCoresNameSet::InitializeClasses(nsIScriptContext* aScriptContext)
|
||||
result = NS_InitAppCoresManagerClass(aScriptContext, nsnull);
|
||||
if (NS_OK != result) return result;
|
||||
|
||||
result = NS_InitProfileCoreClass(aScriptContext, nsnull);
|
||||
result = NS_InitToolkitCoreClass(aScriptContext, nsnull);
|
||||
|
||||
return result;
|
||||
@ -76,12 +73,6 @@ nsAppCoresNameSet::AddNameSet(nsIScriptContext* aScriptContext)
|
||||
result = aScriptContext->GetNameSpaceManager(&manager);
|
||||
if (NS_OK == result)
|
||||
{
|
||||
result = manager->RegisterGlobalName("ProfileCore",
|
||||
kProfileCoreCID,
|
||||
PR_TRUE);
|
||||
|
||||
if (NS_OK != result) return result;
|
||||
|
||||
result = manager->RegisterGlobalName("ToolkitCore",
|
||||
kToolkitCoreCID,
|
||||
PR_TRUE);
|
||||
|
@ -1,679 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nscore.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIJSScriptObject.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIDOMProfileCore.h"
|
||||
#include "nsIScriptNameSpaceManager.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIJSNativeInitializer.h"
|
||||
#include "nsDOMCID.h"
|
||||
|
||||
|
||||
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
|
||||
static NS_DEFINE_IID(kIJSScriptObjectIID, NS_IJSSCRIPTOBJECT_IID);
|
||||
static NS_DEFINE_IID(kIScriptGlobalObjectIID, NS_ISCRIPTGLOBALOBJECT_IID);
|
||||
static NS_DEFINE_IID(kIProfileCoreIID, NS_IDOMPROFILECORE_IID);
|
||||
|
||||
NS_DEF_PTR(nsIDOMProfileCore);
|
||||
|
||||
|
||||
/***********************************************************************/
|
||||
//
|
||||
// ProfileCore Properties Getter
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
GetProfileCoreProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
nsIDOMProfileCore *a = (nsIDOMProfileCore*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
if (nsnull == a) {
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
|
||||
nsCOMPtr<nsIScriptSecurityManager> secMan;
|
||||
if (NS_OK != scriptCX->GetSecurityManager(getter_AddRefs(secMan))) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
default:
|
||||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, id, vp);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, id, vp);
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
/***********************************************************************/
|
||||
//
|
||||
// ProfileCore Properties Setter
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
SetProfileCoreProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
nsIDOMProfileCore *a = (nsIDOMProfileCore*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
if (nsnull == a) {
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
|
||||
nsCOMPtr<nsIScriptSecurityManager> secMan;
|
||||
if (NS_OK != scriptCX->GetSecurityManager(getter_AddRefs(secMan))) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
default:
|
||||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, id, vp);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, id, vp);
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// ProfileCore finalizer
|
||||
//
|
||||
PR_STATIC_CALLBACK(void)
|
||||
FinalizeProfileCore(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
nsJSUtils::nsGenericFinalize(cx, obj);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// ProfileCore enumerate
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
EnumerateProfileCore(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
return nsJSUtils::nsGenericEnumerate(cx, obj);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// ProfileCore resolve
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
ResolveProfileCore(JSContext *cx, JSObject *obj, jsval id)
|
||||
{
|
||||
return nsJSUtils::nsGenericResolve(cx, obj, id);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Native method CreateNewProfile
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
ProfileCoreCreateNewProfile(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMProfileCore *nativeThis = (nsIDOMProfileCore*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
nsAutoString b0;
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
|
||||
nsCOMPtr<nsIScriptSecurityManager> secMan;
|
||||
if (NS_OK != scriptCX->GetSecurityManager(getter_AddRefs(secMan))) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
{
|
||||
PRBool ok;
|
||||
secMan->CheckScriptAccess(scriptCX, obj, "profilecore.createnewprofile",PR_FALSE , &ok);
|
||||
if (!ok) {
|
||||
//Need to throw error here
|
||||
return JS_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
if (nsnull == nativeThis) {
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
{
|
||||
if (argc < 1) {
|
||||
JS_ReportError(cx, "Function CreateNewProfile requires 1 parameter");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
nsJSUtils::nsConvertJSValToString(b0, cx, argv[0]);
|
||||
|
||||
if (NS_OK != nativeThis->CreateNewProfile(b0)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
*rval = JSVAL_VOID;
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Native method RenameProfile
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
ProfileCoreRenameProfile(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMProfileCore *nativeThis = (nsIDOMProfileCore*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
nsAutoString b0;
|
||||
nsAutoString b1;
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
|
||||
nsCOMPtr<nsIScriptSecurityManager> secMan;
|
||||
if (NS_OK != scriptCX->GetSecurityManager(getter_AddRefs(secMan))) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
{
|
||||
PRBool ok;
|
||||
secMan->CheckScriptAccess(scriptCX, obj, "profilecore.renameprofile",PR_FALSE , &ok);
|
||||
if (!ok) {
|
||||
//Need to throw error here
|
||||
return JS_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
if (nsnull == nativeThis) {
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
{
|
||||
if (argc < 2) {
|
||||
JS_ReportError(cx, "Function RenameProfile requires 2 parameters");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
nsJSUtils::nsConvertJSValToString(b0, cx, argv[0]);
|
||||
nsJSUtils::nsConvertJSValToString(b1, cx, argv[1]);
|
||||
|
||||
if (NS_OK != nativeThis->RenameProfile(b0, b1)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
*rval = JSVAL_VOID;
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Native method DeleteProfile
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
ProfileCoreDeleteProfile(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMProfileCore *nativeThis = (nsIDOMProfileCore*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
nsAutoString b0;
|
||||
nsAutoString b1;
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
|
||||
nsCOMPtr<nsIScriptSecurityManager> secMan;
|
||||
if (NS_OK != scriptCX->GetSecurityManager(getter_AddRefs(secMan))) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
{
|
||||
PRBool ok;
|
||||
secMan->CheckScriptAccess(scriptCX, obj, "profilecore.deleteprofile",PR_FALSE , &ok);
|
||||
if (!ok) {
|
||||
//Need to throw error here
|
||||
return JS_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
if (nsnull == nativeThis) {
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
{
|
||||
if (argc < 2) {
|
||||
JS_ReportError(cx, "Function DeleteProfile requires 2 parameters");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
nsJSUtils::nsConvertJSValToString(b0, cx, argv[0]);
|
||||
nsJSUtils::nsConvertJSValToString(b1, cx, argv[1]);
|
||||
|
||||
if (NS_OK != nativeThis->DeleteProfile(b0, b1)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
*rval = JSVAL_VOID;
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Native method GetProfileList
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
ProfileCoreGetProfileList(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMProfileCore *nativeThis = (nsIDOMProfileCore*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
nsAutoString nativeRet;
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
|
||||
nsCOMPtr<nsIScriptSecurityManager> secMan;
|
||||
if (NS_OK != scriptCX->GetSecurityManager(getter_AddRefs(secMan))) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
{
|
||||
PRBool ok;
|
||||
secMan->CheckScriptAccess(scriptCX, obj, "profilecore.getprofilelist",PR_FALSE , &ok);
|
||||
if (!ok) {
|
||||
//Need to throw error here
|
||||
return JS_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
if (nsnull == nativeThis) {
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
if (NS_OK != nativeThis->GetProfileList(nativeRet)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
nsJSUtils::nsConvertStringToJSVal(nativeRet, cx, rval);
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Native method StartCommunicator
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
ProfileCoreStartCommunicator(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMProfileCore *nativeThis = (nsIDOMProfileCore*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
nsAutoString b0;
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
|
||||
nsCOMPtr<nsIScriptSecurityManager> secMan;
|
||||
if (NS_OK != scriptCX->GetSecurityManager(getter_AddRefs(secMan))) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
{
|
||||
PRBool ok;
|
||||
secMan->CheckScriptAccess(scriptCX, obj, "profilecore.startcommunicator",PR_FALSE , &ok);
|
||||
if (!ok) {
|
||||
//Need to throw error here
|
||||
return JS_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
if (nsnull == nativeThis) {
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
{
|
||||
if (argc < 1) {
|
||||
JS_ReportError(cx, "Function StartCommunicator requires 1 parameter");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
nsJSUtils::nsConvertJSValToString(b0, cx, argv[0]);
|
||||
|
||||
if (NS_OK != nativeThis->StartCommunicator(b0)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
*rval = JSVAL_VOID;
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Native method GetCurrentProfile
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
ProfileCoreGetCurrentProfile(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMProfileCore *nativeThis = (nsIDOMProfileCore*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
nsAutoString nativeRet;
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
|
||||
nsCOMPtr<nsIScriptSecurityManager> secMan;
|
||||
if (NS_OK != scriptCX->GetSecurityManager(getter_AddRefs(secMan))) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
{
|
||||
PRBool ok;
|
||||
secMan->CheckScriptAccess(scriptCX, obj, "profilecore.getcurrentprofile",PR_FALSE , &ok);
|
||||
if (!ok) {
|
||||
//Need to throw error here
|
||||
return JS_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
if (nsnull == nativeThis) {
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
if (NS_OK != nativeThis->GetCurrentProfile(nativeRet)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
nsJSUtils::nsConvertStringToJSVal(nativeRet, cx, rval);
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Native method MigrateProfile
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
ProfileCoreMigrateProfile(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMProfileCore *nativeThis = (nsIDOMProfileCore*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
nsAutoString b0;
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
|
||||
nsCOMPtr<nsIScriptSecurityManager> secMan;
|
||||
if (NS_OK != scriptCX->GetSecurityManager(getter_AddRefs(secMan))) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
{
|
||||
PRBool ok;
|
||||
secMan->CheckScriptAccess(scriptCX, obj, "profilecore.migrateprofile",PR_FALSE , &ok);
|
||||
if (!ok) {
|
||||
//Need to throw error here
|
||||
return JS_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
if (nsnull == nativeThis) {
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
{
|
||||
if (argc < 1) {
|
||||
JS_ReportError(cx, "Function MigrateProfile requires 1 parameter");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
nsJSUtils::nsConvertJSValToString(b0, cx, argv[0]);
|
||||
|
||||
if (NS_OK != nativeThis->MigrateProfile(b0)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
*rval = JSVAL_VOID;
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************/
|
||||
//
|
||||
// class for ProfileCore
|
||||
//
|
||||
JSClass ProfileCoreClass = {
|
||||
"ProfileCore",
|
||||
JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS,
|
||||
JS_PropertyStub,
|
||||
JS_PropertyStub,
|
||||
GetProfileCoreProperty,
|
||||
SetProfileCoreProperty,
|
||||
EnumerateProfileCore,
|
||||
ResolveProfileCore,
|
||||
JS_ConvertStub,
|
||||
FinalizeProfileCore
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// ProfileCore class properties
|
||||
//
|
||||
static JSPropertySpec ProfileCoreProperties[] =
|
||||
{
|
||||
{0}
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// ProfileCore class methods
|
||||
//
|
||||
static JSFunctionSpec ProfileCoreMethods[] =
|
||||
{
|
||||
{"CreateNewProfile", ProfileCoreCreateNewProfile, 1},
|
||||
{"RenameProfile", ProfileCoreRenameProfile, 2},
|
||||
{"DeleteProfile", ProfileCoreDeleteProfile, 2},
|
||||
{"GetProfileList", ProfileCoreGetProfileList, 0},
|
||||
{"StartCommunicator", ProfileCoreStartCommunicator, 1},
|
||||
{"GetCurrentProfile", ProfileCoreGetCurrentProfile, 0},
|
||||
{"MigrateProfile", ProfileCoreMigrateProfile, 1},
|
||||
{0}
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// ProfileCore constructor
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
ProfileCore(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsresult result;
|
||||
nsIID classID;
|
||||
nsIScriptContext* context = (nsIScriptContext*)JS_GetContextPrivate(cx);
|
||||
nsIScriptNameSpaceManager* manager;
|
||||
nsIDOMProfileCore *nativeThis;
|
||||
nsIScriptObjectOwner *owner = nsnull;
|
||||
nsIJSNativeInitializer* initializer = nsnull;
|
||||
|
||||
static NS_DEFINE_IID(kIDOMProfileCoreIID, NS_IDOMPROFILECORE_IID);
|
||||
static NS_DEFINE_IID(kIJSNativeInitializerIID, NS_IJSNATIVEINITIALIZER_IID);
|
||||
|
||||
result = context->GetNameSpaceManager(&manager);
|
||||
if (NS_OK != result) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
result = manager->LookupName("ProfileCore", PR_TRUE, classID);
|
||||
NS_RELEASE(manager);
|
||||
if (NS_OK != result) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
result = nsComponentManager::CreateInstance(classID,
|
||||
nsnull,
|
||||
kIDOMProfileCoreIID,
|
||||
(void **)&nativeThis);
|
||||
if (NS_OK != result) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
result = nativeThis->QueryInterface(kIJSNativeInitializerIID, (void **)&initializer);
|
||||
if (NS_OK == result) {
|
||||
result = initializer->Initialize(cx, argc, argv);
|
||||
NS_RELEASE(initializer);
|
||||
|
||||
if (NS_OK != result) {
|
||||
NS_RELEASE(nativeThis);
|
||||
return JS_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
result = nativeThis->QueryInterface(kIScriptObjectOwnerIID, (void **)&owner);
|
||||
if (NS_OK != result) {
|
||||
NS_RELEASE(nativeThis);
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
owner->SetScriptObject((void *)obj);
|
||||
JS_SetPrivate(cx, obj, nativeThis);
|
||||
|
||||
NS_RELEASE(owner);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
//
|
||||
// ProfileCore class initialization
|
||||
//
|
||||
extern "C" NS_DOM nsresult NS_InitProfileCoreClass(nsIScriptContext *aContext, void **aPrototype)
|
||||
{
|
||||
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
|
||||
JSObject *proto = nsnull;
|
||||
JSObject *constructor = nsnull;
|
||||
JSObject *parent_proto = nsnull;
|
||||
JSObject *global = JS_GetGlobalObject(jscontext);
|
||||
jsval vp;
|
||||
|
||||
if ((PR_TRUE != JS_LookupProperty(jscontext, global, "ProfileCore", &vp)) ||
|
||||
!JSVAL_IS_OBJECT(vp) ||
|
||||
((constructor = JSVAL_TO_OBJECT(vp)) == nsnull) ||
|
||||
(PR_TRUE != JS_LookupProperty(jscontext, JSVAL_TO_OBJECT(vp), "prototype", &vp)) ||
|
||||
!JSVAL_IS_OBJECT(vp)) {
|
||||
|
||||
if (NS_OK != NS_InitBaseAppCoreClass(aContext, (void **)&parent_proto)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
proto = JS_InitClass(jscontext, // context
|
||||
global, // global object
|
||||
parent_proto, // parent proto
|
||||
&ProfileCoreClass, // JSClass
|
||||
ProfileCore, // JSNative ctor
|
||||
0, // ctor args
|
||||
ProfileCoreProperties, // proto props
|
||||
ProfileCoreMethods, // proto funcs
|
||||
nsnull, // ctor props (static)
|
||||
nsnull); // ctor funcs (static)
|
||||
if (nsnull == proto) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
}
|
||||
else if ((nsnull != constructor) && JSVAL_IS_OBJECT(vp)) {
|
||||
proto = JSVAL_TO_OBJECT(vp);
|
||||
}
|
||||
else {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (aPrototype) {
|
||||
*aPrototype = proto;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Method for creating a new ProfileCore JavaScript object
|
||||
//
|
||||
extern "C" NS_DOM nsresult NS_NewScriptProfileCore(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aContext && nsnull != aSupports && nsnull != aReturn, "null argument to NS_NewScriptProfileCore");
|
||||
JSObject *proto;
|
||||
JSObject *parent;
|
||||
nsIScriptObjectOwner *owner;
|
||||
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
|
||||
nsresult result = NS_OK;
|
||||
nsIDOMProfileCore *aProfileCore;
|
||||
|
||||
if (nsnull == aParent) {
|
||||
parent = nsnull;
|
||||
}
|
||||
else if (NS_OK == aParent->QueryInterface(kIScriptObjectOwnerIID, (void**)&owner)) {
|
||||
if (NS_OK != owner->GetScriptObject(aContext, (void **)&parent)) {
|
||||
NS_RELEASE(owner);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
NS_RELEASE(owner);
|
||||
}
|
||||
else {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (NS_OK != NS_InitProfileCoreClass(aContext, (void **)&proto)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
result = aSupports->QueryInterface(kIProfileCoreIID, (void **)&aProfileCore);
|
||||
if (NS_OK != result) {
|
||||
return result;
|
||||
}
|
||||
|
||||
// create a js object for this class
|
||||
*aReturn = JS_NewObject(jscontext, &ProfileCoreClass, proto, parent);
|
||||
if (nsnull != *aReturn) {
|
||||
// connect the native object to the js object
|
||||
JS_SetPrivate(jscontext, (JSObject *)*aReturn, aProfileCore);
|
||||
}
|
||||
else {
|
||||
NS_RELEASE(aProfileCore);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
@ -1,244 +0,0 @@
|
||||
|
||||
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS"
|
||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
||||
* the License for the specific language governing rights and limitations
|
||||
* under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
* Netscape Communications Corporation. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#include "nsProfileCore.h"
|
||||
|
||||
#include "nsIProfile.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsIFileLocator.h"
|
||||
#include "nsFileLocations.h"
|
||||
#include "nsFileSpec.h"
|
||||
#include "nsFileStream.h"
|
||||
#include "nsIBrowserWindow.h"
|
||||
#include "nsIWebShell.h"
|
||||
#include "pratom.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsAppCores.h"
|
||||
#include "nsAppCoresCIDs.h"
|
||||
#include "nsAppShellCIDs.h"
|
||||
#include "nsAppCoresManager.h"
|
||||
#include "nsIAppShellService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIScriptContextOwner.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIWebShellWindow.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
|
||||
#include "plstr.h"
|
||||
#include "prmem.h"
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
class nsIDOMnsStringArray;
|
||||
// Globals - how many K are we wasting by putting these in every file?
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIProfileCoreIID, NS_IDOMPROFILECORE_IID);
|
||||
|
||||
static NS_DEFINE_IID(kIDOMDocumentIID, nsIDOMDocument::GetIID());
|
||||
static NS_DEFINE_IID(kIDocumentIID, nsIDocument::GetIID());
|
||||
static NS_DEFINE_IID(kIAppShellServiceIID, NS_IAPPSHELL_SERVICE_IID);
|
||||
|
||||
static NS_DEFINE_IID(kProfileCoreCID, NS_PROFILECORE_CID);
|
||||
static NS_DEFINE_IID(kBrowserWindowCID, NS_BROWSER_WINDOW_CID);
|
||||
static NS_DEFINE_IID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID);
|
||||
|
||||
static NS_DEFINE_IID(kIProfileIID, NS_IPROFILE_IID);
|
||||
static NS_DEFINE_CID(kProfileCID, NS_PROFILE_CID);
|
||||
|
||||
static NS_DEFINE_IID(kIFileLocatorIID, NS_IFILELOCATOR_IID);
|
||||
static NS_DEFINE_CID(kFileLocatorCID, NS_FILELOCATOR_CID);
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsProfileCore::nsProfileCore()
|
||||
//----------------------------------------------------------------------------------------
|
||||
: mProfile(nsnull)
|
||||
{
|
||||
printf("Created nsProfileCore\n");
|
||||
mScriptObject = nsnull;
|
||||
|
||||
IncInstanceCount();
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsProfileCore::~nsProfileCore()
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
//NS_IF_RELEASE(mWindow);
|
||||
DecInstanceCount();
|
||||
}
|
||||
|
||||
//NS_IMPL_ADDREF(nsProfileCore)
|
||||
//NS_IMPL_RELEASE(nsProfileCore)
|
||||
|
||||
// Is this needed ?
|
||||
NS_IMPL_ISUPPORTS_INHERITED(nsProfileCore, nsBaseAppCore, nsIDOMProfileCore)
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
NS_IMETHODIMP nsProfileCore::GetScriptObject(nsIScriptContext *aContext, void** aScriptObject)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aScriptObject, "null arg");
|
||||
nsresult res = NS_OK;
|
||||
if (nsnull == mScriptObject)
|
||||
{
|
||||
res = NS_NewScriptProfileCore(aContext,
|
||||
(nsISupports *)(nsIDOMProfileCore*)this,
|
||||
nsnull,
|
||||
&mScriptObject);
|
||||
}
|
||||
*aScriptObject = mScriptObject;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
nsresult nsProfileCore::InitializeProfileManager()
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
nsIProfile* Profile;
|
||||
nsresult rv = nsServiceManager::GetService(kProfileCID, kIProfileIID, (nsISupports**)&Profile);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
if (!Profile)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (Profile)
|
||||
nsServiceManager::ReleaseService(kProfileCID, Profile);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
mProfile = Profile;
|
||||
return NS_OK;
|
||||
} // nsProfileCore::InitializeProfileManager
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
NS_IMETHODIMP nsProfileCore::Init(const nsString& aId)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
nsresult rv = nsBaseAppCore::Init(aId);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
rv = InitializeProfileManager();
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
return NS_OK;
|
||||
} // nsProfileCore::Init
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
NS_IMETHODIMP nsProfileCore::CreateNewProfile(const nsString& aData)
|
||||
// Start loading of a new Profile panel.
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
printf ("Entered Create Profile Routine");
|
||||
|
||||
mProfile->CreateNewProfile(aData.ToNewCString());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
NS_IMETHODIMP nsProfileCore::RenameProfile(const nsString& oldName, const nsString& newName)
|
||||
// Start loading of a new Profile panel.
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
printf ("Entered Rename Profile Routine\n");
|
||||
|
||||
printf ("Change profileName from -> %s <- to -> %s <-\n", oldName.ToNewCString(), newName.ToNewCString());
|
||||
|
||||
mProfile->RenameProfile(oldName.ToNewCString(), newName.ToNewCString());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
NS_IMETHODIMP nsProfileCore::DeleteProfile(const nsString& profileName, const nsString& deleteFlag)
|
||||
// Start loading of a new Profile panel.
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
printf ("Entered Delete Profile Routine\n");
|
||||
|
||||
printf ("Requesting deletion of profile -> %s <-\n", profileName.ToNewCString());
|
||||
|
||||
mProfile->DeleteProfile(profileName.ToNewCString(), deleteFlag.ToNewCString());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
NS_IMETHODIMP nsProfileCore::GetProfileList(nsString& profileList)
|
||||
// Start loading of a new Profile panel.
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
printf ("Entered GetProfileList Routine\n");
|
||||
|
||||
mProfile->GetProfileList(profileList);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
NS_IMETHODIMP nsProfileCore::StartCommunicator(const nsString& profileName)
|
||||
// Start loading of a new Profile panel.
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
printf ("Entered Start AppRunner Routine\n");
|
||||
|
||||
printf ("Run AppRunner with profile -> %s <-\n", profileName.ToNewCString());
|
||||
|
||||
mProfile->StartCommunicator(profileName.ToNewCString());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
NS_IMETHODIMP nsProfileCore::GetCurrentProfile(nsString& currProfile)
|
||||
// Start loading of a new Profile panel.
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
printf ("Entered GetCurrentProfile Routine\n");
|
||||
|
||||
mProfile->GetCurrProfile(currProfile);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
NS_IMETHODIMP nsProfileCore::MigrateProfile(const nsString& profileName)
|
||||
// Start loading of a new Profile panel.
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
#ifdef XP_PC
|
||||
printf ("Entered Migrate Profile Routine\n");
|
||||
|
||||
printf ("Requesting migration of profile -> %s <-\n", profileName.ToNewCString());
|
||||
|
||||
mProfile->MigrateProfile(profileName.ToNewCString());
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
@ -1,155 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
|
||||
*
|
||||
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
|
||||
* http://www.mozilla.org/NPL/
|
||||
|
||||
*
|
||||
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
|
||||
* for the specific language governing rights and limitations under the
|
||||
|
||||
* NPL.
|
||||
|
||||
*
|
||||
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
|
||||
* Reserved.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef nsProfileCorePrivate_h___
|
||||
|
||||
#define nsProfileCorePrivate_h___
|
||||
|
||||
|
||||
|
||||
//#include "nsAppCores.h"
|
||||
|
||||
|
||||
|
||||
#include "nscore.h"
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
|
||||
|
||||
#include "nsIDOMProfileCore.h"
|
||||
|
||||
#include "nsBaseAppCore.h"
|
||||
|
||||
#include "prtypes.h"
|
||||
|
||||
|
||||
|
||||
class nsIBrowserWindow;
|
||||
|
||||
class nsIWebShell;
|
||||
|
||||
class nsIScriptContext;
|
||||
|
||||
class nsIDOMWindow;
|
||||
|
||||
class nsIProfile;
|
||||
|
||||
class nsIDOMNode;
|
||||
|
||||
class nsIDOMHTMLInputElement;
|
||||
|
||||
class nsString;
|
||||
|
||||
class nsIDOMnsStringArray;
|
||||
|
||||
|
||||
|
||||
//========================================================================================
|
||||
|
||||
class nsProfileCore
|
||||
|
||||
//========================================================================================
|
||||
|
||||
: public nsBaseAppCore
|
||||
|
||||
, public nsIDOMProfileCore
|
||||
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
|
||||
nsProfileCore();
|
||||
|
||||
virtual ~nsProfileCore();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
|
||||
|
||||
NS_IMETHOD Init(const nsString& aId);
|
||||
|
||||
NS_IMETHOD GetId(nsString& aId)
|
||||
|
||||
{
|
||||
|
||||
return nsBaseAppCore::GetId(aId);
|
||||
|
||||
}
|
||||
|
||||
NS_IMETHOD SetDocumentCharset(const nsString& aCharset)
|
||||
|
||||
{
|
||||
|
||||
return nsBaseAppCore::SetDocumentCharset(aCharset);
|
||||
|
||||
}
|
||||
|
||||
NS_IMETHOD CreateNewProfile(const nsString& aData);
|
||||
NS_IMETHOD RenameProfile(const nsString& oldName, const nsString& newName);
|
||||
NS_IMETHOD DeleteProfile(const nsString& profileName, const nsString& deleteFlag);
|
||||
|
||||
NS_IMETHOD GetProfileList(nsString& profileList);
|
||||
NS_IMETHOD StartCommunicator(const nsString& profileName);
|
||||
NS_IMETHOD GetCurrentProfile(nsString& currProfile);
|
||||
NS_IMETHOD MigrateProfile(const nsString& profileName);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
nsresult InitializeProfileManager();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
nsIProfile* mProfile;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // nsProfileCore_h___
|
||||
|
@ -1,190 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
|
||||
*
|
||||
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
|
||||
* Version 1.0 (the "License"); you may not use this file except in
|
||||
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
|
||||
* http://www.mozilla.org/NPL/
|
||||
|
||||
*
|
||||
|
||||
* Software distributed under the License is distributed on an "AS IS"
|
||||
|
||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
||||
|
||||
* the License for the specific language governing rights and limitations
|
||||
|
||||
* under the License.
|
||||
|
||||
*
|
||||
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
|
||||
*
|
||||
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
|
||||
* Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
|
||||
* Netscape Communications Corporation. All Rights Reserved.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "nsProfileCoreFactory.h"
|
||||
|
||||
|
||||
|
||||
#include "nsAppCores.h"
|
||||
|
||||
#include "nsProfileCore.h"
|
||||
|
||||
#include "pratom.h"
|
||||
|
||||
#include "nsISupportsUtils.h"
|
||||
|
||||
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
nsProfileCoreFactory::nsProfileCoreFactory()
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
{
|
||||
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
IncInstanceCount();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
nsProfileCoreFactory::~nsProfileCoreFactory()
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
{
|
||||
|
||||
DecInstanceCount();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMPL_ADDREF(nsProfileCoreFactory)
|
||||
|
||||
NS_IMPL_RELEASE(nsProfileCoreFactory)
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
NS_IMETHODIMP nsProfileCoreFactory::QueryInterface(REFNSIID aIID,void** aInstancePtr)
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
{
|
||||
|
||||
if (aInstancePtr == NULL)
|
||||
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
|
||||
|
||||
// Always NULL result, in case of failure
|
||||
|
||||
*aInstancePtr = NULL;
|
||||
|
||||
|
||||
|
||||
if ( aIID.Equals(kISupportsIID) )
|
||||
|
||||
*aInstancePtr = (void*) this;
|
||||
|
||||
else if ( aIID.Equals(kIFactoryIID) )
|
||||
|
||||
*aInstancePtr = (void*) this;
|
||||
|
||||
|
||||
|
||||
if (aInstancePtr == NULL)
|
||||
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
|
||||
|
||||
|
||||
AddRef();
|
||||
|
||||
return NS_OK;
|
||||
|
||||
} // nsProfileCoreFactory::QueryInterface
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
NS_IMETHODIMP nsProfileCoreFactory::CreateInstance(
|
||||
|
||||
nsISupports* aOuter,
|
||||
|
||||
REFNSIID aIID,
|
||||
|
||||
void **aResult)
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
{
|
||||
if (aResult == NULL)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
*aResult = NULL;
|
||||
static nsProfileCore* inst = new nsProfileCore();
|
||||
if (!inst)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
nsresult result = inst->QueryInterface(aIID, aResult);
|
||||
|
||||
if (result != NS_OK)
|
||||
{
|
||||
delete inst;
|
||||
inst = 0;
|
||||
aResult = 0;
|
||||
}
|
||||
return result;
|
||||
} // nsProfileCoreFactory::CreateInstance
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
NS_IMETHODIMP nsProfileCoreFactory::LockFactory(PRBool aLock)
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
{
|
||||
|
||||
if (aLock)
|
||||
|
||||
IncLockCount();
|
||||
|
||||
else
|
||||
|
||||
DecLockCount();
|
||||
|
||||
return NS_OK;
|
||||
|
||||
} // nsProfileCoreFactory::LockFactory
|
||||
|
@ -1,94 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
|
||||
*
|
||||
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
|
||||
* http://www.mozilla.org/NPL/
|
||||
|
||||
*
|
||||
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
|
||||
* for the specific language governing rights and limitations under the
|
||||
|
||||
* NPL.
|
||||
|
||||
*
|
||||
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
|
||||
* Reserved.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef nsProfileCoreFactory_h___
|
||||
|
||||
#define nsProfileCoreFactory_h___
|
||||
|
||||
|
||||
|
||||
//#include "nscore.h"
|
||||
|
||||
//#include "nsString.h"
|
||||
|
||||
#include "nsIFactory.h"
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
|
||||
|
||||
//========================================================================================
|
||||
|
||||
class nsProfileCoreFactory : public nsIFactory
|
||||
|
||||
//========================================================================================
|
||||
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
|
||||
nsProfileCoreFactory();
|
||||
|
||||
virtual ~nsProfileCoreFactory();
|
||||
|
||||
|
||||
|
||||
PRBool CanUnload(void);
|
||||
|
||||
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
|
||||
|
||||
NS_IMETHOD CreateInstance(nsISupports *aOuter,
|
||||
|
||||
REFNSIID aIID,
|
||||
|
||||
void **aResult);
|
||||
|
||||
|
||||
|
||||
NS_IMETHOD LockFactory(PRBool aLock);
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // nsProfileCoreFactory_h___
|
||||
|
@ -45,7 +45,6 @@
|
||||
static NS_DEFINE_CID(kAppCoresManagerCID, NS_APPCORESMANAGER_CID);
|
||||
static NS_DEFINE_CID(kToolkitCoreCID, NS_TOOLKITCORE_CID);
|
||||
static NS_DEFINE_CID(kDOMPropsCoreCID, NS_DOMPROPSCORE_CID);
|
||||
static NS_DEFINE_CID(kProfileCoreCID, NS_PROFILECORE_CID);
|
||||
static NS_DEFINE_CID(kBrowserAppCoreCID, NS_BROWSERAPPCORE_CID);
|
||||
static NS_DEFINE_CID(kRDFCoreCID, NS_RDFCORE_CID);
|
||||
static NS_DEFINE_CID(kSessionHistoryCID, NS_SESSION_HISTORY_CID);
|
||||
@ -138,7 +137,6 @@ NS_SetupRegistry_1()
|
||||
nsComponentManager::RegisterComponentLib(kAppCoresManagerCID, NULL, NULL, APPCORES_DLL, PR_FALSE, PR_FALSE);
|
||||
nsComponentManager::RegisterComponentLib(kToolkitCoreCID, NULL, NULL, APPCORES_DLL, PR_FALSE, PR_FALSE);
|
||||
nsComponentManager::RegisterComponentLib(kDOMPropsCoreCID, NULL, NULL, APPCORES_DLL, PR_FALSE, PR_FALSE);
|
||||
nsComponentManager::RegisterComponentLib(kProfileCoreCID, NULL, NULL, APPCORES_DLL, PR_FALSE, PR_FALSE);
|
||||
nsComponentManager::RegisterComponentLib(kBrowserAppCoreCID, NULL, NULL, APPCORES_DLL, PR_FALSE, PR_FALSE);
|
||||
nsComponentManager::RegisterComponentLib(kRDFCoreCID, NULL, NULL, APPCORES_DLL, PR_FALSE, PR_FALSE);
|
||||
|
||||
|
@ -3123,7 +3123,7 @@ nsBookmarksService::GetBookmarksFile(nsFileSpec* aResult)
|
||||
}
|
||||
} while (0);
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef DEBUG_
|
||||
if (NS_FAILED(rv)) {
|
||||
*aResult = nsSpecialSystemDirectory(nsSpecialSystemDirectory::OS_CurrentProcessDirectory);
|
||||
*aResult += "chrome";
|
||||
|
@ -83,4 +83,3 @@ include $(topsrcdir)/config/rules.mk
|
||||
|
||||
install::
|
||||
$(INSTALL) $(EXPORT_RESOURCE_CONTENT) $(DIST)/bin/chrome/global/skin/default
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user