Bumping manifests a=b2g-bump
[gecko.git] / toolkit / xre / nsAppRunner.h
blob4ee1a11e9f1e04e282dbf6672003db1fe3d7fe20
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__
9 #ifdef XP_WIN
10 #include <windows.h>
11 #else
12 #include <limits.h>
13 #endif
15 #ifndef MAXPATHLEN
16 #ifdef PATH_MAX
17 #define MAXPATHLEN PATH_MAX
18 #elif defined(_MAX_PATH)
19 #define MAXPATHLEN _MAX_PATH
20 #elif defined(CCHMAXPATH)
21 #define MAXPATHLEN CCHMAXPATH
22 #else
23 #define MAXPATHLEN 1024
24 #endif
25 #endif
27 #include "nscore.h"
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"
35 class nsACString;
36 struct nsStaticModuleInfo;
38 class nsINativeAppSupport;
39 class nsICmdLineService;
40 class nsXREDirProvider;
41 class nsIToolkitProfileService;
42 class nsIFile;
43 class nsIProfileLock;
44 class nsIProfileUnlocker;
45 class nsIFactory;
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;
55 extern int gArgc;
56 extern char **gArgv;
57 extern int gRestartArgc;
58 extern char **gRestartArgv;
59 extern bool gLogConsoleErrors;
61 /**
62 * Create the nativeappsupport implementation.
64 * @note XPCOMInit has not happened yet.
66 nsresult NS_CreateNativeAppSupport(nsINativeAppSupport* *aResult);
68 nsresult
69 NS_NewToolkitProfileService(nsIToolkitProfileService* *aResult);
71 nsresult
72 NS_NewToolkitProfileFactory(nsIFactory* *aResult);
74 /**
75 * Try to acquire exclusive access to the specified profile directory.
77 * @param aPath
78 * The profile directory to lock.
79 * @param aTempPath
80 * The corresponding profile temporary directory.
81 * @param aUnlocker
82 * A callback interface used to attempt to unlock a profile that
83 * appears to be locked.
84 * @param aResult
85 * The resulting profile lock object (or null if the profile could
86 * not be locked).
88 * @return NS_ERROR_FILE_ACCESS_DENIED to indicate that the profile
89 * directory cannot be unlocked.
91 nsresult
92 NS_LockProfilePath(nsIFile* aPath, nsIFile* aTempPath,
93 nsIProfileUnlocker* *aUnlocker, nsIProfileLock* *aResult);
95 void
96 WriteConsoleLog();
98 #ifdef XP_WIN
99 BOOL
100 WinLaunchChild(const wchar_t *exePath, int argc,
101 char **argv, HANDLE userToken = nullptr,
102 HANDLE *hProcess = nullptr);
103 BOOL
104 WriteStatusPending(LPCWSTR updateDirPath);
105 BOOL
106 WriteStatusApplied(LPCWSTR updateDirPath);
107 #endif
109 #define NS_NATIVEAPPSUPPORT_CONTRACTID "@mozilla.org/toolkit/native-app-support;1"
111 namespace mozilla {
112 namespace startup {
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__