Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions | Variables
nsSoftwareUpdate.cpp File Reference
#include "nscore.h"
#include "nsIGenericFactory.h"
#include "nsIFactory.h"
#include "nsISupports.h"
#include "nsIComponentManager.h"
#include "nsIComponentRegistrar.h"
#include "nsIServiceManager.h"
#include "nsICategoryManager.h"
#include "nsCOMPtr.h"
#include "nsCRT.h"
#include "nsIObserverService.h"
#include "nspr.h"
#include "prlock.h"
#include "nsXPIDLString.h"
#include "NSReg.h"
#include "VerReg.h"
#include "nsIDirectoryService.h"
#include "nsDirectoryServiceDefs.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsInstall.h"
#include "nsSoftwareUpdateIIDs.h"
#include "nsSoftwareUpdate.h"
#include "nsSoftwareUpdateRun.h"
#include "nsInstallTrigger.h"
#include "nsInstallVersion.h"
#include "ScheduledTasks.h"
#include "InstallCleanupDefines.h"
#include "nsXPInstallManager.h"
#include "nsTopProgressNotifier.h"
#include "nsLoggingProgressNotifier.h"
#include "nsBuildID.h"
#include "nsProcess.h"
#include "nsDOMCID.h"
#include "nsIScriptNameSpaceManager.h"
#include "nsIScriptExternalNameSet.h"
#include "nsIEventQueueService.h"
#include "nsIProxyObjectManager.h"
#include "nsProxiedService.h"
#include "nsIChromeRegistry.h"
#include "nsCURILoader.h"

Go to the source code of this file.

Defines

#define NS_SOFTWAREUPDATENAMESET_CID
#define NS_SOFTWAREUPDATENAMESET_CONTRACTID   "@mozilla.org/xpinstall/softwareupdatenameset;1"

Functions

void RunChromeInstallOnThread (void *data)
static NS_DEFINE_CID (kIProcessCID, NS_PROCESS_CID)
 NS_IMPL_THREADSAFE_ISUPPORTS3 (nsSoftwareUpdate, nsISoftwareUpdate, nsPIXPIStubHook, nsIObserver) void nsSoftwareUpdate
 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR (nsSoftwareUpdate, nsSoftwareUpdate::GetInstance) static NS_METHOD RegisterSoftwareUpdate(nsIComponentManager *aCompMgr
 NS_ENSURE_SUCCESS (rv, rv)

Variables

nsIFileaPath
nsIFile const char * registryLocation
nsIFile const char const char * componentType
nsIFile const char const char
const nsModuleComponentInfo
*info nsresult 
rv = NS_OK
nsCOMPtr< nsICategoryManagercatman
nsXPIDLCString previous
return NS_OK
static const nsModuleComponentInfo components []

Define Documentation

Value:
{ 0xcde48010, 0x9494, 0x4a73, \
  { 0x96, 0x9a, 0x26, 0x33, 0x50, 0x0, 0x70, 0xde }}
#define NS_SOFTWAREUPDATENAMESET_CONTRACTID   "@mozilla.org/xpinstall/softwareupdatenameset;1"

Function Documentation

static NS_DEFINE_CID ( kIProcessCID  ,
NS_PROCESS_CID   
) [static]
NS_ENSURE_SUCCESS ( rv  ,
rv   
)

Definition at line 187 of file nsSoftwareUpdate.cpp.

{
    if (mNeedCleanup)
    {
      // Create a non-blocking process to run the native platform cleanup utility
        nsresult rv;
        nsCOMPtr<nsILocalFile> pathToCleanupUtility;
        //Get the program directory
        nsCOMPtr<nsIProperties> directoryService =
                 do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);

        if (nsSoftwareUpdate::GetProgramDirectory()) // In the stub installer
        {
            nsCOMPtr<nsIFile> tmp;
            rv = nsSoftwareUpdate::GetProgramDirectory()->Clone(getter_AddRefs(tmp));
#if defined (XP_MAC)
            tmp->AppendNative(ESSENTIAL_FILES);
#endif
            pathToCleanupUtility = do_QueryInterface(tmp);

        }
        else
        {
            rv = directoryService->Get(NS_APP_INSTALL_CLEANUP_DIR,
                                      NS_GET_IID(nsIFile),
                                      getter_AddRefs(pathToCleanupUtility));
        }

        NS_ASSERTION(pathToCleanupUtility,"No path to cleanup utility in nsSoftwareUpdate::Shutdown()");

        //Create the Process framework
        pathToCleanupUtility->AppendNative(CLEANUP_UTIL);
        nsCOMPtr<nsIProcess> cleanupProcess = do_CreateInstance(kIProcessCID);
        rv = cleanupProcess->Init(pathToCleanupUtility);
        if (NS_SUCCEEDED(rv))
        {
            //Run the cleanup utility as a NON-blocking process
            rv = cleanupProcess->Run(PR_FALSE, nsnull, 0, nsnull);
        }
    }
}

Here is the call graph for this function:

Definition at line 626 of file nsSoftwareUpdateRun.cpp.

{
    nsresult rv;

    NS_ASSERTION(data, "No nsInstallInfo passed to Chrome Install");
    nsInstallInfo *info = (nsInstallInfo*)data;
    nsIXPIListener* listener = info->GetListener();

    if (listener)
        listener->OnInstallStart(info->GetURL());

    // make sure we've got a chrome registry -- can't proceed if not
    CHROMEREG_IFACE* reg = info->GetChromeRegistry();
    NS_ASSERTION(reg, "We shouldn't get here without a chrome registry.");

    if (reg)
    {
#ifdef MOZ_XUL_APP
        if (info->GetType() == CHROME_SKIN) {
            static NS_DEFINE_CID(kZipReaderCID,  NS_ZIPREADER_CID);
            nsCOMPtr<nsIZipReader> hZip = do_CreateInstance(kZipReaderCID, &rv);
            if (hZip)
                rv = hZip->Init(info->GetFile());
            if (NS_SUCCEEDED(rv))
                rv = hZip->Open();

            if (NS_SUCCEEDED(rv))
            {
                rv = hZip->Test("install.rdf");
                nsIExtensionManager* em = info->GetExtensionManager();
                if (NS_SUCCEEDED(rv) && em) {
                    rv = em->InstallItemFromFile(info->GetFile(), 
                                                 NS_INSTALL_LOCATION_APPPROFILE);
                }
            }
            hZip->Close();
            // Extension Manager copies the theme .jar file to 
            // a different location, so remove the temporary file.
            info->GetFile()->Remove(PR_FALSE);
        }
#else
        PRBool isSkin    = (info->GetType() & CHROME_SKIN);
        PRBool isLocale  = (info->GetType() & CHROME_LOCALE);
        PRBool isContent = (info->GetType() & CHROME_CONTENT);
        PRBool selected  = (info->GetFlags() != 0);

        const nsCString& spec = info->GetFileJARSpec();

        if ( isContent )
            rv = reg->InstallPackage(spec.get(), PR_TRUE);

        if ( isSkin )
        {
            rv = reg->InstallSkin(spec.get(), PR_TRUE, PR_FALSE);
                
            if (NS_SUCCEEDED(rv) && selected)
            {
                NS_ConvertUCS2toUTF8 utf8Args(info->GetArguments());
                rv = reg->SelectSkin(utf8Args, PR_TRUE);
            }
        }

        if ( isLocale )
        {
            rv = reg->InstallLocale(spec.get(), PR_TRUE);

            if (NS_SUCCEEDED(rv) && selected)
            {
                NS_ConvertUCS2toUTF8 utf8Args(info->GetArguments());
                rv = reg->SelectLocale(utf8Args, PR_TRUE);
            }
        }

        // now that all types are registered try to activate
        if ( isSkin && selected )
            reg->RefreshSkins();

#ifdef RELOAD_CHROME_WORKS
// XXX ReloadChrome() crashes right now
            if ( isContent || (isLocale && selected) )
                reg->ReloadChrome();
#endif
#endif
    }

    if (listener)
        listener->OnInstallDone(info->GetURL(), nsInstall::SUCCESS);

    delete info;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 519 of file nsSoftwareUpdate.cpp.

Initial value:

Definition at line 526 of file nsSoftwareUpdate.cpp.

Definition at line 548 of file nsSoftwareUpdate.cpp.

Definition at line 519 of file nsSoftwareUpdate.cpp.

Definition at line 543 of file nsSoftwareUpdate.cpp.

Definition at line 530 of file nsSoftwareUpdate.cpp.

Definition at line 519 of file nsSoftwareUpdate.cpp.

rv = NS_OK

Definition at line 524 of file nsSoftwareUpdate.cpp.