1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef nsAppRunner_h__
7 #define nsAppRunner_h__
17 #define MAXPATHLEN PATH_MAX
18 #elif defined(_MAX_PATH)
19 #define MAXPATHLEN _MAX_PATH
20 #elif defined(CCHMAXPATH)
21 #define MAXPATHLEN CCHMAXPATH
23 #define MAXPATHLEN 1024
28 #include "nsXULAppAPI.h"
30 // This directory service key is a lot like NS_APP_LOCALSTORE_50_FILE,
31 // but it is always the "main" localstore file, even when we're in safe mode
32 // and we load localstore from somewhere else.
33 #define NS_LOCALSTORE_UNSAFE_FILE "LStoreS"
36 struct nsStaticModuleInfo
;
38 class nsINativeAppSupport
;
39 class nsICmdLineService
;
40 class nsXREDirProvider
;
41 class nsIToolkitProfileService
;
44 class nsIProfileUnlocker
;
47 extern nsXREDirProvider
* gDirServiceProvider
;
49 // NOTE: gAppData will be null in embedded contexts. The "size" parameter
50 // will be the size of the original structure passed to XRE_main, but the
51 // structure will have all of the members available.
52 extern const nsXREAppData
* gAppData
;
53 extern bool gSafeMode
;
57 extern int gRestartArgc
;
58 extern char **gRestartArgv
;
59 extern bool gLogConsoleErrors
;
62 * Create the nativeappsupport implementation.
64 * @note XPCOMInit has not happened yet.
66 nsresult
NS_CreateNativeAppSupport(nsINativeAppSupport
* *aResult
);
69 NS_NewToolkitProfileService(nsIToolkitProfileService
* *aResult
);
72 NS_NewToolkitProfileFactory(nsIFactory
* *aResult
);
75 * Try to acquire exclusive access to the specified profile directory.
78 * The profile directory to lock.
80 * The corresponding profile temporary directory.
82 * A callback interface used to attempt to unlock a profile that
83 * appears to be locked.
85 * The resulting profile lock object (or null if the profile could
88 * @return NS_ERROR_FILE_ACCESS_DENIED to indicate that the profile
89 * directory cannot be unlocked.
92 NS_LockProfilePath(nsIFile
* aPath
, nsIFile
* aTempPath
,
93 nsIProfileUnlocker
* *aUnlocker
, nsIProfileLock
* *aResult
);
100 WinLaunchChild(const wchar_t *exePath
, int argc
,
101 char **argv
, HANDLE userToken
= nullptr,
102 HANDLE
*hProcess
= nullptr);
104 WriteStatusPending(LPCWSTR updateDirPath
);
106 WriteStatusApplied(LPCWSTR updateDirPath
);
109 #define NS_NATIVEAPPSUPPORT_CONTRACTID "@mozilla.org/toolkit/native-app-support;1"
113 extern GeckoProcessType sChildProcessType
;
118 * Set up platform specific error handling such as suppressing DLL load dialog
119 * and the JIT debugger on Windows, and install unix signal handlers.
121 void SetupErrorHandling(const char* progname
);
123 #endif // nsAppRunner_h__