1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 //
5 // Defines all install related constants that need to be used by Chrome as
6 // well as Chrome Installer.
7 
8 #ifndef CHROME_INSTALLER_UTIL_UTIL_CONSTANTS_H_
9 #define CHROME_INSTALLER_UTIL_UTIL_CONSTANTS_H_
10 
11 #include <stddef.h>
12 
13 #include "base/files/file_path.h"
14 
15 namespace installer {
16 
17 // Return status of installer. Values in this enum must not change. Always add
18 // to the end. When removing an unused value, retain the deprecated name and
19 // value in a comment for posterity's sake, but take the liberty of removing the
20 // old doc string.
21 enum InstallStatus {
22   FIRST_INSTALL_SUCCESS = 0,      // First install of Chrome succeeded.
23   INSTALL_REPAIRED = 1,           // Same version reinstalled for repair.
24   NEW_VERSION_UPDATED = 2,        // Chrome successfully updated to new version.
25   EXISTING_VERSION_LAUNCHED = 3,  // No work done; launched existing Chrome.
26   HIGHER_VERSION_EXISTS = 4,      // Higher version of Chrome already exists
27   USER_LEVEL_INSTALL_EXISTS = 5,  // User level install already exists.
28   SYSTEM_LEVEL_INSTALL_EXISTS = 6,  // Machine level install already exists.
29   INSTALL_FAILED = 7,               // Install/update failed.
30   SETUP_PATCH_FAILED = 8,           // Failed to patch setup.exe.
31   OS_NOT_SUPPORTED = 9,             // Current OS not supported.
32   OS_ERROR = 10,                    // OS API call failed.
33   TEMP_DIR_FAILED = 11,             // Unable to get Temp directory.
34   UNCOMPRESSION_FAILED = 12,        // Failed to uncompress Chrome archive.
35   INVALID_ARCHIVE = 13,       // Something wrong with the installer archive.
36   INSUFFICIENT_RIGHTS = 14,   // User trying system level install is not Admin.
37   CHROME_NOT_INSTALLED = 15,  // Chrome not installed (returned in case of
38                               // uninstall).
39   CHROME_RUNNING = 16,        // Chrome currently running (when trying to
40                               // uninstall).
41   UNINSTALL_CONFIRMED = 17,   // User has confirmed Chrome uninstall.
42   UNINSTALL_DELETE_PROFILE = 18,  // User okayed uninstall and profile deletion.
43   UNINSTALL_SUCCESSFUL = 19,      // Chrome successfully uninstalled.
44   UNINSTALL_FAILED = 20,          // Chrome uninstallation failed.
45   UNINSTALL_CANCELLED = 21,       // User cancelled Chrome uninstallation.
46   UNKNOWN_STATUS = 22,            // Unknown status (this should never happen).
47   RENAME_SUCCESSFUL = 23,     // Rename of new_chrome.exe to chrome.exe worked.
48   RENAME_FAILED = 24,         // Rename of new_chrome.exe failed.
49   EULA_REJECTED = 25,         // EULA dialog was not accepted by user.
50   EULA_ACCEPTED = 26,         // EULA dialog was accepted by user.
51   EULA_ACCEPTED_OPT_IN = 27,  // EULA accepted with the crash option selected.
52   INSTALL_DIR_IN_USE = 28,    // Installation directory is in use by another
53                               // process
54   UNINSTALL_REQUIRES_REBOOT = 29,  // Uninstallation required a reboot.
55   IN_USE_UPDATED = 30,  // Chrome successfully updated but old version
56                         // running.
57   SAME_VERSION_REPAIR_FAILED = 31,  // Chrome repair failed as Chrome was
58                                     // running.
59   REENTRY_SYS_UPDATE = 32,  // Setup has been re-launched as the interactive
60                             // user.
61   SXS_OPTION_NOT_SUPPORTED = 33,  // The chrome-sxs option provided does not
62                                   // work with other command line options.
63   // NON_MULTI_INSTALLATION_EXISTS = 34,
64   // MULTI_INSTALLATION_EXISTS = 35,
65   // READY_MODE_OPT_IN_FAILED = 36,
66   // READY_MODE_TEMP_OPT_OUT_FAILED = 37,
67   // READY_MODE_END_TEMP_OPT_OUT_FAILED = 38,
68   // CONFLICTING_CHANNEL_EXISTS = 39,
69   // READY_MODE_REQUIRES_CHROME = 40,
70   // APP_HOST_REQUIRES_MULTI_INSTALL = 41,
71   APPLY_DIFF_PATCH_FAILED = 42,  // Failed to apply a diff patch.
72   // INCONSISTENT_UPDATE_POLICY = 43,
73   // APP_HOST_REQUIRES_USER_LEVEL = 44,
74   // APP_HOST_REQUIRES_BINARIES = 45,
75   // INSTALL_OF_GOOGLE_UPDATE_FAILED = 46,
76   INVALID_STATE_FOR_OPTION = 47,  // A non-install option was called with an
77                                   // invalid installer state.
78   // WAIT_FOR_EXISTING_FAILED = 48,
79   PATCH_INVALID_ARGUMENTS = 49,    // The arguments of --patch were missing or
80                                    // they were invalid for any reason.
81   DIFF_PATCH_SOURCE_MISSING = 50,  // No previous version archive found for
82                                    // differential update.
83   // UNUSED_BINARIES = 51,
84   // UNUSED_BINARIES_UNINSTALLED = 52,
85   UNSUPPORTED_OPTION = 53,          // An unsupported legacy option was given.
86   CPU_NOT_SUPPORTED = 54,           // Current OS not supported
87   REENABLE_UPDATES_SUCCEEDED = 55,  // Autoupdates are now enabled.
88   REENABLE_UPDATES_FAILED = 56,     // Autoupdates could not be enabled.
89   UNPACKING_FAILED = 57,       // Unpacking the (possibly patched) uncompressed
90                                // archive failed.
91   IN_USE_DOWNGRADE = 58,       // Successfully downgrade chrome but current
92                                // version is still running.
93   OLD_VERSION_DOWNGRADE = 59,  // Successfully downgrade chrome to an older
94                                // version.
95   SETUP_SINGLETON_ACQUISITION_FAILED = 60,  // The setup process could not
96                                             // acquire the exclusive right to
97                                             // modify the Chrome installation.
98   SETUP_SINGLETON_RELEASED = 61,            // The task did not complete because
99                                             // another process asked this
100                                             // process to release the exclusive
101                                             // right to modify the Chrome
102                                             // installation.
103   DELETE_OLD_VERSIONS_SUCCESS = 62,         // All files that belong to old
104                                             // versions of Chrome were
105                                             // successfully deleted.
106   DELETE_OLD_VERSIONS_TOO_MANY_ATTEMPTS = 63,  // A --delete-old-versions
107                                                // process exited after trying to
108                                                // delete all files that belong
109                                                // to old versions of Chrome too
110                                                // many times without success.
111   STORE_DMTOKEN_FAILED = 64,   // Failed to write the specified DMToken to the
112                                // registry.
113   STORE_DMTOKEN_SUCCESS = 65,  // Writing the specified DMToken to the registry
114                                // succeeded.
115   MAX_INSTALL_STATUS = 66,     // When adding a new result, bump this and update
116                                // the InstallStatus enum in histograms.xml.
117 };
118 
119 // The type of an update archive.
120 enum ArchiveType {
121   UNKNOWN_ARCHIVE_TYPE,     // Unknown or uninitialized.
122   FULL_ARCHIVE_TYPE,        // Full chrome.7z archive.
123   INCREMENTAL_ARCHIVE_TYPE  // Incremental or differential archive.
124 };
125 
126 // Stages of an installation from which a progress indication is derived.
127 // Generally listed in the order in which they are reached. The exceptions to
128 // this are the fork-and-join for diff vs. full installers (where there are
129 // additional (costly) stages for the former) and rollback in case of error.
130 enum InstallerStage {
131   NO_STAGE,                  // No stage to report.
132   UPDATING_SETUP,            // Patching setup.exe with differential update.
133   PRECONDITIONS,             // Evaluating pre-install conditions.
134   UNCOMPRESSING,             // Uncompressing chrome.packed.7z.
135   PATCHING,                  // Patching chrome.7z with differential update.
136   UNPACKING,                 // Unpacking chrome.7z.
137   CREATING_VISUAL_MANIFEST,  // Creating VisualElementsManifest.xml.
138   BUILDING,                  // Building the install work item list.
139   EXECUTING,                 // Executing the install work item list.
140   COPYING_PREFERENCES_FILE,  // Copying preferences file.
141   CREATING_SHORTCUTS,        // Creating shortcuts.
142   REGISTERING_CHROME,        // Performing Chrome registration.
143   REMOVING_OLD_VERSIONS,     // Deleting old version directories.
144   ROLLINGBACK,               // Rolling-back the install work item list.
145   FINISHING,                 // Finishing the install.
146   NUM_STAGES                 // The number of stages.
147 };
148 
149 namespace switches {
150 
151 extern const char kAllowDowngrade[];
152 extern const char kChannel[];
153 extern const char kConfigureUserSettings[];
154 extern const char kCriticalUpdateVersion[];
155 extern const char kDeleteOldVersions[];
156 extern const char kDeleteProfile[];
157 extern const char kDisableLogging[];
158 extern const char kDoNotLaunchChrome[];
159 extern const char kDoNotRegisterForUpdateLaunch[];
160 extern const char kDoNotRemoveSharedItems[];
161 extern const char kEnableLogging[];
162 extern const char kForceConfigureUserSettings[];
163 extern const char kForceUninstall[];
164 extern const char kInputFile[];
165 extern const char kInstallArchive[];
166 extern const char kInstallerData[];
167 extern const char kLogFile[];
168 extern const char kMakeChromeDefault[];
169 extern const char kMsi[];
170 extern const char kNewSetupExe[];
171 extern const char kOnOsUpgrade[];
172 extern const char kOutputFile[];
173 extern const char kPatch[];
174 extern const char kPatchFile[];
175 extern const char kPreviousVersion[];
176 extern const char kReenableAutoupdates[];
177 extern const char kRegisterChromeBrowser[];
178 extern const char kRegisterChromeBrowserSuffix[];
179 extern const char kRegisterDevChrome[];
180 extern const char kRegisterURLProtocol[];
181 extern const char kRemoveChromeRegistration[];
182 extern const char kRenameChromeExe[];
183 extern const char kRunAsAdmin[];
184 extern const char kSelfDestruct[];
185 extern const char kShowEula[];
186 extern const char kStoreDMToken[];
187 extern const char kSystemLevel[];
188 extern const char kTriggerActiveSetup[];
189 extern const char kUncompressedArchive[];
190 extern const char kUninstall[];
191 extern const char kUpdateSetupExe[];
192 extern const char kVerboseLogging[];
193 
194 }  // namespace switches
195 
196 namespace env_vars {
197 
198 extern const char kGoogleUpdateIsMachineEnvVar[];
199 
200 }  // namespace env_vars
201 
202 extern const wchar_t kActiveSetupExe[];
203 extern const wchar_t kChromeDll[];
204 extern const wchar_t kChromeExe[];
205 extern const wchar_t kChromeNewExe[];
206 extern const wchar_t kChromeOldExe[];
207 extern const wchar_t kChromeProxyExe[];
208 extern const wchar_t kChromeProxyNewExe[];
209 extern const wchar_t kChromeProxyOldExe[];
210 extern const wchar_t kCmdOnOsUpgrade[];
211 extern const wchar_t kCmdStoreDMToken[];
212 extern const wchar_t kEulaSentinelFile[];
213 extern const wchar_t kInstallBinaryDir[];
214 extern const wchar_t kInstallerDir[];
215 extern const wchar_t kInstallTempDir[];
216 extern const wchar_t kLnkExt[];
217 extern const wchar_t kNaClExe[];
218 extern const wchar_t kNotificationHelperExe[];
219 extern const wchar_t kSetupExe[];
220 extern const wchar_t kUninstallArgumentsField[];
221 extern const wchar_t kUninstallDisplayNameField[];
222 extern const wchar_t kUninstallInstallationDate[];
223 extern const wchar_t kUninstallStringField[];
224 
225 // Elevation Service constants.
226 extern const base::FilePath::CharType kElevationServiceExe[];
227 
228 // Google Update installer result API.
229 extern const wchar_t kInstallerError[];
230 extern const wchar_t kInstallerExtraCode1[];
231 extern const wchar_t kInstallerResult[];
232 extern const wchar_t kInstallerResultUIString[];
233 extern const wchar_t kInstallerSuccessLaunchCmdLine[];
234 
235 // Chrome channel display names.
236 // NOTE: Canary is not strictly a 'channel', but rather a separate product
237 //     installed side-by-side. However, GoogleUpdateSettings::GetChromeChannel
238 //     will return "canary" for that product.
239 extern const wchar_t kChromeChannelUnknown[];
240 extern const wchar_t kChromeChannelCanary[];
241 extern const wchar_t kChromeChannelDev[];
242 extern const wchar_t kChromeChannelBeta[];
243 extern const wchar_t kChromeChannelStable[];
244 extern const wchar_t kChromeChannelStableExplicit[];
245 
246 extern const size_t kMaxAppModelIdLength;
247 enum : size_t { kMaxDMTokenLength = 4096 };
248 
249 // Name of the allocator (and associated file) for storing histograms to be
250 // reported by Chrome during its next upload.
251 extern const char kSetupHistogramAllocatorName[];
252 
253 }  // namespace installer
254 
255 #endif  // CHROME_INSTALLER_UTIL_UTIL_CONSTANTS_H_
256