2004-06-18 01:23:51 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2004-06-18 01:23:51 +04:00
|
|
|
|
|
|
|
#ifndef nsAppRunner_h__
|
|
|
|
#define nsAppRunner_h__
|
2005-08-31 21:50:32 +04:00
|
|
|
|
|
|
|
#ifdef XP_WIN
|
|
|
|
#include <windows.h>
|
2008-10-21 07:55:57 +04:00
|
|
|
#else
|
|
|
|
#include <limits.h>
|
2005-08-31 21:50:32 +04:00
|
|
|
#endif
|
|
|
|
|
2004-06-18 01:23:51 +04:00
|
|
|
#ifndef MAXPATHLEN
|
2008-10-21 07:55:57 +04:00
|
|
|
#ifdef PATH_MAX
|
|
|
|
#define MAXPATHLEN PATH_MAX
|
|
|
|
#elif defined(_MAX_PATH)
|
2004-06-18 01:23:51 +04:00
|
|
|
#define MAXPATHLEN _MAX_PATH
|
|
|
|
#elif defined(CCHMAXPATH)
|
|
|
|
#define MAXPATHLEN CCHMAXPATH
|
|
|
|
#else
|
|
|
|
#define MAXPATHLEN 1024
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2017-08-17 02:48:52 +03:00
|
|
|
#include "nsStringFwd.h"
|
2006-08-17 18:22:04 +04:00
|
|
|
#include "nsXULAppAPI.h"
|
2004-06-18 01:23:51 +04:00
|
|
|
|
2005-09-07 21:31:00 +04:00
|
|
|
// This directory service key is a lot like NS_APP_LOCALSTORE_50_FILE,
|
|
|
|
// but it is always the "main" localstore file, even when we're in safe mode
|
|
|
|
// and we load localstore from somewhere else.
|
|
|
|
#define NS_LOCALSTORE_UNSAFE_FILE "LStoreS"
|
|
|
|
|
2004-06-18 01:23:51 +04:00
|
|
|
class nsINativeAppSupport;
|
|
|
|
class nsXREDirProvider;
|
|
|
|
class nsIToolkitProfileService;
|
2012-06-06 06:08:30 +04:00
|
|
|
class nsIFile;
|
2004-06-18 01:23:51 +04:00
|
|
|
class nsIProfileLock;
|
2005-03-15 23:01:12 +03:00
|
|
|
class nsIProfileUnlocker;
|
2007-08-09 22:55:21 +04:00
|
|
|
class nsIFactory;
|
2004-06-18 01:23:51 +04:00
|
|
|
|
|
|
|
extern nsXREDirProvider* gDirServiceProvider;
|
2006-08-17 18:22:04 +04:00
|
|
|
|
2016-12-02 17:07:24 +03:00
|
|
|
// NOTE: gAppData will be null in embedded contexts.
|
|
|
|
extern const mozilla::XREAppData* gAppData;
|
2011-09-29 10:19:26 +04:00
|
|
|
extern bool gSafeMode;
|
2004-06-18 01:23:51 +04:00
|
|
|
|
|
|
|
extern int gArgc;
|
|
|
|
extern char **gArgv;
|
2012-05-22 18:50:04 +04:00
|
|
|
extern int gRestartArgc;
|
|
|
|
extern char **gRestartArgv;
|
2011-09-29 10:19:26 +04:00
|
|
|
extern bool gLogConsoleErrors;
|
2016-04-19 13:00:59 +03:00
|
|
|
extern nsString gAbsoluteArgv0Path;
|
2004-06-18 01:23:51 +04:00
|
|
|
|
2015-01-15 01:24:09 +03:00
|
|
|
extern bool gIsGtest;
|
|
|
|
|
2004-06-18 01:23:51 +04:00
|
|
|
/**
|
|
|
|
* Create the nativeappsupport implementation.
|
|
|
|
*
|
|
|
|
* @note XPCOMInit has not happened yet.
|
|
|
|
*/
|
|
|
|
nsresult NS_CreateNativeAppSupport(nsINativeAppSupport* *aResult);
|
|
|
|
|
2014-06-02 16:08:21 +04:00
|
|
|
nsresult
|
2004-06-18 01:23:51 +04:00
|
|
|
NS_NewToolkitProfileService(nsIToolkitProfileService* *aResult);
|
|
|
|
|
2014-06-02 16:08:21 +04:00
|
|
|
nsresult
|
2007-08-09 22:55:21 +04:00
|
|
|
NS_NewToolkitProfileFactory(nsIFactory* *aResult);
|
|
|
|
|
2005-04-26 04:37:23 +04:00
|
|
|
/**
|
|
|
|
* Try to acquire exclusive access to the specified profile directory.
|
|
|
|
*
|
|
|
|
* @param aPath
|
|
|
|
* The profile directory to lock.
|
|
|
|
* @param aTempPath
|
|
|
|
* The corresponding profile temporary directory.
|
|
|
|
* @param aUnlocker
|
|
|
|
* A callback interface used to attempt to unlock a profile that
|
|
|
|
* appears to be locked.
|
|
|
|
* @param aResult
|
|
|
|
* The resulting profile lock object (or null if the profile could
|
|
|
|
* not be locked).
|
|
|
|
*
|
|
|
|
* @return NS_ERROR_FILE_ACCESS_DENIED to indicate that the profile
|
|
|
|
* directory cannot be unlocked.
|
|
|
|
*/
|
2014-06-02 16:08:21 +04:00
|
|
|
nsresult
|
2012-06-06 06:08:30 +04:00
|
|
|
NS_LockProfilePath(nsIFile* aPath, nsIFile* aTempPath,
|
2005-04-26 04:37:23 +04:00
|
|
|
nsIProfileUnlocker* *aUnlocker, nsIProfileLock* *aResult);
|
2004-06-18 01:23:51 +04:00
|
|
|
|
2014-06-02 16:08:21 +04:00
|
|
|
void
|
2005-06-07 23:28:23 +04:00
|
|
|
WriteConsoleLog();
|
|
|
|
|
2015-12-29 15:56:00 +03:00
|
|
|
void
|
|
|
|
OverrideDefaultLocaleIfNeeded();
|
|
|
|
|
2016-06-07 22:58:14 +03:00
|
|
|
/**
|
|
|
|
* Allow exit() calls to complete. This should be done from a proper Gecko
|
|
|
|
* shutdown path. Otherwise we aim to catch improper shutdowns.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
MozExpectedExit();
|
|
|
|
|
2005-08-31 21:50:32 +04:00
|
|
|
#ifdef XP_WIN
|
2014-11-03 16:22:39 +03:00
|
|
|
void
|
|
|
|
UseParentConsole();
|
|
|
|
|
2005-08-31 21:50:32 +04:00
|
|
|
BOOL
|
2013-12-03 19:07:22 +04:00
|
|
|
WinLaunchChild(const wchar_t *exePath, int argc,
|
2013-10-11 00:36:42 +04:00
|
|
|
char **argv, HANDLE userToken = nullptr,
|
2012-07-30 18:20:58 +04:00
|
|
|
HANDLE *hProcess = nullptr);
|
2005-08-31 21:50:32 +04:00
|
|
|
#endif
|
|
|
|
|
2004-11-08 08:00:27 +03:00
|
|
|
#define NS_NATIVEAPPSUPPORT_CONTRACTID "@mozilla.org/toolkit/native-app-support;1"
|
|
|
|
|
2009-12-15 01:13:00 +03:00
|
|
|
namespace mozilla {
|
|
|
|
namespace startup {
|
|
|
|
extern GeckoProcessType sChildProcessType;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace startup
|
2017-03-11 19:01:34 +03:00
|
|
|
|
|
|
|
const char* PlatformBuildID();
|
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace mozilla
|
2009-12-15 01:13:00 +03:00
|
|
|
|
2009-12-19 00:16:38 +03:00
|
|
|
/**
|
|
|
|
* Set up platform specific error handling such as suppressing DLL load dialog
|
|
|
|
* and the JIT debugger on Windows, and install unix signal handlers.
|
|
|
|
*/
|
2009-12-19 01:14:53 +03:00
|
|
|
void SetupErrorHandling(const char* progname);
|
2009-12-19 00:16:38 +03:00
|
|
|
|
2004-06-18 01:23:51 +04:00
|
|
|
#endif // nsAppRunner_h__
|