зеркало из https://github.com/mozilla/pjs.git
Bug 46866.
This commit is contained in:
Родитель
32498b8af3
Коммит
d015f6354e
Двоичные данные
profile/macbuild/ProfileServicesIDL.mcp
Двоичные данные
profile/macbuild/ProfileServicesIDL.mcp
Двоичный файл не отображается.
|
@ -30,6 +30,7 @@ MODULE = profile
|
|||
|
||||
XPIDLSRCS = \
|
||||
nsIProfile.idl \
|
||||
nsIProfileInternal.idl \
|
||||
nsIProfileStartupListener.idl \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ EXPORTS=nsIAccount.h \
|
|||
|
||||
XPIDLSRCS = \
|
||||
.\nsIProfile.idl \
|
||||
.\nsIProfileInternal.idl \
|
||||
.\nsIProfileStartupListener.idl \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -23,10 +23,8 @@
|
|||
#include "nsISupports.idl"
|
||||
#include "nsIFile.idl"
|
||||
|
||||
interface nsICmdLineService;
|
||||
|
||||
%{C++
|
||||
#include "nsICmdLineService.h"
|
||||
|
||||
#define NS_PROFILE_CID \
|
||||
{ /* {02b0625b-e7f3-11d2-9f5a-006008a6efe9} */ \
|
||||
|
@ -45,60 +43,21 @@ interface nsICmdLineService;
|
|||
|
||||
[scriptable, uuid(02b0625a-e7f3-11d2-9f5a-006008a6efe9)]
|
||||
interface nsIProfile : nsISupports {
|
||||
[noscript] void startupWithArgs(in nsICmdLineService cmdLine);
|
||||
void startup(in wstring filename);
|
||||
|
||||
[noscript] void getProfileDir(in wstring profileName,
|
||||
out nsIFile profileDir);
|
||||
readonly attribute long profileCount;
|
||||
readonly attribute wstring currentProfile;
|
||||
readonly attribute wstring firstProfile;
|
||||
|
||||
// eventually we need to depricate getCurrentProfileDir
|
||||
[noscript] void getCurrentProfileDir(out nsIFile profileDir);
|
||||
|
||||
[noscript] void setProfileDir(in wstring profileName,
|
||||
in nsIFile profileDir);
|
||||
|
||||
boolean profileExists(in wstring profileName);
|
||||
|
||||
void migrateProfileInfo();
|
||||
readonly attribute long profileCount;
|
||||
void getProfileList(out unsigned long length, [retval, array, size_is(length)] out wstring profileNames);
|
||||
boolean profileExists(in wstring profileName);
|
||||
|
||||
readonly attribute wstring currentProfile;
|
||||
|
||||
void createNewProfile(in wstring profileName,
|
||||
in wstring nativeProfileDir,
|
||||
in wstring langcode,
|
||||
in boolean useExistingDir);
|
||||
in boolean useExistingDir);
|
||||
|
||||
void renameProfile(in wstring oldName, in wstring newName);
|
||||
|
||||
void deleteProfile(in wstring name, in boolean canDeleteFiles);
|
||||
|
||||
wstring getProfileList();
|
||||
|
||||
void startApprunner(in wstring profileName);
|
||||
|
||||
void migrateProfile(in wstring profileName, in boolean showProgressAsModalWindow);
|
||||
|
||||
long get4xProfileCount();
|
||||
|
||||
void migrateAllProfiles();
|
||||
void cloneProfile(in wstring profileName);
|
||||
void forgetCurrentProfile();
|
||||
void loadNewProfilePrefs();
|
||||
boolean isCurrentProfileAvailable();
|
||||
|
||||
attribute boolean automigrate;
|
||||
|
||||
readonly attribute nsIFile defaultProfileParentDir;
|
||||
|
||||
[noscript] void updateRegistry(in nsIFile regName);
|
||||
void setRegStrings(in wstring profileName,
|
||||
in wstring regString,
|
||||
in wstring regName,
|
||||
in wstring regEmail,
|
||||
in wstring regOption);
|
||||
string isRegStringSet(in wstring profileName);
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsIProfile_h__ */
|
||||
|
|
|
@ -316,6 +316,7 @@ NS_IMPL_THREADSAFE_RELEASE(nsProfile)
|
|||
NS_INTERFACE_MAP_BEGIN(nsProfile)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIProfile)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIProfile)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIProfileInternal)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDirectoryServiceProvider)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
|
@ -1094,7 +1095,7 @@ nsProfile::AddLevelOfIndirection(nsIFile *aDir)
|
|||
*/
|
||||
|
||||
// Sets the current profile directory
|
||||
NS_IMETHODIMP nsProfile::SetProfileDir(const PRUnichar *profileName, nsIFile *profileDir)
|
||||
nsresult nsProfile::SetProfileDir(const PRUnichar *profileName, nsIFile *profileDir)
|
||||
{
|
||||
NS_ENSURE_ARG(profileName);
|
||||
NS_ENSURE_ARG(profileDir);
|
||||
|
@ -1476,16 +1477,26 @@ NS_IMETHODIMP nsProfile::DeleteProfile(const PRUnichar* profileName, PRBool canD
|
|||
return rv;
|
||||
}
|
||||
|
||||
// Get the list of all profiles
|
||||
// Populate the input param.
|
||||
// This method is written to support the core service
|
||||
// call to get the names all profiles.
|
||||
NS_IMETHODIMP nsProfile::GetProfileList(PRUnichar **profileListStr)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(profileListStr);
|
||||
|
||||
gProfileDataAccess->GetProfileList(profileListStr);
|
||||
return NS_OK;
|
||||
NS_IMETHODIMP nsProfile::GetProfileList(PRUint32 *length, PRUnichar ***profileNames)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(length);
|
||||
*length = 0;
|
||||
NS_ENSURE_ARG_POINTER(profileNames);
|
||||
*profileNames = nsnull;
|
||||
|
||||
return gProfileDataAccess->GetProfileList(nsIProfileInternal::LIST_ONLY_NEW, length, profileNames);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsProfile::GetProfileListX(PRUint32 whichKind, PRUint32 *length, PRUnichar ***profileNames)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(length);
|
||||
*length = 0;
|
||||
NS_ENSURE_ARG_POINTER(profileNames);
|
||||
*profileNames = nsnull;
|
||||
|
||||
return gProfileDataAccess->GetProfileList(whichKind, length, profileNames);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1532,7 +1543,7 @@ NS_IMETHODIMP nsProfile::StartApprunner(const PRUnichar* profileName)
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsProfile::LoadNewProfilePrefs()
|
||||
nsresult nsProfile::LoadNewProfilePrefs()
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIPref, prefs, kPrefCID, &rv);
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
*/
|
||||
|
||||
#include "nsIProfile.h"
|
||||
#include "nsIProfileInternal.h"
|
||||
#include "nsIProfileStartupListener.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsISupports.h"
|
||||
|
@ -57,11 +58,12 @@
|
|||
#define REGISTRY_VERSION_STRING "Version"
|
||||
#define REGISTRY_VERSION_1_0 "1.0"
|
||||
|
||||
class nsProfile: public nsIProfile,
|
||||
class nsProfile: public nsIProfileInternal,
|
||||
public nsIDirectoryServiceProvider
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIPROFILE
|
||||
NS_DECL_NSIPROFILEINTERNAL
|
||||
NS_DECL_NSIDIRECTORYSERVICEPROVIDER
|
||||
|
||||
private:
|
||||
|
@ -73,6 +75,8 @@ private:
|
|||
nsIFile *newProfDir,
|
||||
const char *fileName);
|
||||
nsresult EnsureProfileFileExists(nsIFile *aFile);
|
||||
nsresult LoadNewProfilePrefs();
|
||||
nsresult SetProfileDir(const PRUnichar *profileName, nsIFile *profileDir);
|
||||
|
||||
nsresult CloneProfileDirectorySpec(nsILocalFile **aLocalFile);
|
||||
nsresult AddLevelOfIndirection(nsIFile *aDir);
|
||||
|
|
|
@ -1155,31 +1155,74 @@ nsProfileAccess::UpdateRegistry(nsIFile* regName)
|
|||
return rv;
|
||||
}
|
||||
|
||||
// Return the list of profiles, 4x and 5x.
|
||||
// Return the list of profiles, 4x, 5x, or both.
|
||||
// For 4x profiles text "- migrate" is appended
|
||||
// to inform the JavaScript about the migration status.
|
||||
void
|
||||
nsProfileAccess::GetProfileList(PRUnichar **profileListStr)
|
||||
nsresult
|
||||
nsProfileAccess::GetProfileList(PRInt32 whichKind, PRUint32 *length, PRUnichar ***result)
|
||||
{
|
||||
NS_ASSERTION(profileListStr, "Invalid profileListStr pointer");
|
||||
NS_ENSURE_ARG_POINTER(length);
|
||||
*length = 0;
|
||||
NS_ENSURE_ARG_POINTER(result);
|
||||
*result = nsnull;
|
||||
|
||||
nsAutoString profileList;
|
||||
|
||||
for (PRInt32 index=0; index < mCount; index++)
|
||||
nsresult rv = NS_OK;
|
||||
PRInt32 count, localLength = 0;
|
||||
PRUnichar **outArray, **next;
|
||||
|
||||
switch (whichKind)
|
||||
{
|
||||
case nsIProfileInternal::LIST_ONLY_NEW:
|
||||
count = mNumProfiles;
|
||||
break;
|
||||
case nsIProfileInternal::LIST_ONLY_OLD:
|
||||
GetNum4xProfiles(&count);
|
||||
break;
|
||||
case nsIProfileInternal::LIST_ALL:
|
||||
count = mCount;
|
||||
break;
|
||||
default:
|
||||
NS_ASSERTION(PR_FALSE, "Bad parameter");
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
next = outArray = (PRUnichar **)nsMemory::Alloc(count * sizeof(PRUnichar *));
|
||||
if (!outArray)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
for (PRInt32 index=0; index < mCount && localLength < count; index++)
|
||||
{
|
||||
ProfileStruct* profileItem = (ProfileStruct *) (mProfiles->ElementAt(index));
|
||||
PRBool isMigrated = profileItem->isMigrated.EqualsWithConversion(REGISTRY_YES_STRING);
|
||||
|
||||
if (whichKind == nsIProfileInternal::LIST_ONLY_OLD && isMigrated)
|
||||
continue;
|
||||
else if (whichKind == nsIProfileInternal::LIST_ONLY_NEW && !isMigrated)
|
||||
continue;
|
||||
|
||||
if (index != 0)
|
||||
*next = profileItem->profileName.ToNewUnicode();
|
||||
if (*next == nsnull)
|
||||
{
|
||||
profileList.AppendWithConversion(",");
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
break;
|
||||
}
|
||||
profileList += profileItem->profileName;
|
||||
|
||||
if (profileItem->isMigrated.EqualsWithConversion(REGISTRY_NO_STRING))
|
||||
profileList.AppendWithConversion(" - migrate");
|
||||
next++;
|
||||
localLength++;
|
||||
}
|
||||
|
||||
*profileListStr = profileList.ToNewUnicode();
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
*result = outArray;
|
||||
*length = localLength;
|
||||
}
|
||||
else
|
||||
{
|
||||
while (--next >= outArray)
|
||||
nsMemory::Free(*next);
|
||||
nsMemory::Free(outArray);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Return a boolean based on the profile existence.
|
||||
|
|
|
@ -112,7 +112,7 @@ public:
|
|||
PRInt32 FindProfileIndex(const PRUnichar* profileName);
|
||||
|
||||
nsresult UpdateRegistry(nsIFile* regName);
|
||||
void GetProfileList(PRUnichar **profileListStr);
|
||||
nsresult GetProfileList(PRInt32 whichKind, PRUint32 *length, PRUnichar ***result);
|
||||
PRBool ProfileExists(const PRUnichar *profileName);
|
||||
nsresult Get4xProfileInfo(const char *registryName);
|
||||
nsresult UpdateProfileArray();
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
#include <sys/param.h>
|
||||
#endif
|
||||
|
||||
#include "nsIProfile.h"
|
||||
#include "nsIProfileInternal.h"
|
||||
#include "nsIPrefMigration.h" // for NEW_IMAPMAIL_DIR_NAME, etc
|
||||
|
||||
#include "plstr.h"
|
||||
|
@ -185,7 +185,7 @@ static PRBool GetProfileDirectory(nsFileSpec& outSpec)
|
|||
{
|
||||
// First time, initialize gProfileDir
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIProfile, profileService, kProfileCID, &rv);
|
||||
NS_WITH_SERVICE(nsIProfileInternal, profileService, kProfileCID, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return PR_FALSE;
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
|
|||
#endif
|
||||
|
||||
// header file for profile manager
|
||||
#include "nsIProfile.h"
|
||||
#include "nsIProfileInternal.h"
|
||||
|
||||
#if defined(XP_UNIX)
|
||||
extern void InstallUnixSignalHandlers(const char *ProgramName);
|
||||
|
@ -802,7 +802,7 @@ static nsresult InitializeProfileService(nsICmdLineService *cmdLineArgs)
|
|||
}
|
||||
else
|
||||
{
|
||||
nsCOMPtr<nsIProfile> profileMgr = do_GetService(kProfileCID, &rv);
|
||||
nsCOMPtr<nsIProfileInternal> profileMgr = do_GetService(kProfileCID, &rv);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to get profile manager");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче