1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
11 #include "mozilla/Attributes.h"
12 #include "mozilla/UniquePtrExtensions.h"
14 #include "nsCRTGlue.h"
15 #include "nsStringFwd.h"
18 #if defined(XP_WIN) && defined(MOZ_SANDBOX)
26 struct StaticXREAppData
;
29 * Application-specific data needed to start the apprunner.
33 XREAppData() = default;
34 ~XREAppData() = default;
35 XREAppData(const XREAppData
& aOther
) { *this = aOther
; }
37 explicit XREAppData(const StaticXREAppData
& aOther
) { *this = aOther
; }
39 XREAppData
& operator=(const StaticXREAppData
& aOther
);
40 XREAppData
& operator=(const XREAppData
& aOther
);
41 XREAppData
& operator=(XREAppData
&& aOther
) = default;
43 // Lots of code reads these fields directly like a struct, so rather
44 // than using UniquePtr directly, use an auto-converting wrapper.
47 explicit CharPtr() = default;
48 explicit CharPtr(const char* v
) { *this = v
; }
49 CharPtr(CharPtr
&&) = default;
52 CharPtr
& operator=(const char* v
) {
54 mValue
.reset(NS_xstrdup(v
));
60 CharPtr
& operator=(const CharPtr
& v
) {
61 *this = (const char*)v
;
65 operator const char*() const { return mValue
.get(); }
68 UniqueFreePtr
<const char> mValue
;
72 * The directory of the application to be run. May be null if the
73 * xulrunner and the app are installed into the same directory.
75 nsCOMPtr
<nsIFile
> directory
;
78 * The name of the application vendor. This must be ASCII, and is normally
79 * mixed-case, e.g. "Mozilla". Optional (may be null), but highly
80 * recommended. Must not be the empty string.
85 * The name of the application. This must be ASCII, and is normally
86 * mixed-case, e.g. "Firefox". Required (must not be null or an empty
92 * The internal name of the application for remoting purposes. When left
93 * unspecified, "name" is used instead. This must be ASCII, and is normally
94 * lowercase, e.g. "firefox". Optional (may be null but not an empty string).
99 * The major version, e.g. "0.8.0+". Optional (may be null), but
100 * required for advanced application features such as the extension
101 * manager and update service. Must not be the empty string.
106 * The application's build identifier, e.g. "2004051604"
111 * The application's UUID. Used by the extension manager to determine
112 * compatible extensions. Optional, but required for advanced application
113 * features such as the extension manager and update service.
115 * This has traditionally been in the form
116 * "{AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE}" but for new applications
117 * a more readable form is encouraged: "appname@vendor.tld". Only
118 * the following characters are allowed: a-z A-Z 0-9 - . @ _ { } *
123 * The copyright information to print for the -h commandline flag,
124 * e.g. "Copyright (c) 2003 mozilla.org".
129 * Combination of NS_XRE_ prefixed flags (defined below).
134 * The location of the XRE. XRE_main may not be able to figure this out
137 nsCOMPtr
<nsIFile
> xreDirectory
;
140 * The minimum/maximum compatible XRE version.
146 * The server URL to send crash reports to.
148 CharPtr crashReporterURL
;
151 * The profile directory that will be used. Optional (may be null). Must not
152 * be the empty string, must be ASCII. The path is split into components
153 * along the path separator characters '/' and '\'.
155 * The application data directory ("UAppData", see below) is normally
156 * composed as follows, where $HOME is platform-specific:
158 * UAppData = $HOME[/$vendor]/$name
160 * If present, the 'profile' string will be used instead of the combination of
161 * vendor and name as follows:
163 * UAppData = $HOME/$profile
168 * The application name to use in the User Agent string.
173 * The URL to the source revision for this build of the application.
178 * The URL to use to check for updates.
182 #if defined(XP_WIN) && defined(MOZ_SANDBOX)
184 * Chromium sandbox BrokerServices.
186 sandbox::BrokerServices
* sandboxBrokerServices
= nullptr;
189 // Returns a name suitable for DBUS services.
190 static void SanitizeNameForDBus(nsACString
&);
191 void GetDBusAppName(nsACString
&) const;
195 * Indicates whether or not the profile migrator service may be
196 * invoked at startup when creating a profile.
198 #define NS_XRE_ENABLE_PROFILE_MIGRATOR (1 << 1)
201 * Indicates whether or not to use Breakpad crash reporting.
203 #define NS_XRE_ENABLE_CRASH_REPORTER (1 << 3)
206 * A static version of the XRE app data is compiled into the application
207 * so that it is not necessary to read application.ini at startup.
209 * This structure is initialized into and matches nsXREAppData
211 struct StaticXREAppData
{
214 const char* remotingName
;
218 const char* copyright
;
220 const char* minVersion
;
221 const char* maxVersion
;
222 const char* crashReporterURL
;
225 const char* sourceURL
;
226 const char* updateURL
;
229 } // namespace mozilla
231 #endif // XREAppData_h