blob: 7a381c95049d13df1f3a1c2c3f19a689c0dabd30 [file] [log] [blame]
Avi Drissman4a8573c2022-09-09 19:35:541// Copyright 2019 The Chromium Authors
Sorin Jianuf4f51699e2019-03-27 20:39:032// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Sorin Jianue066c6a2020-02-22 00:28:565#ifndef CHROME_UPDATER_CONSTANTS_H_
6#define CHROME_UPDATER_CONSTANTS_H_
Sorin Jianuf4f51699e2019-03-27 20:39:037
Noah Rose Ledesma8b66a782025-06-03 16:28:428#include <optional>
9
Joshua Pawlicki459cd852022-08-04 02:41:4110#include "base/time/time.h"
Sorin Jianu7d616152020-04-12 00:11:0011#include "build/build_config.h"
Sorin Jianu9d64af672020-02-05 19:14:3412#include "components/update_client/update_client_errors.h"
13
Sorin Jianuf4f51699e2019-03-27 20:39:0314namespace updater {
15
S. Ganesh84f32a42023-03-10 16:01:5316// Key for storing the installer version in the install settings dictionary.
Avi Drissman42630642024-07-16 14:25:2417inline constexpr char kInstallerVersion[] = "installer_version";
S. Ganesh84f32a42023-03-10 16:01:5318
Avi Drissman42630642024-07-16 14:25:2419// The name of the updater program image.
20#if BUILDFLAG(IS_WIN)
21inline constexpr char kExecutableName[] = "updater.exe";
22#else
23inline constexpr char kExecutableName[] = "updater";
24#endif
Sorin Jianu3112351922022-07-08 22:01:3525
Xiaoling Bao0f020e72024-09-12 23:18:4926// Uninstall switch for the enterprise companion app.
Xiaoling Bao721938e2024-09-13 05:09:2427inline constexpr char kUninstallCompanionAppSwitch[] = "uninstall";
Xiaoling Bao0f020e72024-09-12 23:18:4928
Joshua Pawlicki0922f8592021-07-23 15:26:0429// A suffix appended to the updater executable name before any file extension.
30extern const char kExecutableSuffix[];
31
S. Ganeshd03515a2025-12-12 12:28:1932// The value of `request.updater` sent to the update server.
33// TODO(crbug.com/467929954): change this value to `PRODUCT_FULLNAME_STRING`.
34inline constexpr char kProdId[] = "updater";
35
Sorin Jianu0f9b7f22020-03-06 15:03:3136// "0.0.0.0". Historically, a null version has been used to indicate a
37// new install.
Avi Drissman42630642024-07-16 14:25:2438inline constexpr char kNullVersion[] = "0.0.0.0";
Sorin Jianu2d0c54a2020-02-27 21:35:5239
Sorin Jianuf4f51699e2019-03-27 20:39:0340// Command line switches.
41//
Avi Drissman42630642024-07-16 14:25:2442// If a command line switch is marked as `backward-compatibility`, it
43// means the switch name cannot be changed, and the parser must be able to
44// handle command line in the DOS style '/<switch> <optional_value>'. This is to
45// make sure the new updater understands the hand-off requests from the legacy
46// updaters.
47
S. Ganesh71150442020-02-19 22:00:0748// This switch starts the COM server. This switch is invoked by the COM runtime
49// when CoCreate is called on one of several CLSIDs that the server supports.
50// We expect to use the COM server for the following scenarios:
51// * The Server for the UI when installing User applications, and as a fallback
52// if the Service fails when installing Machine applications.
53// * The On-Demand COM Server when running for User, and as a fallback if the
54// Service fails.
55// * COM Server for launching processes at Medium Integrity, i.e., de-elevating.
56// * The On-Demand COM Server when the client requests read-only interfaces
57// (say, Policy queries) at Medium Integrity.
58// * A COM broker when running modes such as On-Demand for Machine. A COM broker
59// is something that acts as an intermediary, allowing creating one of several
60// possible COM objects that can service a particular COM request, ranging
61// from Privileged Services that can offer full functionality for a particular
62// set of interfaces, to Medium Integrity processes that can offer limited
63// (say, read-only) functionality for that same set of interfaces.
Avi Drissman42630642024-07-16 14:25:2464inline constexpr char kServerSwitch[] = "server";
S. Ganeshe91ea3b82019-11-22 23:08:3865
Mila Green300efaa2020-09-01 19:50:0466// This switch specifies the XPC service the server registers to listen to.
Avi Drissman42630642024-07-16 14:25:2467inline constexpr char kServerServiceSwitch[] = "service";
Mila Green300efaa2020-09-01 19:50:0468
69// Valid values for the kServerServiceSwitch.
Avi Drissman42630642024-07-16 14:25:2470inline constexpr char kServerUpdateServiceInternalSwitchValue[] =
71 "update-internal";
72inline constexpr char kServerUpdateServiceSwitchValue[] = "update";
Mila Green300efaa2020-09-01 19:50:0473
S. Ganesh4e88e4d2022-02-07 23:07:3374// This switch starts the Windows service. This switch is invoked by the SCM
75// either as a part of system startup (`SERVICE_AUTO_START`) or when `CoCreate`
76// is called on one of several CLSIDs that the server supports.
Avi Drissman42630642024-07-16 14:25:2477inline constexpr char kWindowsServiceSwitch[] = "windows-service";
S. Ganesh4e88e4d2022-02-07 23:07:3378
79// This switch indicates that the Windows service is in the COM server mode.
80// This switch is passed to `ServiceMain` by the SCM when CoCreate is called on
81// one of several CLSIDs that the server supports. We expect to use the COM
82// service for the following scenarios:
S. Ganesh71150442020-02-19 22:00:0783// * The Server for the UI when installing Machine applications.
84// * The On-Demand COM Server for Machine applications.
85// * COM Server for launching processes at System Integrity, i.e., an Elevator.
Avi Drissman42630642024-07-16 14:25:2486inline constexpr char kComServiceSwitch[] = "com-service";
S. Ganesh71150442020-02-19 22:00:0787
Sorin Jianuf4f51699e2019-03-27 20:39:0388// Crash the program for testing purposes.
Avi Drissman42630642024-07-16 14:25:2489inline constexpr char kCrashMeSwitch[] = "crash-me";
Sorin Jianuf4f51699e2019-03-27 20:39:0390
91// Runs as the Crashpad handler.
Avi Drissman42630642024-07-16 14:25:2492inline constexpr char kCrashHandlerSwitch[] = "crash-handler";
Sorin Jianuf4f51699e2019-03-27 20:39:0393
Mila Greeneaf3df192020-08-06 20:23:5994// Updates the updater.
Avi Drissman42630642024-07-16 14:25:2495inline constexpr char kUpdateSwitch[] = "update";
Mila Greeneaf3df192020-08-06 20:23:5996
S. Ganeshad4aa542025-08-26 20:07:3697// Updates the apps.
98inline constexpr char kUpdateAppsSwitch[] = "update-apps";
99
Joshua Pawlicki7790b872025-10-27 22:12:02100// Run as a patch worker.
101inline constexpr char kPatchWorkerSwitch[] = "patch-worker";
102
Joshua Pawlicki665306f42025-08-14 20:19:18103// Run as an unzip worker.
104inline constexpr char kUnzipWorkerSwitch[] = "unzip-worker";
105
Xiaoling Bao15bf6f312024-08-05 22:00:04106// Run as a network worker.
107inline constexpr char kNetWorkerSwitch[] = "net-worker";
108
S. Ganesha27812c2024-04-15 21:58:00109// Installs the updater. Takes an optional argument for the meta installer tag.
110// The tag is a string of arguments, separated by a delimiter (in this case, the
111// delimiter is `&`). The tag is typically embedded in the program image of the
112// metainstaller, but for testing purposes, the tag could be passed directly as
113// a command line argument. The tag is currently encoded as an ASCII string.
Avi Drissman42630642024-07-16 14:25:24114inline constexpr char kInstallSwitch[] = "install";
S. Ganesha27812c2024-04-15 21:58:00115
Avi Drissman42630642024-07-16 14:25:24116inline constexpr char kEulaRequiredSwitch[] = "eularequired";
Sorin Jianu38ac5a72019-06-11 17:29:14117
S. Ganeshde6ebb52024-04-12 18:42:51118// Specifies that this is an OEM install in audit mode.
Avi Drissman42630642024-07-16 14:25:24119inline constexpr char kOemSwitch[] = "oem";
S. Ganeshde6ebb52024-04-12 18:42:51120
S. Ganeshe4b62ffa2022-03-18 01:51:48121// The --installerdata=file.dat switch is passed to an installer if an
122// installdataindex is specified in the tag or if installerdata is passed in via
123// --appargs. The corresponding installerdata is written to file.dat with an
124// UTF8 encoding as well as a UTF8 BOM.
Avi Drissman42630642024-07-16 14:25:24125inline constexpr char kInstallerDataSwitch[] = "installerdata";
S. Ganeshe4b62ffa2022-03-18 01:51:48126
Sorin Jianu38ac5a72019-06-11 17:29:14127// Uninstalls the updater.
Avi Drissman42630642024-07-16 14:25:24128inline constexpr char kUninstallSwitch[] = "uninstall";
Sorin Jianu16e88f372019-08-16 20:36:29129
Mila Green7c85571f2021-02-04 03:11:23130// Uninstalls this version of the updater.
Avi Drissman42630642024-07-16 14:25:24131inline constexpr char kUninstallSelfSwitch[] = "uninstall-self";
Mila Green7c85571f2021-02-04 03:11:23132
133// Uninstalls the updater if no apps are managed by it.
Avi Drissman42630642024-07-16 14:25:24134inline constexpr char kUninstallIfUnusedSwitch[] = "uninstall-if-unused";
Mila Green7c85571f2021-02-04 03:11:23135
Sorin Jianudc61b6a2020-05-20 00:40:48136// Kicks off the update service. This switch is typically used for by a
137// scheduled to invoke the updater periodically.
Avi Drissman42630642024-07-16 14:25:24138inline constexpr char kWakeSwitch[] = "wake";
Sorin Jianu38ac5a72019-06-11 17:29:14139
Joshua Pawlickiba27c9d2022-11-22 16:36:00140// Kicks off the update service for all versions.
Avi Drissman42630642024-07-16 14:25:24141inline constexpr char kWakeAllSwitch[] = "wake-all";
Joshua Pawlickiba27c9d2022-11-22 16:36:00142
Mila Greenfa294462020-04-15 17:29:48143// The updater needs to operate in the system context.
Avi Drissman42630642024-07-16 14:25:24144inline constexpr char kSystemSwitch[] = "system";
Mila Greenfa294462020-04-15 17:29:48145
Sorin Jianuf4f51699e2019-03-27 20:39:03146// Runs in test mode. Currently, it exits right away.
Avi Drissman42630642024-07-16 14:25:24147inline constexpr char kTestSwitch[] = "test";
Sorin Jianuf4f51699e2019-03-27 20:39:03148
Joshua Pawlicki4bfc24f2022-02-03 12:22:42149// Run in recovery mode.
Avi Drissman42630642024-07-16 14:25:24150inline constexpr char kRecoverSwitch[] = "recover";
Joshua Pawlicki4bfc24f2022-02-03 12:22:42151
S. Ganesh8ef3ae72025-05-06 10:29:01152// This switch does the following:
153// * Force-installs the metainstaller that is run with this switch and makes it
154// the active `updater`.
155// * Installs the application(s) that are implicitly specified in the tagged
156// metainstaller, or explicitly specified using the `--install` or `--handoff`
157// parameters.
158inline constexpr char kForceInstallSwitch[] = "force-install";
159
Joshua Pawlicki4bfc24f2022-02-03 12:22:42160// The version of the program triggering recovery.
Avi Drissman42630642024-07-16 14:25:24161inline constexpr char kBrowserVersionSwitch[] = "browser-version";
Joshua Pawlicki4bfc24f2022-02-03 12:22:42162
163// The session ID of the Omaha session triggering recovery.
Avi Drissman42630642024-07-16 14:25:24164inline constexpr char kSessionIdSwitch[] =
165 "sessionid"; // backward-compatibility.
Joshua Pawlicki4bfc24f2022-02-03 12:22:42166
167// The app ID of the program triggering recovery.
Avi Drissman42630642024-07-16 14:25:24168inline constexpr char kAppGuidSwitch[] = "appguid";
Joshua Pawlicki4bfc24f2022-02-03 12:22:42169
Sorin Jianu43802ccd02024-06-08 00:23:42170// Causes crashpad handler to start a second instance to monitor the first
Xiaoling Bao5b8fe912024-05-04 01:12:21171// instance for exceptions.
Avi Drissman42630642024-07-16 14:25:24172inline constexpr char kMonitorSelfSwitch[] = "monitor-self";
Xiaoling Bao5b8fe912024-05-04 01:12:21173
Sorin Jianu43802ccd02024-06-08 00:23:42174// Additional arguments passed to the --monitor-self instance.
Avi Drissman42630642024-07-16 14:25:24175inline constexpr char kMonitorSelfSwitchArgument[] = "monitor-self-argument";
Sorin Jianu43802ccd02024-06-08 00:23:42176
Sorin Jianu76392dc2019-08-13 18:23:08177// The handle of an event to signal when the initialization of the main process
178// is complete.
Avi Drissman42630642024-07-16 14:25:24179inline constexpr char kInitDoneNotifierSwitch[] = "init-done-notifier";
Sorin Jianu76392dc2019-08-13 18:23:08180
Sorin Jianu16e88f372019-08-16 20:36:29181// Enables logging.
Avi Drissman42630642024-07-16 14:25:24182inline constexpr char kEnableLoggingSwitch[] = "enable-logging";
Sorin Jianu16e88f372019-08-16 20:36:29183
Sorin Jianud27253692021-09-30 15:14:39184// Specifies the logging module filter and its value. Note that some call sites
185// may still use different values for the logging module filter.
Avi Drissman42630642024-07-16 14:25:24186inline constexpr char kLoggingModuleSwitch[] = "vmodule";
187inline constexpr char kLoggingModuleSwitchValue[] =
188#if BUILDFLAG(IS_WIN)
189 "*/components/winhttp/*=1,"
190#endif
Noah Rose Ledesma6bc6e492024-10-02 21:39:56191 "*/components/update_client/*=2,"
192 "*/chrome/enterprise_companion/*=2,"
193 "*/chrome/updater/*=2";
Sorin Jianu16e88f372019-08-16 20:36:29194
S. Ganesh64aca4f2020-03-26 20:24:19195// Specifies the application that the Updater needs to install.
Avi Drissman42630642024-07-16 14:25:24196inline constexpr char kAppIdSwitch[] = "app-id";
S. Ganesh64aca4f2020-03-26 20:24:19197
Mila Green3e3058a2020-08-27 16:59:27198// Specifies the version of the application that the updater needs to register.
Avi Drissman42630642024-07-16 14:25:24199inline constexpr char kAppVersionSwitch[] = "app-version";
Mila Green3e3058a2020-08-27 16:59:27200
S. Ganeshe6eb7142022-01-24 21:57:20201// Specifies that the Updater should perform some minimal checks to verify that
202// it is operational/healthy. This is for backward compatibility with Omaha 3.
203// Omaha 3 runs "GoogleUpdate.exe /healthcheck" and expects an exit code of
204// HRESULT SUCCESS, i.e., S_OK, in which case it will hand off the installation
205// to Omaha 4.
Avi Drissman42630642024-07-16 14:25:24206inline constexpr char kHealthCheckSwitch[] = "healthcheck";
S. Ganeshe6eb7142022-01-24 21:57:20207
Joshua Pawlicki8d550992022-07-20 19:35:35208// Specifies the enterprise request argument. On Windows, the request may
209// be from legacy updaters which pass the argument in the format of
210// `/enterprise`. Manual argument parsing is needed for that scenario.
Avi Drissman42630642024-07-16 14:25:24211inline constexpr char kEnterpriseSwitch[] =
212 "enterprise"; // backward-compatibility.
Joshua Pawlicki8d550992022-07-20 19:35:35213
Xiaoling Bao8cc74f12022-09-06 23:30:41214// Specifies that no UI should be shown.
Avi Drissman42630642024-07-16 14:25:24215inline constexpr char kSilentSwitch[] = "silent"; // backward-compatibility.
Xiaoling Bao8cc74f12022-09-06 23:30:41216
S. Ganesh49727a842024-01-09 01:01:50217// The "alwayslaunchcmd" switch specifies that launch commands are to be run
218// unconditionally, even for silent modes.
Avi Drissman42630642024-07-16 14:25:24219inline constexpr char kAlwaysLaunchCmdSwitch[] = "alwayslaunchcmd";
S. Ganesh49727a842024-01-09 01:01:50220
Xiaoling Bao51e2af12022-01-28 22:02:10221// Specifies the handoff request argument. On Windows, the request may
222// be from legacy updaters which pass the argument in the format of
223// `/handoff <install-args-details>`. Manual argument parsing is needed for that
224// scenario.
Avi Drissman42630642024-07-16 14:25:24225inline constexpr char kHandoffSwitch[] = "handoff"; // backward-compatibility.
Xiaoling Bao51e2af12022-01-28 22:02:10226
Xiaoling Baoa7b48ae02022-05-04 03:04:06227// Specifies the full path to the offline install resources. The folder
228// contains offline installer and the manifest file.
Avi Drissman42630642024-07-16 14:25:24229inline constexpr char kOfflineDirSwitch[] =
230 "offlinedir"; // backward-compatibility.
Xiaoling Baoa7b48ae02022-05-04 03:04:06231
Xiaoling Baoe330b7032022-09-13 23:29:19232// Specifies extra app args. The switch must be in the following format:
233// --appargs="appguid=<appid>&installerdata=<URL-encoded-installer-data>"
234// On Windows, the request may be from legacy updaters which pass the argument
235// in the format of `/appargs <value>`. Manual argument parsing is needed for
236// that scenario.
Avi Drissman42630642024-07-16 14:25:24237inline constexpr char kAppArgsSwitch[] = "appargs"; // backward-compatibility.
Xiaoling Baoe330b7032022-09-13 23:29:19238
S. Ganesh8fd7ddb2022-03-29 19:57:34239// The "expect-elevated" switch indicates that updater setup should be running
240// elevated (at high integrity). This switch is needed to avoid running into a
241// loop trying (but failing repeatedly) to elevate updater setup when attempting
242// to install on a standard user account with UAC disabled.
Avi Drissman42630642024-07-16 14:25:24243inline constexpr char kCmdLineExpectElevated[] = "expect-elevated";
S. Ganesh8fd7ddb2022-03-29 19:57:34244
S. Ganeshd1c4b0b7d52024-08-08 19:46:05245// The "expect-de-elevated" switch indicates that updater setup should be
246// running de-elevated (at medium integrity). This switch is needed to avoid
247// running into a loop trying (but failing repeatedly) to de-elevate updater
248// setup when attempting to install as a standard user account with UAC enabled.
249inline constexpr char kCmdLineExpectDeElevated[] = "expect-de-elevated";
S. Ganesha3420b92022-10-04 18:24:42250
S. Ganesh15636a92022-04-09 01:53:08251// The "prefers-user" switch indicates that updater setup could not elevate, and
252// is now trying to install the app per-user.
Avi Drissman42630642024-07-16 14:25:24253inline constexpr char kCmdLinePrefersUser[] = "prefers-user";
S. Ganesh15636a92022-04-09 01:53:08254
Sorin Jianu6cd7bc52019-11-05 16:36:45255// File system paths.
Sorin Jianu38ac5a72019-06-11 17:29:14256//
257// The directory name where CRX apps get installed. This is provided for demo
258// purposes, since products installed by this updater will be installed in
259// their specific locations.
Avi Drissman42630642024-07-16 14:25:24260inline constexpr char kAppsDir[] = "apps";
Sorin Jianu38ac5a72019-06-11 17:29:14261
262// The name of the uninstall script which is invoked by the --uninstall switch.
Avi Drissman42630642024-07-16 14:25:24263inline constexpr char kUninstallScript[] = "uninstall.cmd";
Sorin Jianu38ac5a72019-06-11 17:29:14264
Joshua Pawlicki9b52edeb2020-04-21 15:26:08265// Developer override keys.
Avi Drissman42630642024-07-16 14:25:24266inline constexpr char kDevOverrideKeyUrl[] = "url";
267inline constexpr char kDevOverrideKeyCrashUploadUrl[] = "crash_upload_url";
Avi Drissman42630642024-07-16 14:25:24268inline constexpr char kDevOverrideKeyAppLogoUrl[] = "app_logo_url";
Noah Rose Ledesma1281bf842025-06-05 16:11:49269inline constexpr char kDevOverrideKeyEventLoggingUrl[] = "event_logging_url";
Avi Drissman42630642024-07-16 14:25:24270inline constexpr char kDevOverrideKeyUseCUP[] = "use_cup";
271inline constexpr char kDevOverrideKeyInitialDelay[] = "initial_delay";
272inline constexpr char kDevOverrideKeyServerKeepAliveSeconds[] =
273 "server_keep_alive";
274inline constexpr char kDevOverrideKeyCrxVerifierFormat[] =
275 "crx_verifier_format";
Joshua Pawlicki3435a25d52025-08-06 17:38:56276inline constexpr char kDevOverrideKeyCrxPublicKeyHash[] = "crx_public_key_hash";
Noah Rose Ledesma6ef240e22025-05-31 01:00:03277inline constexpr char kDevOverrideKeyMinumumEventLoggingCooldownSeconds[] =
278 "minimum_event_logging_cooldown_seconds";
Noah Rose Ledesmaadd6e7a2025-06-13 17:19:22279inline constexpr char kDevOverrideKeyEventLoggingPermissionProviderAppId[] =
280 "event_logging_permission_provider_app_id";
281#if BUILDFLAG(IS_MAC)
282inline constexpr char
283 kDevOverrideKeyEventLoggingPermissionProviderDirectoryName[] =
284 "event_logging_permission_provider_directory_name";
285#endif
S. Ganeshf0d3ab02025-01-18 04:02:42286inline constexpr char kDevOverrideKeyDictPolicies[] = "dict_policies";
287
288// TODO(crbug.com/389965546): remove this once the checked-in old updater builds
289// recognize "dict_policies".
Avi Drissman42630642024-07-16 14:25:24290inline constexpr char kDevOverrideKeyGroupPolicies[] = "group_policies";
S. Ganeshf0d3ab02025-01-18 04:02:42291
Avi Drissman42630642024-07-16 14:25:24292inline constexpr char kDevOverrideKeyOverinstallTimeout[] =
293 "overinstall_timeout";
294inline constexpr char kDevOverrideKeyIdleCheckPeriodSeconds[] =
295 "idle_check_period";
296inline constexpr char kDevOverrideKeyManagedDevice[] = "managed_device";
297inline constexpr char kDevOverrideKeyEnableDiffUpdates[] =
298 "enable_diff_updates";
Xiaoling Bao760b128a2024-10-02 23:17:15299inline constexpr char kDevOverrideKeyCecaConnectionTimeout[] =
300 "ceca_connection_timeout";
Joshua Pawlicki9b52edeb2020-04-21 15:26:08301
Sorin Jianu9d64af672020-02-05 19:14:34302// Timing constants.
Joshua Pawlicki459cd852022-08-04 02:41:41303// How long to wait for an application installer (such as chrome_installer.exe)
304// to complete.
S. Ganesh2707fe52022-10-06 21:33:45305inline constexpr base::TimeDelta kWaitForAppInstaller = base::Minutes(15);
Sorin Jianu9d64af672020-02-05 19:14:34306
S. Ganesh899760842023-03-08 17:29:43307// How long to wait for the common setup lock for
308// AppInstall/AppUninstall/AppUpdate.
309inline constexpr base::TimeDelta kWaitForSetupLock = base::Seconds(5);
310
S. Ganesh6cd1f262022-08-15 18:30:29311// The default last check period is 4.5 hours.
S. Ganesh2707fe52022-10-06 21:33:45312inline constexpr base::TimeDelta kDefaultLastCheckPeriod =
S. Ganesh6cd1f262022-08-15 18:30:29313 base::Hours(4) + base::Minutes(30);
314
S. Ganesh28fad772025-04-17 22:03:37315#if BUILDFLAG(IS_MAC)
Joshua Pawlicki52c83632020-12-15 16:18:15316// How long to wait for launchd changes to be reported by launchctl.
S. Ganesh2707fe52022-10-06 21:33:45317inline constexpr int kWaitForLaunchctlUpdateSec = 5;
Xiaohan Wang822cc382022-01-15 19:33:51318#endif // BUILDFLAG(IS_MAC)
Sorin Jianu346e9e42020-06-02 20:44:52319
Noah Rose Ledesma6ef240e22025-05-31 01:00:03320// The minimum period between remote event logging transmissions. The server may
321// instruct the client to backoff for a longer period.
322inline constexpr base::TimeDelta kMinimumEventLoggingCooldown =
323 base::Minutes(15);
324
tomerni-island72d3dc92025-06-11 08:19:55325// The minimum factor by which kDefaultLastCheckPeriod can be
326// multiplied to get the next check delay.
327inline constexpr double kUpdateCheckMinDelayFactor = 1.0;
328
329// The maximum factor by which kDefaultLastCheckPeriod can be
330// multiplied to get the next check delay.
331inline constexpr double kUpdateCheckMaxDelayFactor = 1.2;
332
333// Probability of applying kUpdateCheckMaxDelayFactor to the next
334// check delay.
335inline constexpr double kProbabilityOfIncreasedDelay = 0.1;
336
Joshua Pawlickicc3949fb2020-06-25 21:04:10337// Install Errors.
Sorin Jianu925cf982019-05-28 23:50:40338//
S. Ganeshdba3f732024-07-13 00:40:17339// Specific errors for the updater that are passed through `update_client` are
340// reported in such a way that their range does not conflict with the range of
341// generic errors defined by the metainstaller, the `update_client` module, or
342// Windows.
343#if BUILDFLAG(IS_WIN)
344inline constexpr int kCustomInstallErrorBase =
345 static_cast<int>(update_client::InstallError::CUSTOM_ERROR_BASE) + 74000;
346#else
S. Ganesh2707fe52022-10-06 21:33:45347inline constexpr int kCustomInstallErrorBase =
Sorin Jianu9d64af672020-02-05 19:14:34348 static_cast<int>(update_client::InstallError::CUSTOM_ERROR_BASE);
S. Ganeshdba3f732024-07-13 00:40:17349#endif
Sorin Jianu9d64af672020-02-05 19:14:34350
S. Ganeshe5001222023-11-03 22:32:02351// Running the application installer failed.
352inline constexpr int kErrorApplicationInstallerFailed =
353 kCustomInstallErrorBase + 3;
354
355// The errors below are reported in the `extra_code1` in the
356// `CrxInstaller::Result` structure, with the `error` reported as
357// `GOOPDATEINSTALL_E_FILENAME_INVALID`. `GOOPDATEINSTALL_E_FILENAME_INVALID` is
358// used to avoid overlaps of the specific error codes below with Windows error
359// codes.
360
Sorin Jianu9d64af672020-02-05 19:14:34361// The install params are missing. This usually means that the update
362// response does not include the name of the installer and its command line
363// arguments.
S. Ganesh2707fe52022-10-06 21:33:45364inline constexpr int kErrorMissingInstallParams = kCustomInstallErrorBase + 1;
Sorin Jianu9d64af672020-02-05 19:14:34365
S. Ganeshe5001222023-11-03 22:32:02366// The file extension for the installer is not supported. For instance, on
367// Windows, only `.exe` and `.msi` extensions are supported.
368inline constexpr int kErrorInvalidFileExtension = kCustomInstallErrorBase + 4;
Sorin Jianu925cf982019-05-28 23:50:40369
S. Ganesh7fa0e9d2024-03-08 21:25:00370// The app command failed to launch. This code is reported in the `extra_code1`
371// in the ping, along with the actual error code that caused that launch failure
372// in `error`.
373inline constexpr int kErrorAppCommandLaunchFailed = kCustomInstallErrorBase + 5;
374
375// The app command timed out. This code is reported in the `extra_code1` in the
376// ping, along with the error code `HRESULT_FROM_WIN32(ERROR_TIMEOUT)` in
377// `error`.
378inline constexpr int kErrorAppCommandTimedOut = kCustomInstallErrorBase + 6;
379
S. Ganeshdba3f732024-07-13 00:40:17380// Specific error codes for the updater are reported in such a way that their
381// range does not conflict with the range of generic errors defined by the
382// metainstaller, the `update_client` module, or Windows.
383#if BUILDFLAG(IS_WIN)
384inline constexpr int kUpdaterErrorBase = 75000;
385#else
386inline constexpr int kUpdaterErrorBase = 0;
387#endif
388
Joshua Pawlickiac9b05a2022-02-17 02:18:45389// Error codes.
Joshua Pawlickicc3949fb2020-06-25 21:04:10390//
391// The server process may exit with any of these exit codes.
S. Ganesh2707fe52022-10-06 21:33:45392inline constexpr int kErrorOk = 0;
Joshua Pawlicki30b54bc2020-09-01 20:04:24393
394// The server could not acquire the lock needed to run.
S. Ganeshdba3f732024-07-13 00:40:17395inline constexpr int kErrorFailedToLockPrefsMutex = kUpdaterErrorBase + 1;
Joshua Pawlicki30b54bc2020-09-01 20:04:24396
397// The server candidate failed to promote itself to active.
S. Ganeshdba3f732024-07-13 00:40:17398inline constexpr int kErrorFailedToSwap = kUpdaterErrorBase + 2;
Joshua Pawlickicc3949fb2020-06-25 21:04:10399
S. Ganeshdba3f732024-07-13 00:40:17400inline constexpr int kErrorRegistrationFailed = kUpdaterErrorBase + 3;
401inline constexpr int kErrorPermissionDenied = kUpdaterErrorBase + 4;
402inline constexpr int kErrorWaitFailedUninstall = kUpdaterErrorBase + 5;
403inline constexpr int kErrorWaitFailedInstall = kUpdaterErrorBase + 6;
404inline constexpr int kErrorPathServiceFailed = kUpdaterErrorBase + 7;
405inline constexpr int kErrorComInitializationFailed = kUpdaterErrorBase + 8;
406inline constexpr int kErrorUnknownCommandLine = kUpdaterErrorBase + 9;
407inline constexpr int kErrorNoVersionedDirectory = kUpdaterErrorBase + 11;
408inline constexpr int kErrorNoBaseDirectory = kUpdaterErrorBase + 12;
409inline constexpr int kErrorPathTooLong = kUpdaterErrorBase + 13;
410inline constexpr int kErrorProcessLaunchFailed = kUpdaterErrorBase + 14;
Joshua Pawlicki9c55cb32022-01-18 22:48:18411
Joshua Pawlickiac9b05a2022-02-17 02:18:45412// Failed to copy the updater's bundle.
S. Ganeshdba3f732024-07-13 00:40:17413inline constexpr int kErrorFailedToCopyBundle = kUpdaterErrorBase + 15;
Joshua Pawlickiac9b05a2022-02-17 02:18:45414
415// Failed to delete the updater's install folder.
S. Ganeshdba3f732024-07-13 00:40:17416inline constexpr int kErrorFailedToDeleteFolder = kUpdaterErrorBase + 16;
Joshua Pawlickiac9b05a2022-02-17 02:18:45417
418// Failed to delete the updater's data folder.
S. Ganeshdba3f732024-07-13 00:40:17419inline constexpr int kErrorFailedToDeleteDataFolder = kUpdaterErrorBase + 17;
Joshua Pawlickiac9b05a2022-02-17 02:18:45420
421// Failed to get versioned updater folder path.
S. Ganeshdba3f732024-07-13 00:40:17422inline constexpr int kErrorFailedToGetVersionedInstallDirectory =
423 kUpdaterErrorBase + 18;
Joshua Pawlickiac9b05a2022-02-17 02:18:45424
Joshua Pawlicki40f9f962023-03-03 18:52:49425// Failed to get the install directory.
S. Ganeshdba3f732024-07-13 00:40:17426inline constexpr int kErrorFailedToGetInstallDir = kUpdaterErrorBase + 19;
Joshua Pawlickiac9b05a2022-02-17 02:18:45427
428// Failed to remove the active(unversioned) update service job from Launchd.
S. Ganeshdba3f732024-07-13 00:40:17429inline constexpr int kErrorFailedToRemoveActiveUpdateServiceJobFromLaunchd =
430 kUpdaterErrorBase + 20;
Joshua Pawlickiac9b05a2022-02-17 02:18:45431
432// Failed to remove versioned update service job from Launchd.
S. Ganesh2707fe52022-10-06 21:33:45433inline constexpr int kErrorFailedToRemoveCandidateUpdateServiceJobFromLaunchd =
S. Ganeshdba3f732024-07-13 00:40:17434 kUpdaterErrorBase + 21;
Joshua Pawlickiac9b05a2022-02-17 02:18:45435
436// Failed to remove versioned update service internal job from Launchd.
S. Ganesh2707fe52022-10-06 21:33:45437inline constexpr int kErrorFailedToRemoveUpdateServiceInternalJobFromLaunchd =
S. Ganeshdba3f732024-07-13 00:40:17438 kUpdaterErrorBase + 22;
Joshua Pawlickiac9b05a2022-02-17 02:18:45439
440// Failed to remove versioned wake job from Launchd.
S. Ganeshdba3f732024-07-13 00:40:17441inline constexpr int kErrorFailedToRemoveWakeJobFromLaunchd =
442 kUpdaterErrorBase + 23;
Joshua Pawlickiac9b05a2022-02-17 02:18:45443
444// Failed to create the active(unversioned) update service Launchd plist.
S. Ganeshdba3f732024-07-13 00:40:17445inline constexpr int kErrorFailedToCreateUpdateServiceLaunchdJobPlist =
446 kUpdaterErrorBase + 24;
Joshua Pawlickiac9b05a2022-02-17 02:18:45447
448// Failed to create the versioned update service Launchd plist.
S. Ganesh2707fe52022-10-06 21:33:45449inline constexpr int kErrorFailedToCreateVersionedUpdateServiceLaunchdJobPlist =
S. Ganeshdba3f732024-07-13 00:40:17450 kUpdaterErrorBase + 25;
Joshua Pawlickiac9b05a2022-02-17 02:18:45451
452// Failed to create the versioned update service internal Launchd plist.
S. Ganesh2707fe52022-10-06 21:33:45453inline constexpr int kErrorFailedToCreateUpdateServiceInternalLaunchdJobPlist =
S. Ganeshdba3f732024-07-13 00:40:17454 kUpdaterErrorBase + 26;
Joshua Pawlickiac9b05a2022-02-17 02:18:45455
456// Failed to create the versioned wake Launchd plist.
S. Ganeshdba3f732024-07-13 00:40:17457inline constexpr int kErrorFailedToCreateWakeLaunchdJobPlist =
458 kUpdaterErrorBase + 27;
Joshua Pawlickiac9b05a2022-02-17 02:18:45459
460// Failed to start the active(unversioned) update service job.
S. Ganeshdba3f732024-07-13 00:40:17461inline constexpr int kErrorFailedToStartLaunchdActiveServiceJob =
462 kUpdaterErrorBase + 28;
Joshua Pawlickiac9b05a2022-02-17 02:18:45463
464// Failed to start the versioned update service job.
S. Ganeshdba3f732024-07-13 00:40:17465inline constexpr int kErrorFailedToStartLaunchdVersionedServiceJob =
466 kUpdaterErrorBase + 29;
Joshua Pawlickiac9b05a2022-02-17 02:18:45467
468// Failed to start the update service internal job.
S. Ganeshdba3f732024-07-13 00:40:17469inline constexpr int kErrorFailedToStartLaunchdUpdateServiceInternalJob =
470 kUpdaterErrorBase + 30;
Joshua Pawlickiac9b05a2022-02-17 02:18:45471
472// Failed to start the wake job.
S. Ganeshdba3f732024-07-13 00:40:17473inline constexpr int kErrorFailedToStartLaunchdWakeJob = kUpdaterErrorBase + 31;
Joshua Pawlickiac9b05a2022-02-17 02:18:45474
475// Timed out while awaiting launchctl to become aware of the update service
476// internal job.
S. Ganeshdba3f732024-07-13 00:40:17477inline constexpr int kErrorFailedAwaitingLaunchdUpdateServiceInternalJob =
478 kUpdaterErrorBase + 32;
Joshua Pawlicki4bfc24f2022-02-03 12:22:42479
S. Ganeshf85b7f632022-09-02 18:07:15480// DM registration failure with mandatory enrollment.
S. Ganeshdba3f732024-07-13 00:40:17481inline constexpr int kErrorDMRegistrationFailed = kUpdaterErrorBase + 33;
S. Ganeshf85b7f632022-09-02 18:07:15482
S. Ganeshdba3f732024-07-13 00:40:17483inline constexpr int kErrorFailedToInstallLegacyUpdater =
484 kUpdaterErrorBase + 34;
Xiaoling Bao0f6c3c0c2022-10-03 23:55:36485
Noah Rose Ledesma19f8a79ca2022-11-01 18:19:46486// A Mojo remote was unexpectedly disconnected.
S. Ganeshdba3f732024-07-13 00:40:17487inline constexpr int kErrorIpcDisconnect = kUpdaterErrorBase + 35;
Noah Rose Ledesma19f8a79ca2022-11-01 18:19:46488
Noah Rose Ledesma3fcbdad2022-11-15 18:47:26489// Failed to copy the updater binary.
S. Ganeshdba3f732024-07-13 00:40:17490inline constexpr int kErrorFailedToCopyBinary = kUpdaterErrorBase + 36;
Noah Rose Ledesma3fcbdad2022-11-15 18:47:26491
Joshua Pawlicki221f6682023-05-25 19:23:54492// Failed to delete a socket file.
S. Ganeshdba3f732024-07-13 00:40:17493inline constexpr int kErrorFailedToDeleteSocket = kUpdaterErrorBase + 37;
Noah Rose Ledesma3fcbdad2022-11-15 18:47:26494
Joshua Pawlicki221f6682023-05-25 19:23:54495// Failed to create a symlink to the current version.
S. Ganeshdba3f732024-07-13 00:40:17496inline constexpr int kErrorFailedToLinkCurrent = kUpdaterErrorBase + 38;
Joshua Pawlicki16df3a82022-12-15 18:04:19497
Joshua Pawlicki221f6682023-05-25 19:23:54498// Failed to rename the current symlink during activation.
S. Ganeshdba3f732024-07-13 00:40:17499inline constexpr int kErrorFailedToRenameCurrent = kUpdaterErrorBase + 39;
Joshua Pawlicki16df3a82022-12-15 18:04:19500
Noah Rose Ledesma59a4c5d42023-01-11 22:11:34501// Failed to install one or more Systemd units.
S. Ganeshdba3f732024-07-13 00:40:17502inline constexpr int kErrorFailedToInstallSystemdUnit = kUpdaterErrorBase + 40;
Noah Rose Ledesma59a4c5d42023-01-11 22:11:34503
504// Failed to remove one or more Systemd units during uninstallation.
S. Ganeshdba3f732024-07-13 00:40:17505inline constexpr int kErrorFailedToRemoveSystemdUnit = kUpdaterErrorBase + 41;
Noah Rose Ledesma59a4c5d42023-01-11 22:11:34506
Joshua Pawlicki1dbc0072023-03-01 22:36:31507// Running as the wrong user for the provided UpdaterScope.
S. Ganeshdba3f732024-07-13 00:40:17508inline constexpr int kErrorWrongUser = kUpdaterErrorBase + 42;
Joshua Pawlicki1dbc0072023-03-01 22:36:31509
Baitinq0aff85e2023-04-20 19:49:37510// Failed to get the setup files.
S. Ganeshdba3f732024-07-13 00:40:17511inline constexpr int kErrorFailedToGetSetupFiles = kUpdaterErrorBase + 43;
Baitinq0aff85e2023-04-20 19:49:37512
513// Failed to run install list.
S. Ganeshdba3f732024-07-13 00:40:17514inline constexpr int kErrorFailedToRunInstallList = kUpdaterErrorBase + 44;
Baitinq0aff85e2023-04-20 19:49:37515
Joshua Pawlickie5812592023-06-12 17:24:54516// The server was running but had no tasks to do.
S. Ganeshdba3f732024-07-13 00:40:17517inline constexpr int kErrorIdle = kUpdaterErrorBase + 45;
Joshua Pawlickie5812592023-06-12 17:24:54518
Joshua Pawlicki85369dc2024-02-29 17:40:03519// The call was rejected because the user needs to accept the EULA / Terms of
520// service.
S. Ganeshdba3f732024-07-13 00:40:17521inline constexpr int kErrorEulaRequired = kUpdaterErrorBase + 46;
Joshua Pawlicki85369dc2024-02-29 17:40:03522
Joshua Pawlicki107feb82024-05-07 15:57:15523// The current operating system is not supported.
S. Ganeshdba3f732024-07-13 00:40:17524inline constexpr int kErrorUnsupportedOperatingSystem = kUpdaterErrorBase + 47;
Joshua Pawlicki107feb82024-05-07 15:57:15525
S. Ganeshdba3f732024-07-13 00:40:17526inline constexpr int kErrorTagParsing = kUpdaterErrorBase + 50;
Sorin Jianu3bc96ba2022-02-18 20:38:34527
Joshua Pawlickidc8ee1412022-03-10 21:07:37528// Metainstaller errors.
S. Ganeshdba3f732024-07-13 00:40:17529inline constexpr int kErrorCreatingTempDir = kUpdaterErrorBase + 60;
530inline constexpr int kErrorUnpackingResource = kUpdaterErrorBase + 61;
531inline constexpr int kErrorInitializingBackupDir = kUpdaterErrorBase + 62;
Joshua Pawlickidc8ee1412022-03-10 21:07:37532
Joshua Pawlicki16df3a82022-12-15 18:04:19533// Launcher errors.
S. Ganeshdba3f732024-07-13 00:40:17534inline constexpr int kErrorGettingUpdaterPath = kUpdaterErrorBase + 71;
535inline constexpr int kErrorStattingPath = kUpdaterErrorBase + 72;
536inline constexpr int kErrorLaunchingProcess = kUpdaterErrorBase + 73;
537inline constexpr int kErrorPathOwnershipMismatch = kUpdaterErrorBase + 74;
Joshua Pawlicki16df3a82022-12-15 18:04:19538
S. Ganesh899760842023-03-08 17:29:43539// A setup process could not acquire the lock needed to run.
S. Ganeshdba3f732024-07-13 00:40:17540inline constexpr int kErrorFailedToLockSetupMutex = kUpdaterErrorBase + 75;
S. Ganesh899760842023-03-08 17:29:43541
Xiaoling Bao15bf6f312024-08-05 22:00:04542// Cannot establish a Mojo connection.
543inline constexpr int kErrorMojoConnectionFailure = kUpdaterErrorBase + 76;
544
545// Mojo server rejected the request.
546inline constexpr int kErrorMojoRequestRejected = kUpdaterErrorBase + 77;
547
Xiaoling Bao0ddb5f62024-08-05 23:46:36548// Cannot find the console user, for example when the user is not logged on.
549inline constexpr int kErrorNoConsoleUser = kUpdaterErrorBase + 78;
550
Xiaoling Bao2af464ec2024-08-27 01:29:26551// Failed to fetch enterprise policies.
552inline constexpr int kErrorPolicyFetchFailed = kUpdaterErrorBase + 79;
553
Xiaoling Bao0f020e72024-09-12 23:18:49554// Failed to uninstall the enterprise companion app.
555inline constexpr int kErrorFailedToUninstallCompanionApp =
556 kUpdaterErrorBase + 80;
557
558// Failed to uninstall the other versions of updater.
559inline constexpr int kErrorFailedToUninstallOtherVersion =
560 kUpdaterErrorBase + 81;
561
S. Ganesh1f0fc1a32025-01-06 22:24:50562// No observer completion info for the install.
563inline constexpr int kErrorNoObserverCompletionInfo = kUpdaterErrorBase + 82;
564
565// No apps to install.
566inline constexpr int kErrorNoApps = kUpdaterErrorBase + 83;
567
Joshua Pawlickid353caa12025-11-04 18:05:06568// A path references the parent directory.
569inline constexpr int kErrorPathReferencesParent = kUpdaterErrorBase + 84;
570
S. Ganesha61c38f2020-04-16 15:44:41571// Policy Management constants.
Xiaoling Baof3dd5a2a2021-03-13 00:02:51572// The maximum value allowed for policy AutoUpdateCheckPeriodMinutes.
S. Ganesh2707fe52022-10-06 21:33:45573inline constexpr int kMaxAutoUpdateCheckPeriodMinutes = 43200;
Xiaoling Baof3dd5a2a2021-03-13 00:02:51574
575// The maximum value allowed for policy UpdatesSuppressedDurationMin.
S. Ganesh2707fe52022-10-06 21:33:45576inline constexpr int kMaxUpdatesSuppressedDurationMinutes = 960;
Xiaoling Baof3dd5a2a2021-03-13 00:02:51577
Avi Drissman42630642024-07-16 14:25:24578inline constexpr char kProxyModeDirect[] = "direct";
579inline constexpr char kProxyModeAutoDetect[] = "auto_detect";
580inline constexpr char kProxyModePacScript[] = "pac_script";
581inline constexpr char kProxyModeFixedServers[] = "fixed_servers";
582inline constexpr char kProxyModeSystem[] = "system";
S. Ganesha61c38f2020-04-16 15:44:41583
Avi Drissman42630642024-07-16 14:25:24584inline constexpr char kDownloadPreferenceCacheable[] = "cacheable";
S. Ganesh5da16392020-04-24 22:49:46585
S. Ganeshe4b62ffa2022-03-18 01:51:48586// UTF8 byte order mark (BOM) used to prefix the contents of the installerdata
587// file.
Avi Drissman42630642024-07-16 14:25:24588inline constexpr char kUTF8BOM[] = "\xEF\xBB\xBF";
S. Ganeshe4b62ffa2022-03-18 01:51:48589
S. Ganesh2707fe52022-10-06 21:33:45590inline constexpr int kPolicyNotSet = -1;
591inline constexpr int kPolicyDisabled = 0;
592inline constexpr int kPolicyEnabled = 1;
593inline constexpr int kPolicyEnabledMachineOnly = 4;
594inline constexpr int kPolicyManualUpdatesOnly = 2;
595inline constexpr int kPolicyAutomaticUpdatesOnly = 3;
596inline constexpr int kPolicyForceInstallMachine = 5;
597inline constexpr int kPolicyForceInstallUser = 6;
S. Ganesha61c38f2020-04-16 15:44:41598
S. Ganesh2707fe52022-10-06 21:33:45599inline constexpr bool kInstallPolicyDefault = kPolicyEnabled;
600inline constexpr bool kUpdatePolicyDefault = kPolicyEnabled;
S. Ganesha61c38f2020-04-16 15:44:41601
S. Ganesh62e77e52025-01-17 21:49:52602// Policy manager constants.
Avi Drissman42630642024-07-16 14:25:24603inline constexpr char kSourceDMPolicyManager[] = "Device Management";
Avi Drissman42630642024-07-16 14:25:24604inline constexpr char kSourceDefaultValuesPolicyManager[] = "Default";
605inline constexpr char kSourceDictValuesPolicyManager[] = "DictValuePolicy";
Xiaoling Bao716555d2025-01-15 20:30:35606#if BUILDFLAG(IS_WIN)
S. Ganesh62e77e52025-01-17 21:49:52607inline constexpr bool kPlatformPolicyManagerDefined = true;
Xiaoling Bao716555d2025-01-15 20:30:35608inline constexpr char kSourcePlatformPolicyManager[] = "Group Policy";
S. Ganesh62e77e52025-01-17 21:49:52609
610// On Windows, by default, Group Policy has a higher priority than the
611// clould policy.
612inline constexpr bool kCloudPolicyOverridesPlatformPolicyDefaultValue = false;
Xiaoling Bao716555d2025-01-15 20:30:35613#elif BUILDFLAG(IS_MAC)
S. Ganesh62e77e52025-01-17 21:49:52614inline constexpr bool kPlatformPolicyManagerDefined = true;
Xiaoling Bao716555d2025-01-15 20:30:35615inline constexpr char kSourcePlatformPolicyManager[] = "Managed Preferences";
S. Ganesh62e77e52025-01-17 21:49:52616
617// On macOS, cloud policy has a higher priority than the Managed Preferences.
618inline constexpr bool kCloudPolicyOverridesPlatformPolicyDefaultValue = true;
Xiaoling Bao716555d2025-01-15 20:30:35619#else
S. Ganesh62e77e52025-01-17 21:49:52620inline constexpr bool kPlatformPolicyManagerDefined = false;
Xiaoling Bao716555d2025-01-15 20:30:35621inline constexpr char kSourcePlatformPolicyManager[] = "not-defined";
S. Ganesh62e77e52025-01-17 21:49:52622
623// On other platforms, there's no platform policy at the moment, the value
624// doesn't actually matter.
625inline constexpr bool kCloudPolicyOverridesPlatformPolicyDefaultValue = true;
Xiaoling Bao716555d2025-01-15 20:30:35626#endif
S. Ganeshd76f8a52023-01-20 02:27:50627
Noah Rose Ledesma9f16ddf2025-11-07 21:14:45628enum class UninstallPingReason {
629 kUninstalled = 0,
630 kUserNotAnOwner = 1,
631 kNoAppsRemain = 2,
632 kNeverHadApps = 3,
633};
Sorin Jianu9f9f5c9e2020-11-15 05:31:15634
Mila Green1313bb82020-12-12 00:57:36635// The file downloaded to a temporary location could not be moved.
S. Ganesh2707fe52022-10-06 21:33:45636inline constexpr int kErrorFailedToMoveDownloadedFile = 5;
Mila Green1313bb82020-12-12 00:57:36637
Xiaoling Bao15bf6f312024-08-05 22:00:04638// Error occurred during file writing.
639inline constexpr int kErrorFailedToWriteFile = 6;
640
S. Ganesh9483f2f2024-11-11 14:28:26641inline constexpr base::TimeDelta kInitialDelay = base::Seconds(1);
Noah Rose Ledesmad391ac332022-12-13 21:09:06642inline constexpr base::TimeDelta kServerKeepAliveTime = base::Seconds(10);
Mila Greencd91cb4d2020-12-30 00:15:45643
Xiaoling Bao760b128a2024-10-02 23:17:15644inline constexpr base::TimeDelta kCecaConnectionTimeout = base::Seconds(30);
645
Michael Chang1a981f412021-06-04 21:54:49646// The maximum number of server starts before the updater uninstalls itself
647// while waiting for the first app registration.
S. Ganesh2707fe52022-10-06 21:33:45648inline constexpr int kMaxServerStartsBeforeFirstReg = 24;
Michael Chang1a981f412021-06-04 21:54:49649
S. Ganesha989f742023-11-09 18:14:48650// Number of tries when an installer returns `ERROR_INSTALL_ALREADY_RUNNING`.
651inline constexpr int kNumAlreadyRunningMaxTries = 4;
652
653// Initial delay between retries when an installer returns
654// `ERROR_INSTALL_ALREADY_RUNNING`.
655inline constexpr base::TimeDelta kAlreadyRunningRetryInitialDelay =
656 base::Seconds(5);
657
S. Ganesh2e183602021-11-29 19:54:18658// These are GoogleUpdate error codes, which must be retained by this
659// implementation in order to be backward compatible with the existing update
660// client code in Chrome.
S. Ganesh2707fe52022-10-06 21:33:45661inline constexpr int GOOPDATE_E_APP_INSTALL_DISABLED_BY_POLICY = 0x80040812;
662inline constexpr int GOOPDATE_E_APP_UPDATE_DISABLED_BY_POLICY = 0x80040813;
663inline constexpr int GOOPDATE_E_APP_UPDATE_DISABLED_BY_POLICY_MANUAL =
664 0x8004081f;
S. Ganesh3c91a381b2023-11-02 21:59:35665inline constexpr int GOOPDATEINSTALL_E_FILENAME_INVALID = 0x80040900;
666inline constexpr int GOOPDATEINSTALL_E_INSTALLER_FAILED_START = 0x80040901;
S. Ganesh2707fe52022-10-06 21:33:45667inline constexpr int GOOPDATEINSTALL_E_INSTALLER_FAILED = 0x80040902;
S. Ganesh89538502023-11-03 17:14:16668inline constexpr int GOOPDATEINSTALL_E_INSTALLER_TIMED_OUT = 0x80040904;
S. Ganesha989f742023-11-09 18:14:48669inline constexpr int GOOPDATEINSTALL_E_INSTALL_ALREADY_RUNNING = 0x80040907;
S. Ganesh2e183602021-11-29 19:54:18670
Joshua Pawlickif14af822024-05-22 19:37:11671// Install Sources.
Avi Drissman42630642024-07-16 14:25:24672inline constexpr char kInstallSourceTaggedMetainstaller[] = "taggedmi";
673inline constexpr char kInstallSourceOffline[] = "offline";
674inline constexpr char kInstallSourcePolicy[] = "policy";
675inline constexpr char kInstallSourceOnDemand[] = "ondemand";
Joshua Pawlickif14af822024-05-22 19:37:11676
S. Ganesh52e2c902025-08-29 01:10:45677inline constexpr int kRegistrationSuccess = 0;
678inline constexpr int kRegistrationError = 1;
679
Sorin Jianuf4f51699e2019-03-27 20:39:03680} // namespace updater
681
Sorin Jianue066c6a2020-02-22 00:28:56682#endif // CHROME_UPDATER_CONSTANTS_H_