Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes
nsInstallExecute Class Reference

#include <nsInstallExecute.h>

Inheritance diagram for nsInstallExecute:
Inheritance graph
[legend]
Collaboration diagram for nsInstallExecute:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsInstallExecute (nsInstall *inInstall, const nsString &inJarLocation, const nsString &inArgs, const PRBool inBlocking, PRInt32 *error)
virtual ~nsInstallExecute ()
PRInt32 Prepare ()
PRInt32 Complete ()
void Abort ()
char * toString ()
PRBool CanUninstall ()
PRBool RegisterPackageNode ()

Protected Attributes

nsInstallmInstall

Private Member Functions

PRInt32 NativeComplete (void)
void NativeAbort (void)

Private Attributes

nsString mJarLocation
nsString mArgs
nsCOMPtr< nsIFilemExecutableFile
PRBool mBlocking
PRUint32mPid

Detailed Description

Definition at line 56 of file nsInstallExecute.h.


Constructor & Destructor Documentation

nsInstallExecute::nsInstallExecute ( nsInstall inInstall,
const nsString inJarLocation,
const nsString inArgs,
const PRBool  inBlocking,
PRInt32 error 
)

Definition at line 153 of file nsInstallExecute.cpp.

: nsInstallObject(inInstall)
{
    MOZ_COUNT_CTOR(nsInstallExecute);

    if ((inInstall == nsnull) || (inJarLocation.IsEmpty()) )
    {
        *error = nsInstall::INVALID_ARGUMENTS;
        return;
    }

    mJarLocation        = inJarLocation;
    mArgs               = inArgs;
    mExecutableFile     = nsnull;
    mBlocking           = inBlocking;
    mPid                = nsnull;
}

Definition at line 177 of file nsInstallExecute.cpp.


Member Function Documentation

Implements nsInstallObject.

Definition at line 251 of file nsInstallExecute.cpp.

{
    /* Get the names */
    if (mExecutableFile == nsnull) 
        return;

    DeleteFileNowOrSchedule(mExecutableFile);
}

Here is the call graph for this function:

Implements nsInstallObject.

Definition at line 301 of file nsInstallExecute.cpp.

{
    return PR_FALSE;
}

Implements nsInstallObject.

Definition at line 193 of file nsInstallExecute.cpp.

{
   #define ARG_SLOTS       256

   PRInt32 result = NS_OK;
   PRInt32 rv = nsInstall::SUCCESS;
   char *cArgs[ARG_SLOTS];
   int   argcount = 0;

   if (mExecutableFile == nsnull)
      return nsInstall::INVALID_ARGUMENTS;

   nsCOMPtr<nsIProcess> process = do_CreateInstance(kIProcessCID);

   char *arguments = nsnull;
   if (!mArgs.IsEmpty())
   {
      arguments = ToNewCString(mArgs);
      argcount = xpi_PrepareProcessArguments(arguments, cArgs, ARG_SLOTS);
   }
   if (argcount >= 0)
   {
      result = process->Init(mExecutableFile);
      if (NS_SUCCEEDED(result))
      {
         result = process->Run(mBlocking, (const char**)&cArgs, argcount, mPid);
         if (NS_SUCCEEDED(result))
         {
            if (mBlocking)
            {
               process->GetExitValue(&result);
               if (result != 0)
                  rv = nsInstall::EXECUTION_ERROR;

               // should be OK to delete now since execution done
               DeleteFileNowOrSchedule( mExecutableFile );
            }
            else
            {
               // don't try to delete now since execution is async
               ScheduleFileForDeletion( mExecutableFile );
            }
         }
         else
            rv = nsInstall::EXECUTION_ERROR;
      }
      else
         rv = nsInstall::EXECUTION_ERROR;
   }
   else
      rv = nsInstall::UNEXPECTED_ERROR;

   if(arguments)
      Recycle(arguments);

   return rv;
}

Here is the call graph for this function:

Implements nsInstallObject.

Definition at line 185 of file nsInstallExecute.cpp.

Here is the call graph for this function:

Implements nsInstallObject.

Definition at line 307 of file nsInstallExecute.cpp.

{
    return PR_FALSE;
}
char * nsInstallExecute::toString ( ) [virtual]

Implements nsInstallObject.

Definition at line 260 of file nsInstallExecute.cpp.

{
    char* buffer = new char[1024];
    char* rsrcVal = nsnull;

    if (buffer == nsnull || !mInstall)
        return nsnull;

    // if the FileSpec is NULL, just us the in jar file name.

    if (mExecutableFile == nsnull)
    {
        char *tempString = ToNewCString(mJarLocation);
        rsrcVal = mInstall->GetResourcedString(NS_LITERAL_STRING("Execute"));

        if (rsrcVal)
        {
            sprintf( buffer, rsrcVal, tempString);
            nsCRT::free(rsrcVal);
        }
        
        if (tempString)
            Recycle(tempString);
    }
    else
    {
        rsrcVal = mInstall->GetResourcedString(NS_LITERAL_STRING("Execute"));

        if (rsrcVal)
        {
            nsCAutoString temp;
            mExecutableFile->GetNativePath(temp);
            sprintf( buffer, rsrcVal, temp.get());
            nsCRT::free(rsrcVal);
        }
    }
    return buffer;
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 81 of file nsInstallExecute.h.

Definition at line 84 of file nsInstallExecute.h.

Definition at line 83 of file nsInstallExecute.h.

nsInstall* nsInstallObject::mInstall [protected, inherited]

Definition at line 69 of file nsInstallObject.h.

Definition at line 80 of file nsInstallExecute.h.

Definition at line 85 of file nsInstallExecute.h.


The documentation for this class was generated from the following files: