Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions
nsInstall.cpp File Reference
#include "nscore.h"
#include "nsIFactory.h"
#include "nsISupports.h"
#include "nsNativeCharsetUtils.h"
#include "nsIComponentManager.h"
#include "nsIServiceManager.h"
#include "nsHashtable.h"
#include "nsIFileChannel.h"
#include "nsDirectoryService.h"
#include "nsDirectoryServiceDefs.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsDirectoryServiceUtils.h"
#include "nsNetUtil.h"
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
#include "prmem.h"
#include "plstr.h"
#include "prprf.h"
#include "nsCRT.h"
#include "VerReg.h"
#include "nsInstall.h"
#include "nsInstallFolder.h"
#include "nsInstallVersion.h"
#include "nsInstallFile.h"
#include "nsInstallExecute.h"
#include "nsInstallPatch.h"
#include "nsInstallUninstall.h"
#include "nsInstallResources.h"
#include "nsXPIProxy.h"
#include "nsRegisterItem.h"
#include "ScheduledTasks.h"
#include "nsIPersistentProperties2.h"
#include "nsIProxyObjectManager.h"
#include "nsProxiedService.h"
#include "nsInstallFileOpEnums.h"
#include "nsInstallFileOpItem.h"
#include "nsILocalFile.h"
#include "nsIURL.h"

Go to the source code of this file.

Defines

#define kInstallLocaleProperties   "chrome://global/locale/commonDialogs.properties"

Functions

static NS_DEFINE_IID (kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID)
static NS_DEFINE_IID (kProxyObjectManagerCID, NS_PROXYEVENT_MANAGER_CID)
static NS_DEFINE_CID (kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID)
static void NS_SoftwareUpdateRequestAutoReg ()
 Request that XPCOM perform an autoreg at startup.
static NS_DEFINE_IID (kSoftwareUpdateCID, NS_SoftwareUpdate_CID)
PRUnicharGetTranslatedString (const PRUnichar *aString)

Define Documentation

#define kInstallLocaleProperties   "chrome://global/locale/commonDialogs.properties"

Definition at line 118 of file nsInstall.cpp.


Function Documentation

Definition at line 2582 of file nsInstall.cpp.

{
    nsCOMPtr<nsIStringBundleService> stringService = do_GetService(kStringBundleServiceCID);
    nsCOMPtr<nsIStringBundle> stringBundle;
    PRUnichar* translatedString;

    nsresult rv = stringService->CreateBundle(kInstallLocaleProperties, getter_AddRefs(stringBundle));
    if (NS_FAILED(rv)) return nsnull;

    rv = stringBundle->GetStringFromName(aString, &translatedString);
    if (NS_FAILED(rv)) return nsnull;

    return translatedString;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static NS_DEFINE_CID ( kStringBundleServiceCID  ,
NS_STRINGBUNDLESERVICE_CID   
) [static]
static NS_DEFINE_IID ( kProxyObjectManagerCID  ,
NS_PROXYEVENT_MANAGER_CID   
) [static]
static NS_DEFINE_IID ( kSoftwareUpdateCID  ,
NS_SoftwareUpdate_CID   
) [static]

Request that XPCOM perform an autoreg at startup.

(Used internally by XPI.) This basically drops a file next to the application. The next time the application launches, XPCOM sees the file, deletes it and autoregisters components.

Definition at line 127 of file nsInstall.cpp.

{
  nsresult rv;
  nsCOMPtr<nsIFile> file;

  if (nsSoftwareUpdate::GetProgramDirectory())
    // xpistub case, use target directory instead
    nsSoftwareUpdate::GetProgramDirectory()->Clone(getter_AddRefs(file));
  else
    NS_GetSpecialDirectory(NS_XPCOM_CURRENT_PROCESS_DIR,
                           getter_AddRefs(file));

  if (!file) {
    NS_WARNING("Getting NS_XPCOM_CURRENT_PROCESS_DIR failed");
    return;
  }

  file->AppendNative(nsDependentCString(".autoreg"));
#ifdef DEBUG_timeless
  PRBool condition;
  if (NS_SUCCEEDED(file->IsDirectory(&condition)) && condition) {
    /* someone did this intentionally, no point in complaining */
    return;
  }
#endif

  // Remove and recreate the file to update its timestamp.
  // .autoreg must be newer than compreg.dat for component registration
  // to occur.

  file->Remove(PR_FALSE);
  rv = file->Create(nsIFile::NORMAL_FILE_TYPE, 0666);

  if (NS_FAILED(rv)) {
    NS_WARNING("creating file failed");
    return;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function: