Bug 722868 - Part 1: Add the deleteTemporaryPrivateFileWhenPossible API; r=bzbarsky

This commit is contained in:
Ehsan Akhgari 2012-04-24 22:56:55 -04:00
Родитель af83f12073
Коммит e74fa60a30
3 изменённых файлов: 28 добавлений и 6 удалений

Просмотреть файл

@ -923,7 +923,10 @@ NS_IMETHODIMP nsExternalHelperAppService::GetApplicationDescription(const nsACSt
// Methods related to deleting temporary files on exit
//////////////////////////////////////////////////////////////////////////////////////////////////////
NS_IMETHODIMP nsExternalHelperAppService::DeleteTemporaryFileOnExit(nsIFile * aTemporaryFile)
/* static */
nsresult
nsExternalHelperAppService::DeleteTemporaryFileHelper(nsIFile * aTemporaryFile,
nsCOMArray<nsILocalFile> &aFileList)
{
bool isFile = false;
@ -931,14 +934,23 @@ NS_IMETHODIMP nsExternalHelperAppService::DeleteTemporaryFileOnExit(nsIFile * aT
aTemporaryFile->IsFile(&isFile);
if (!isFile) return NS_OK;
if (mInPrivateBrowsing)
mTemporaryPrivateFilesList.AppendObject(aTemporaryFile);
else
mTemporaryFilesList.AppendObject(aTemporaryFile);
aFileList.AppendObject(localFile);
return NS_OK;
}
NS_IMETHODIMP
nsExternalHelperAppService::DeleteTemporaryFileOnExit(nsIFile* aTemporaryFile)
{
return DeleteTemporaryFileHelper(aTemporaryFile, mTemporaryFilesList);
}
NS_IMETHODIMP
nsExternalHelperAppService::DeleteTemporaryPrivateFileWhenPossible(nsIFile* aTemporaryFile)
{
return DeleteTemporaryFileHelper(aTemporaryFile, mTemporaryPrivateFilesList);
}
void nsExternalHelperAppService::FixFilePermissions(nsIFile* aFile)
{
// This space intentionally left blank

Просмотреть файл

@ -172,6 +172,11 @@ protected:
* Helper function for ExpungeTemporaryFiles and ExpungeTemporaryPrivateFiles
*/
static void ExpungeTemporaryFilesHelper(nsCOMArray<nsIFile> &fileList);
/**
* Helper function for DeleteTemporaryFileOnExit and DeleteTemporaryPrivateFileWhenPossible
*/
static nsresult DeleteTemporaryFileHelper(nsIFile* aTemporaryFile,
nsCOMArray<nsILocalFile> &aFileList);
/**
* Functions related to the tempory file cleanup service provided by
* nsExternalHelperAppService

Просмотреть файл

@ -53,7 +53,7 @@ interface nsIExternalHelperAppService : nsISupports
* This is a private interface shared between external app handlers and the platform specific
* external helper app service
*/
[scriptable, uuid(d0b5d7d3-9565-403d-9fb5-e5089c4567c6)]
[scriptable, uuid(6613e2e7-feab-4e3a-bb1f-b03200d544ec)]
interface nsPIExternalAppLauncher : nsISupports
{
/**
@ -62,6 +62,11 @@ interface nsPIExternalAppLauncher : nsISupports
* @param aTemporaryFile A temporary file we should delete on exit.
*/
void deleteTemporaryFileOnExit(in nsIFile aTemporaryFile);
/**
* Delete a temporary file created inside private browsing mode when
* the private browsing mode has ended.
*/
void deleteTemporaryPrivateFileWhenPossible(in nsIFile aTemporaryFile);
};
/**