diff options
-rw-r--r-- | chrome/installer/setup/main.cc | 10 | ||||
-rw-r--r-- | chrome/installer/util/util_constants.h | 2 |
2 files changed, 12 insertions, 0 deletions
diff --git a/chrome/installer/setup/main.cc b/chrome/installer/setup/main.cc index f9bf767..d9b4bc6 100644 --- a/chrome/installer/setup/main.cc +++ b/chrome/installer/setup/main.cc @@ -293,6 +293,16 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance, parsed_command_line.HasSwitch(installer_util::switches::kSystemInstall); LOG(INFO) << "system install is " << system_install; + // Check to avoid simultaneous per-user and per-machine installs. + scoped_ptr<installer::Version> + chrome_version(InstallUtil::GetChromeVersion(!system_install)); + if (chrome_version.get()) { + LOG(ERROR) << "Already installed version " << chrome_version->GetString() + << " conflicts with the current install mode."; + return system_install ? installer_util::USER_LEVEL_INSTALL_EXISTS : + installer_util::MACHINE_LEVEL_INSTALL_EXISTS; + } + // Check the existing version installed. scoped_ptr<installer::Version> installed_version(InstallUtil::GetChromeVersion(system_install)); diff --git a/chrome/installer/util/util_constants.h b/chrome/installer/util/util_constants.h index 9969fe2..e115787 100644 --- a/chrome/installer/util/util_constants.h +++ b/chrome/installer/util/util_constants.h @@ -16,6 +16,8 @@ enum InstallStatus { INSTALL_REPAIRED, // Same version reinstalled for repair NEW_VERSION_UPDATED, // Chrome successfully updated to new version HIGHER_VERSION_EXISTS, // Higher version of Chrome already exists + USER_LEVEL_INSTALL_EXISTS, // User level install already exists + MACHINE_LEVEL_INSTALL_EXISTS, // Machine level install already exists INSTALL_FAILED, // Install/update failed OS_NOT_SUPPORTED, // Current OS not supported OS_ERROR, // OS API call failed |