toolkit/xre/nsAppRunner.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/xre/nsAppRunner.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,123 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef nsAppRunner_h__
    1.10 +#define nsAppRunner_h__
    1.11 +
    1.12 +#ifdef XP_WIN
    1.13 +#include <windows.h>
    1.14 +#else
    1.15 +#include <limits.h>
    1.16 +#endif
    1.17 +
    1.18 +#ifndef MAXPATHLEN
    1.19 +#ifdef PATH_MAX
    1.20 +#define MAXPATHLEN PATH_MAX
    1.21 +#elif defined(_MAX_PATH)
    1.22 +#define MAXPATHLEN _MAX_PATH
    1.23 +#elif defined(CCHMAXPATH)
    1.24 +#define MAXPATHLEN CCHMAXPATH
    1.25 +#else
    1.26 +#define MAXPATHLEN 1024
    1.27 +#endif
    1.28 +#endif
    1.29 +
    1.30 +#include "nscore.h"
    1.31 +#include "nsXULAppAPI.h"
    1.32 +
    1.33 +// This directory service key is a lot like NS_APP_LOCALSTORE_50_FILE,
    1.34 +// but it is always the "main" localstore file, even when we're in safe mode
    1.35 +// and we load localstore from somewhere else.
    1.36 +#define NS_LOCALSTORE_UNSAFE_FILE "LStoreS"
    1.37 +
    1.38 +class nsACString;
    1.39 +struct nsStaticModuleInfo;
    1.40 +
    1.41 +class nsINativeAppSupport;
    1.42 +class nsICmdLineService;
    1.43 +class nsXREDirProvider;
    1.44 +class nsIToolkitProfileService;
    1.45 +class nsIFile;
    1.46 +class nsIProfileLock;
    1.47 +class nsIProfileUnlocker;
    1.48 +class nsIFactory;
    1.49 +
    1.50 +extern nsXREDirProvider* gDirServiceProvider;
    1.51 +
    1.52 +// NOTE: gAppData will be null in embedded contexts. The "size" parameter
    1.53 +// will be the size of the original structure passed to XRE_main, but the
    1.54 +// structure will have all of the members available.
    1.55 +extern const nsXREAppData* gAppData;
    1.56 +extern bool gSafeMode;
    1.57 +
    1.58 +extern int    gArgc;
    1.59 +extern char **gArgv;
    1.60 +extern int    gRestartArgc;
    1.61 +extern char **gRestartArgv;
    1.62 +extern bool gLogConsoleErrors;
    1.63 +
    1.64 +/**
    1.65 + * Create the nativeappsupport implementation.
    1.66 + *
    1.67 + * @note XPCOMInit has not happened yet.
    1.68 + */
    1.69 +nsresult NS_CreateNativeAppSupport(nsINativeAppSupport* *aResult);
    1.70 +
    1.71 +NS_HIDDEN_(nsresult)
    1.72 +NS_NewToolkitProfileService(nsIToolkitProfileService* *aResult);
    1.73 +
    1.74 +NS_HIDDEN_(nsresult)
    1.75 +NS_NewToolkitProfileFactory(nsIFactory* *aResult);
    1.76 +
    1.77 +/**
    1.78 + * Try to acquire exclusive access to the specified profile directory.
    1.79 + *
    1.80 + * @param aPath
    1.81 + *        The profile directory to lock.
    1.82 + * @param aTempPath
    1.83 + *        The corresponding profile temporary directory.
    1.84 + * @param aUnlocker
    1.85 + *        A callback interface used to attempt to unlock a profile that
    1.86 + *        appears to be locked.
    1.87 + * @param aResult
    1.88 + *        The resulting profile lock object (or null if the profile could
    1.89 + *        not be locked).
    1.90 + *
    1.91 + * @return NS_ERROR_FILE_ACCESS_DENIED to indicate that the profile
    1.92 + *         directory cannot be unlocked.
    1.93 + */
    1.94 +NS_HIDDEN_(nsresult)
    1.95 +NS_LockProfilePath(nsIFile* aPath, nsIFile* aTempPath,
    1.96 +                   nsIProfileUnlocker* *aUnlocker, nsIProfileLock* *aResult);
    1.97 +
    1.98 +NS_HIDDEN_(void)
    1.99 +WriteConsoleLog();
   1.100 +
   1.101 +#ifdef XP_WIN
   1.102 +BOOL
   1.103 +WinLaunchChild(const wchar_t *exePath, int argc,
   1.104 +               char **argv, HANDLE userToken = nullptr,
   1.105 +               HANDLE *hProcess = nullptr);
   1.106 +BOOL
   1.107 +WriteStatusPending(LPCWSTR updateDirPath);
   1.108 +BOOL
   1.109 +WriteStatusApplied(LPCWSTR updateDirPath);
   1.110 +#endif
   1.111 +
   1.112 +#define NS_NATIVEAPPSUPPORT_CONTRACTID "@mozilla.org/toolkit/native-app-support;1"
   1.113 +
   1.114 +namespace mozilla {
   1.115 +namespace startup {
   1.116 +extern GeckoProcessType sChildProcessType;
   1.117 +}
   1.118 +}
   1.119 +
   1.120 +/**
   1.121 + * Set up platform specific error handling such as suppressing DLL load dialog
   1.122 + * and the JIT debugger on Windows, and install unix signal handlers.
   1.123 + */
   1.124 +void SetupErrorHandling(const char* progname);
   1.125 +
   1.126 +#endif // nsAppRunner_h__

mercurial