diff --git a/build/mac/NGLayoutBuildList.pm b/build/mac/NGLayoutBuildList.pm index ab4436b0288c..47573c7dfe18 100644 --- a/build/mac/NGLayoutBuildList.pm +++ b/build/mac/NGLayoutBuildList.pm @@ -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"); diff --git a/profile/Makefile.in b/profile/Makefile.in index 5d61a31e96a7..20a47b34c416 100644 --- a/profile/Makefile.in +++ b/profile/Makefile.in @@ -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 diff --git a/profile/idlservices/.cvsignore b/profile/idlservices/.cvsignore deleted file mode 100644 index f3c7a7c5da68..000000000000 --- a/profile/idlservices/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -Makefile diff --git a/profile/idlservices/MANIFEST b/profile/idlservices/MANIFEST deleted file mode 100644 index 252b9398937b..000000000000 --- a/profile/idlservices/MANIFEST +++ /dev/null @@ -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 \ No newline at end of file diff --git a/profile/idlservices/Makefile.in b/profile/idlservices/Makefile.in deleted file mode 100644 index 77406fb4437c..000000000000 --- a/profile/idlservices/Makefile.in +++ /dev/null @@ -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 - diff --git a/profile/idlservices/makefile.win b/profile/idlservices/makefile.win deleted file mode 100644 index 525d86dbee6e..000000000000 --- a/profile/idlservices/makefile.win +++ /dev/null @@ -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 - diff --git a/profile/idlservices/nsIProfileServices.idl b/profile/idlservices/nsIProfileServices.idl deleted file mode 100644 index fe2c7ce94bd0..000000000000 --- a/profile/idlservices/nsIProfileServices.idl +++ /dev/null @@ -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); -%} diff --git a/profile/idlservices/nsProfileServices.cpp b/profile/idlservices/nsProfileServices.cpp deleted file mode 100644 index 5ee6d4cd51ef..000000000000 --- a/profile/idlservices/nsProfileServices.cpp +++ /dev/null @@ -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; -} - diff --git a/profile/idlservices/nsProfileServicesFactory.cpp b/profile/idlservices/nsProfileServicesFactory.cpp deleted file mode 100644 index 8f97ff383e91..000000000000 --- a/profile/idlservices/nsProfileServicesFactory.cpp +++ /dev/null @@ -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 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 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; -} diff --git a/profile/idlservices/xpconnect-profile.html b/profile/idlservices/xpconnect-profile.html deleted file mode 100644 index 1dc1ef546c30..000000000000 --- a/profile/idlservices/xpconnect-profile.html +++ /dev/null @@ -1,43 +0,0 @@ - - -XPConnect Example - - - - - -
- - - - - \ No newline at end of file diff --git a/profile/makefile.win b/profile/makefile.win index 62193c78d081..60187678669d 100644 --- a/profile/makefile.win +++ b/profile/makefile.win @@ -27,7 +27,6 @@ DIRS= \ resources \ pref-migrator \ defaults \ - idlservices \ !if "$(_MSC_VER)" != "" && "$(_MSC_VER)" != "1100" acct \ acctidl \ diff --git a/profile/public/nsIProfile.idl b/profile/public/nsIProfile.idl index cf22b935ef24..a2b3488a8ec6 100644 --- a/profile/public/nsIProfile.idl +++ b/profile/public/nsIProfile.idl @@ -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(); diff --git a/profile/resources/cpw.js b/profile/resources/cpw.js index 5dd6216a7f2c..58a4477fb6df 100644 --- a/profile/resources/cpw.js +++ b/profile/resources/cpw.js @@ -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() diff --git a/profile/resources/pm.js b/profile/resources/pm.js index 7035a8e4b7bd..51bf7cd2b2ab 100644 --- a/profile/resources/pm.js +++ b/profile/resources/pm.js @@ -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++) { diff --git a/profile/src/nsProfile.cpp b/profile/src/nsProfile.cpp index c381e16ebdb6..12f52f7c76e3 100644 --- a/profile/src/nsProfile.cpp +++ b/profile/src/nsProfile.cpp @@ -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; } diff --git a/xpfe/AppCores/idl/ProfileCore.idl b/xpfe/AppCores/idl/ProfileCore.idl deleted file mode 100644 index e9ca1769637b..000000000000 --- a/xpfe/AppCores/idl/ProfileCore.idl +++ /dev/null @@ -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); -}; diff --git a/xpfe/AppCores/idl/makefile.win b/xpfe/AppCores/idl/makefile.win index dd0400094637..e50bfeed2e52 100644 --- a/xpfe/AppCores/idl/makefile.win +++ b/xpfe/AppCores/idl/makefile.win @@ -31,7 +31,6 @@ DEPTH=..\..\.. IDLSRCS= \ AppCoresManager.idl \ BaseAppCore.idl \ - ProfileCore.idl \ ToolkitCore.idl !endif diff --git a/xpfe/AppCores/public/MANIFEST b/xpfe/AppCores/public/MANIFEST index 903e1f91562f..7979c308f51c 100644 --- a/xpfe/AppCores/public/MANIFEST +++ b/xpfe/AppCores/public/MANIFEST @@ -4,7 +4,6 @@ nsIDOMAppCoresManager.h nsIDOMBaseAppCore.h -nsIDOMProfileCore.h nsIDOMToolkitCore.h nsIDOMBrowserAppCore.h nsAppCoresCIDs.h diff --git a/xpfe/AppCores/public/Makefile.in b/xpfe/AppCores/public/Makefile.in index 39fedc6c8e0d..7074d58d7a40 100644 --- a/xpfe/AppCores/public/Makefile.in +++ b/xpfe/AppCores/public/Makefile.in @@ -25,7 +25,6 @@ include $(DEPTH)/config/autoconf.mk EXPORTS = \ nsIDOMAppCoresManager.h \ nsIDOMBaseAppCore.h \ - nsIDOMProfileCore.h \ nsIDOMToolkitCore.h \ nsIDOMBrowserAppCore.h \ nsAppCoresCIDs.h \ diff --git a/xpfe/AppCores/public/makefile.win b/xpfe/AppCores/public/makefile.win index a64c64a2ba54..b4f2651fa850 100644 --- a/xpfe/AppCores/public/makefile.win +++ b/xpfe/AppCores/public/makefile.win @@ -24,7 +24,6 @@ MODULE=appcores EXPORTS= \ nsIDOMAppCoresManager.h \ nsIDOMBaseAppCore.h \ - nsIDOMProfileCore.h \ nsIDOMToolkitCore.h \ nsIDOMBrowserAppCore.h \ nsAppCoresCIDs.h diff --git a/xpfe/AppCores/public/nsIDOMProfileCore.h b/xpfe/AppCores/public/nsIDOMProfileCore.h deleted file mode 100644 index b6630519e41b..000000000000 --- a/xpfe/AppCores/public/nsIDOMProfileCore.h +++ /dev/null @@ -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__ diff --git a/xpfe/AppCores/src/Makefile.in b/xpfe/AppCores/src/Makefile.in index 39743dee3332..67ccc305594f 100644 --- a/xpfe/AppCores/src/Makefile.in +++ b/xpfe/AppCores/src/Makefile.in @@ -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 \ diff --git a/xpfe/AppCores/src/makefile.win b/xpfe/AppCores/src/makefile.win index ddc94f8d2265..86dea08d3f57 100644 --- a/xpfe/AppCores/src/makefile.win +++ b/xpfe/AppCores/src/makefile.win @@ -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) diff --git a/xpfe/AppCores/src/nsAppCores.cpp b/xpfe/AppCores/src/nsAppCores.cpp index 98d347bf5aef..18ebd9724dd7 100644 --- a/xpfe/AppCores/src/nsAppCores.cpp +++ b/xpfe/AppCores/src/nsAppCores.cpp @@ -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(); diff --git a/xpfe/AppCores/src/nsAppCoresNameSet.cpp b/xpfe/AppCores/src/nsAppCoresNameSet.cpp index 1c5f40871510..0c243d1e7a3a 100644 --- a/xpfe/AppCores/src/nsAppCoresNameSet.cpp +++ b/xpfe/AppCores/src/nsAppCoresNameSet.cpp @@ -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); diff --git a/xpfe/AppCores/src/nsJSProfileCore.cpp b/xpfe/AppCores/src/nsJSProfileCore.cpp deleted file mode 100644 index 7beec261567b..000000000000 --- a/xpfe/AppCores/src/nsJSProfileCore.cpp +++ /dev/null @@ -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 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 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 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 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 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 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 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 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 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; -} diff --git a/xpfe/AppCores/src/nsProfileCore.cpp b/xpfe/AppCores/src/nsProfileCore.cpp deleted file mode 100644 index 811554125371..000000000000 --- a/xpfe/AppCores/src/nsProfileCore.cpp +++ /dev/null @@ -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 - -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; -} diff --git a/xpfe/AppCores/src/nsProfileCore.h b/xpfe/AppCores/src/nsProfileCore.h deleted file mode 100644 index b4157cfdfab8..000000000000 --- a/xpfe/AppCores/src/nsProfileCore.h +++ /dev/null @@ -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___ - diff --git a/xpfe/AppCores/src/nsProfileCoreFactory.cpp b/xpfe/AppCores/src/nsProfileCoreFactory.cpp deleted file mode 100644 index c28b62d5b041..000000000000 --- a/xpfe/AppCores/src/nsProfileCoreFactory.cpp +++ /dev/null @@ -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 - diff --git a/xpfe/AppCores/src/nsProfileCoreFactory.h b/xpfe/AppCores/src/nsProfileCoreFactory.h deleted file mode 100644 index 9b1b2f085a3c..000000000000 --- a/xpfe/AppCores/src/nsProfileCoreFactory.h +++ /dev/null @@ -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___ - diff --git a/xpfe/bootstrap/nsSetupRegistry.cpp b/xpfe/bootstrap/nsSetupRegistry.cpp index cb94cadab7ce..31ef925dbcd6 100644 --- a/xpfe/bootstrap/nsSetupRegistry.cpp +++ b/xpfe/bootstrap/nsSetupRegistry.cpp @@ -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); diff --git a/xpfe/components/bookmarks/src/nsBookmarksService.cpp b/xpfe/components/bookmarks/src/nsBookmarksService.cpp index 5429a2f90fc6..2123282998e1 100644 --- a/xpfe/components/bookmarks/src/nsBookmarksService.cpp +++ b/xpfe/components/bookmarks/src/nsBookmarksService.cpp @@ -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"; diff --git a/xpfe/global/resources/skin/Makefile.in b/xpfe/global/resources/skin/Makefile.in index 84a61ff24f84..89cec9ae1e9a 100644 --- a/xpfe/global/resources/skin/Makefile.in +++ b/xpfe/global/resources/skin/Makefile.in @@ -83,4 +83,3 @@ include $(topsrcdir)/config/rules.mk install:: $(INSTALL) $(EXPORT_RESOURCE_CONTENT) $(DIST)/bin/chrome/global/skin/default -