michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsAppRunner_h__ michael@0: #define nsAppRunner_h__ michael@0: michael@0: #ifdef XP_WIN michael@0: #include michael@0: #else michael@0: #include michael@0: #endif michael@0: michael@0: #ifndef MAXPATHLEN michael@0: #ifdef PATH_MAX michael@0: #define MAXPATHLEN PATH_MAX michael@0: #elif defined(_MAX_PATH) michael@0: #define MAXPATHLEN _MAX_PATH michael@0: #elif defined(CCHMAXPATH) michael@0: #define MAXPATHLEN CCHMAXPATH michael@0: #else michael@0: #define MAXPATHLEN 1024 michael@0: #endif michael@0: #endif michael@0: michael@0: #include "nscore.h" michael@0: #include "nsXULAppAPI.h" michael@0: michael@0: // This directory service key is a lot like NS_APP_LOCALSTORE_50_FILE, michael@0: // but it is always the "main" localstore file, even when we're in safe mode michael@0: // and we load localstore from somewhere else. michael@0: #define NS_LOCALSTORE_UNSAFE_FILE "LStoreS" michael@0: michael@0: class nsACString; michael@0: struct nsStaticModuleInfo; michael@0: michael@0: class nsINativeAppSupport; michael@0: class nsICmdLineService; michael@0: class nsXREDirProvider; michael@0: class nsIToolkitProfileService; michael@0: class nsIFile; michael@0: class nsIProfileLock; michael@0: class nsIProfileUnlocker; michael@0: class nsIFactory; michael@0: michael@0: extern nsXREDirProvider* gDirServiceProvider; michael@0: michael@0: // NOTE: gAppData will be null in embedded contexts. The "size" parameter michael@0: // will be the size of the original structure passed to XRE_main, but the michael@0: // structure will have all of the members available. michael@0: extern const nsXREAppData* gAppData; michael@0: extern bool gSafeMode; michael@0: michael@0: extern int gArgc; michael@0: extern char **gArgv; michael@0: extern int gRestartArgc; michael@0: extern char **gRestartArgv; michael@0: extern bool gLogConsoleErrors; michael@0: michael@0: /** michael@0: * Create the nativeappsupport implementation. michael@0: * michael@0: * @note XPCOMInit has not happened yet. michael@0: */ michael@0: nsresult NS_CreateNativeAppSupport(nsINativeAppSupport* *aResult); michael@0: michael@0: NS_HIDDEN_(nsresult) michael@0: NS_NewToolkitProfileService(nsIToolkitProfileService* *aResult); michael@0: michael@0: NS_HIDDEN_(nsresult) michael@0: NS_NewToolkitProfileFactory(nsIFactory* *aResult); michael@0: michael@0: /** michael@0: * Try to acquire exclusive access to the specified profile directory. michael@0: * michael@0: * @param aPath michael@0: * The profile directory to lock. michael@0: * @param aTempPath michael@0: * The corresponding profile temporary directory. michael@0: * @param aUnlocker michael@0: * A callback interface used to attempt to unlock a profile that michael@0: * appears to be locked. michael@0: * @param aResult michael@0: * The resulting profile lock object (or null if the profile could michael@0: * not be locked). michael@0: * michael@0: * @return NS_ERROR_FILE_ACCESS_DENIED to indicate that the profile michael@0: * directory cannot be unlocked. michael@0: */ michael@0: NS_HIDDEN_(nsresult) michael@0: NS_LockProfilePath(nsIFile* aPath, nsIFile* aTempPath, michael@0: nsIProfileUnlocker* *aUnlocker, nsIProfileLock* *aResult); michael@0: michael@0: NS_HIDDEN_(void) michael@0: WriteConsoleLog(); michael@0: michael@0: #ifdef XP_WIN michael@0: BOOL michael@0: WinLaunchChild(const wchar_t *exePath, int argc, michael@0: char **argv, HANDLE userToken = nullptr, michael@0: HANDLE *hProcess = nullptr); michael@0: BOOL michael@0: WriteStatusPending(LPCWSTR updateDirPath); michael@0: BOOL michael@0: WriteStatusApplied(LPCWSTR updateDirPath); michael@0: #endif michael@0: michael@0: #define NS_NATIVEAPPSUPPORT_CONTRACTID "@mozilla.org/toolkit/native-app-support;1" michael@0: michael@0: namespace mozilla { michael@0: namespace startup { michael@0: extern GeckoProcessType sChildProcessType; michael@0: } michael@0: } michael@0: michael@0: /** michael@0: * Set up platform specific error handling such as suppressing DLL load dialog michael@0: * and the JIT debugger on Windows, and install unix signal handlers. michael@0: */ michael@0: void SetupErrorHandling(const char* progname); michael@0: michael@0: #endif // nsAppRunner_h__