Home | History | Annotate | Download | only in util
      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 "base/basictypes.h"
     12 
     13 namespace installer {
     14 
     15 // Return status of installer
     16 enum InstallStatus {
     17   FIRST_INSTALL_SUCCESS,  // 0. Successfully installed Chrome for the first time
     18   INSTALL_REPAIRED,       // 1. Same version reinstalled for repair
     19   NEW_VERSION_UPDATED,    // 2. Chrome successfully updated to new version
     20   EXISTING_VERSION_LAUNCHED,  // 3. No work done, just launched existing chrome
     21   HIGHER_VERSION_EXISTS,  // 4. Higher version of Chrome already exists
     22   USER_LEVEL_INSTALL_EXISTS,  // 5. User level install already exists
     23   SYSTEM_LEVEL_INSTALL_EXISTS,  // 6. Machine level install already exists
     24   INSTALL_FAILED,         // 7. Install/update failed
     25   SETUP_PATCH_FAILED,     // 8. Failed to patch setup.exe
     26   OS_NOT_SUPPORTED,       // 9. Current OS not supported
     27   OS_ERROR,               // 10. OS API call failed
     28   TEMP_DIR_FAILED,        // 11. Unable to get Temp directory
     29   UNCOMPRESSION_FAILED,   // 12. Failed to uncompress Chrome archive
     30   INVALID_ARCHIVE,        // 13. Something wrong with the installer archive
     31   INSUFFICIENT_RIGHTS,    // 14. User trying system level install is not Admin
     32   CHROME_NOT_INSTALLED,   // 15. Chrome not installed (returned in case of
     33                           // uninstall)
     34   CHROME_RUNNING,         // 16. Chrome currently running (when trying to
     35                           // uninstall)
     36   UNINSTALL_CONFIRMED,    // 17. User has confirmed Chrome uninstall
     37   UNINSTALL_DELETE_PROFILE,  // 18. User okayed uninstall and profile deletion.
     38   UNINSTALL_SUCCESSFUL,   // 19. Chrome successfully uninstalled
     39   UNINSTALL_FAILED,       // 20. Chrome uninstallation failed
     40   UNINSTALL_CANCELLED,    // 21. User cancelled Chrome uninstallation
     41   UNKNOWN_STATUS,         // 22. Unknown status (this should never happen)
     42   RENAME_SUCCESSFUL,      // 23. Rename of new_chrome.exe to chrome.exe worked
     43   RENAME_FAILED,          // 24. Rename of new_chrome.exe failed
     44   EULA_REJECTED,          // 25. EULA dialog was not accepted by user.
     45   EULA_ACCEPTED,          // 26. EULA dialog was accepted by user.
     46   EULA_ACCEPTED_OPT_IN,   // 27. EULA accepted with the crash option selected.
     47   INSTALL_DIR_IN_USE,     // 28. Installation directory is in use by another
     48                           // process
     49   UNINSTALL_REQUIRES_REBOOT,  // 29. Uninstallation required a reboot.
     50   IN_USE_UPDATED,         // 30. Chrome successfully updated but old version
     51                           // running
     52   SAME_VERSION_REPAIR_FAILED,  // 31. Chrome repair failed as Chrome was running
     53   REENTRY_SYS_UPDATE,     // 32. Setup has been re-launched as the interactive
     54                           // user
     55   SXS_OPTION_NOT_SUPPORTED,  // 33. The chrome-sxs option provided does not work
     56                              // with other command line options.
     57   NON_MULTI_INSTALLATION_EXISTS,  // 34. We tried to do a multi-install but
     58                                   // failed because there's an existing
     59                                   // installation of the same product on the
     60                                   // system, but in 'single' mode.
     61   MULTI_INSTALLATION_EXISTS,  // 35. We tried to do a 'single' install but
     62                               // failed because there's an existing
     63                               // multi-install installation of the same product
     64                               // on the system.
     65   READY_MODE_OPT_IN_FAILED,   // 36. Failed to opt-into Chrome Frame.
     66   READY_MODE_TEMP_OPT_OUT_FAILED,   // 37. Failed to temporarily opt-out of
     67                                     // Chrome Frame.
     68   READY_MODE_END_TEMP_OPT_OUT_FAILED,   // 38. Failed to end temporary opt-out
     69                                         // of Chrome Frame.
     70   CONFLICTING_CHANNEL_EXISTS,  // 39. A multi-install product on a different
     71                                // update channel exists.
     72   READY_MODE_REQUIRES_CHROME,  // 40. Chrome Frame in ready-mode requires Chrome
     73   APP_HOST_REQUIRES_MULTI_INSTALL,  // 41. --multi-install was missing from the
     74                                // command line.
     75   APPLY_DIFF_PATCH_FAILED,     // 42. Failed to apply a diff patch.
     76   INCONSISTENT_UPDATE_POLICY,  // 43. Inconsistent update policy GP settings.
     77   APP_HOST_REQUIRES_USER_LEVEL,  // 44. --system-level is forbidden.
     78   APP_HOST_REQUIRES_BINARIES,  // 45. No Chrome binaries at either level.
     79   INSTALL_OF_GOOGLE_UPDATE_FAILED,  // 46. Failed to install Google Update.
     80   INVALID_STATE_FOR_OPTION,    // 47. A non-install option was called with an
     81                                // invalid installer state.
     82   WAIT_FOR_EXISTING_FAILED,    // 48. OS error waiting for existing setup.exe.
     83   PATCH_INVALID_ARGUMENTS,     // 49. The arguments of --patch were missing or
     84                                // they were invalid for any reason.
     85   DIFF_PATCH_SOURCE_MISSING,   // 50. No previous version archive found for
     86                                // differential update.
     87   UNUSED_BINARIES,             // 51. No multi-install products to update. The
     88                                // binaries will be uninstalled if they are not
     89                                // in use.
     90   UNUSED_BINARIES_UNINSTALLED,  // 52. The binaries were uninstalled.
     91   UNSUPPORTED_OPTION,          // 53. An unsupported legacy option was given.
     92   // Friendly reminder: note the COMPILE_ASSERT below.
     93 };
     94 
     95 
     96 // Existing InstallStatus values must not change.  Always add to the end.
     97 COMPILE_ASSERT(installer::UNSUPPORTED_OPTION == 53,
     98                dont_change_enum);
     99 
    100 // The type of an update archive.
    101 enum ArchiveType {
    102   UNKNOWN_ARCHIVE_TYPE,     // Unknown or uninitialized.
    103   FULL_ARCHIVE_TYPE,        // Full chrome.7z archive.
    104   INCREMENTAL_ARCHIVE_TYPE  // Incremental or differential archive.
    105 };
    106 
    107 // Stages of an installation reported through Google Update on failure.
    108 // The order and value of existing enums must not change. Please add new
    109 // values to the end (before NUM_STAGES) and update the compile assert below
    110 // to assert on the last value added.
    111 enum InstallerStage {
    112   NO_STAGE,                    // 0: No stage to report.
    113   PRECONDITIONS,               // 1: Evaluating pre-install conditions.
    114   UNCOMPRESSING,               // 2: Uncompressing chrome.packed.7z.
    115   ENSEMBLE_PATCHING,           // 3: Patching chrome.7z using courgette.
    116   BINARY_PATCHING,             // 4: Patching chrome.7z using bspatch.
    117   UNPACKING,                   // 5: Unpacking chrome.7z.
    118   BUILDING,                    // 6: Building the install work item list.
    119   EXECUTING,                   // 7: Executing the install work item list.
    120   ROLLINGBACK,                 // 8: Rolling-back the install work item list.
    121   REFRESHING_POLICY,           // 9: Refreshing the elevation policy.
    122   UPDATING_CHANNELS,           // 10: Updating channel information.
    123   COPYING_PREFERENCES_FILE,    // 11: Copying preferences file.
    124   CREATING_SHORTCUTS,          // 12: Creating shortcuts.
    125   REGISTERING_CHROME,          // 13: Performing Chrome registration.
    126   REMOVING_OLD_VERSIONS,       // 14: Deleting old version directories.
    127   FINISHING,                   // 15: Finishing the install.
    128   CONFIGURE_AUTO_LAUNCH,       // 16: Configuring Chrome to auto-launch.
    129   CREATING_VISUAL_MANIFEST,    // 17: Creating VisualElementsManifest.xml
    130   DEFERRING_TO_HIGHER_VERSION,  // 18: Deferring to an installed higher version.
    131   UNINSTALLING_BINARIES,       // 19: Uninstalling unused binaries.
    132   UNINSTALLING_CHROME_FRAME,   // 20: Uninstalling multi-install Chrome Frame.
    133   NUM_STAGES                   // 21: The number of stages.
    134 };
    135 
    136 // When we start reporting the numerical values from the enum, the order
    137 // above MUST be preserved.
    138 COMPILE_ASSERT(UNINSTALLING_CHROME_FRAME == 20,
    139                never_ever_ever_change_InstallerStage_values_bang);
    140 
    141 namespace switches {
    142 
    143 extern const char kAutoLaunchChrome[];
    144 extern const char kChrome[];
    145 extern const char kChromeAppHostDeprecated[];  // TODO(huangs): Remove by M27.
    146 extern const char kChromeAppLauncher[];
    147 extern const char kChromeFrame[];
    148 extern const char kChromeSxS[];
    149 extern const char kConfigureUserSettings[];
    150 extern const char kCriticalUpdateVersion[];
    151 extern const char kDeleteProfile[];
    152 extern const char kDisableLogging[];
    153 extern const char kDoNotLaunchChrome[];
    154 extern const char kDoNotRegisterForUpdateLaunch[];
    155 extern const char kDoNotRemoveSharedItems[];
    156 extern const char kEnableLogging[];
    157 extern const char kEnsureGoogleUpdatePresent[];
    158 extern const char kForceConfigureUserSettings[];
    159 extern const char kForceUninstall[];
    160 extern const char kInstallArchive[];
    161 extern const char kInstallerData[];
    162 extern const char kLogFile[];
    163 extern const char kMakeChromeDefault[];
    164 extern const char kMsi[];
    165 extern const char kMultiInstall[];
    166 extern const char kNewSetupExe[];
    167 extern const char kOnOsUpgrade[];
    168 extern const char kQueryEULAAcceptance[];
    169 extern const char kRegisterChromeBrowser[];
    170 extern const char kRegisterChromeBrowserSuffix[];
    171 extern const char kRegisterDevChrome[];
    172 extern const char kRegisterURLProtocol[];
    173 extern const char kRenameChromeExe[];
    174 extern const char kRemoveChromeRegistration[];
    175 extern const char kRunAsAdmin[];
    176 extern const char kSelfDestruct[];
    177 extern const char kSystemLevel[];
    178 extern const char kUninstall[];
    179 extern const char kUpdateSetupExe[];
    180 extern const char kUncompressedArchive[];
    181 extern const char kVerboseLogging[];
    182 extern const char kShowEula[];
    183 extern const char kShowEulaForMetro[];
    184 extern const char kInactiveUserToast[];
    185 extern const char kSystemLevelToast[];
    186 extern const char kExperimentGroup[];
    187 extern const char kToastResultsKey[];
    188 extern const char kPatch[];
    189 extern const char kInputFile[];
    190 extern const char kPatchFile[];
    191 extern const char kOutputFile[];
    192 
    193 }  // namespace switches
    194 
    195 extern const wchar_t kActiveSetupExe[];
    196 extern const wchar_t kChromeAppHostExe[];
    197 extern const wchar_t kChromeDll[];
    198 extern const wchar_t kChromeChildDll[];
    199 extern const wchar_t kChromeExe[];
    200 extern const wchar_t kChromeFrameDll[];
    201 extern const wchar_t kChromeFrameHelperDll[];
    202 extern const wchar_t kChromeFrameHelperExe[];
    203 extern const wchar_t kChromeFrameHelperWndClass[];
    204 extern const wchar_t kChromeLauncherExe[];
    205 extern const wchar_t kChromeOldExe[];
    206 extern const wchar_t kChromeNewExe[];
    207 extern const wchar_t kCmdInstallApp[];
    208 extern const wchar_t kCmdInstallExtension[];
    209 extern const wchar_t kCmdOnOsUpgrade[];
    210 extern const wchar_t kCmdQueryEULAAcceptance[];
    211 extern const wchar_t kCmdQuickEnableApplicationHost[];
    212 extern const wchar_t kCmdQuickEnableCf[];
    213 extern const wchar_t kDelegateExecuteExe[];
    214 extern const wchar_t kEULASentinelFile[];
    215 extern const wchar_t kGoogleChromeInstallSubDir1[];
    216 extern const wchar_t kGoogleChromeInstallSubDir2[];
    217 extern const wchar_t kInstallBinaryDir[];
    218 extern const wchar_t kInstallerDir[];
    219 extern const wchar_t kInstallTempDir[];
    220 extern const wchar_t kInstallUserDataDir[];
    221 extern const wchar_t kLnkExt[];
    222 extern const wchar_t kNaClExe[];
    223 extern const wchar_t kSetupExe[];
    224 extern const wchar_t kSxSSuffix[];
    225 extern const wchar_t kUninstallArgumentsField[];
    226 extern const wchar_t kUninstallDisplayNameField[];
    227 extern const wchar_t kUninstallInstallationDate[];
    228 extern const char kUninstallMetricsName[];
    229 extern const wchar_t kUninstallStringField[];
    230 
    231 // Google Update installer result API
    232 extern const wchar_t kInstallerError[];
    233 extern const wchar_t kInstallerExtraCode1[];
    234 extern const wchar_t kInstallerResult[];
    235 extern const wchar_t kInstallerResultUIString[];
    236 extern const wchar_t kInstallerSuccessLaunchCmdLine[];
    237 
    238 // Product options.
    239 extern const wchar_t kOptionMultiInstall[];
    240 
    241 // Chrome channel display names.
    242 // NOTE: Canary is not strictly a 'channel', but rather a separate product
    243 //     installed side-by-side. However, GoogleUpdateSettings::GetChromeChannel
    244 //     will return "canary" for that product.
    245 extern const wchar_t kChromeChannelUnknown[];
    246 extern const wchar_t kChromeChannelCanary[];
    247 extern const wchar_t kChromeChannelDev[];
    248 extern const wchar_t kChromeChannelBeta[];
    249 extern const wchar_t kChromeChannelStable[];
    250 
    251 extern const size_t kMaxAppModelIdLength;
    252 
    253 // The range of error values for the installer, Courgette, and bsdiff is
    254 // overlapping. These offset values disambiguate between different sets
    255 // of errors by shifting the values up with the specified offset.
    256 const int kCourgetteErrorOffset = 300;
    257 const int kBsdiffErrorOffset = 600;
    258 
    259 // Arguments to --patch switch
    260 extern const char kCourgette[];
    261 extern const char kBsdiff[];
    262 
    263 }  // namespace installer
    264 
    265 #endif  // CHROME_INSTALLER_UTIL_UTIL_CONSTANTS_H_
    266