diff options
author | cpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-05 01:44:52 +0000 |
---|---|---|
committer | cpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-05 01:44:52 +0000 |
commit | be974f0b77ba65b8b5cad47a7494ef141dcafbb1 (patch) | |
tree | 3417e6774fc374899974a3f2b552ecc525981185 /chrome/installer/setup | |
parent | 7c2a99cf6d513e227e53c6310522e6afee8966f2 (diff) | |
download | chromium_src-be974f0b77ba65b8b5cad47a7494ef141dcafbb1.zip chromium_src-be974f0b77ba65b8b5cad47a7494ef141dcafbb1.tar.gz chromium_src-be974f0b77ba65b8b5cad47a7494ef141dcafbb1.tar.bz2 |
Overinstall mismatch, Launch the existing chrome instead
- If the user has a system-level chrome and it is trying to install user level, instead of having omaha show an error, the existing system level install is launched with --first-run
- Disable toast experiment
BUG=37410
TEST=see bug
Review URL: http://codereview.chromium.org/668114
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40701 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/setup')
-rw-r--r-- | chrome/installer/setup/setup_main.cc | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc index d0502ba..4c9e6c9 100644 --- a/chrome/installer/setup/setup_main.cc +++ b/chrome/installer/setup/setup_main.cc @@ -17,6 +17,7 @@ #include "base/scoped_handle_win.h" #include "base/string_util.h" #include "base/win_util.h" +#include "chrome/common/chrome_switches.h" #include "chrome/installer/setup/install.h" #include "chrome/installer/setup/setup_constants.h" #include "chrome/installer/setup/setup_util.h" @@ -151,12 +152,37 @@ installer_util::InstallStatus RenameChromeExecutables(bool system_install) { bool CheckPreInstallConditions(const installer::Version* installed_version, bool system_install, installer_util::InstallStatus& status) { + bool is_first_install = (NULL == installed_version); // 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."; + if (!system_install && is_first_install) { + // This is user-level install and there is a system-level chrome + // installation. Instruct omaha to launch the existing one. There + // should be no error dialog. + std::wstring chrome_exe(installer::GetChromeInstallPath(!system_install)); + if (chrome_exe.empty()) { + // If we failed to construct install path. Give up. + status = installer_util::OS_ERROR; + InstallUtil::WriteInstallerResult(system_install, status, + IDS_INSTALL_OS_ERROR_BASE, NULL); + return false; + } else { + status = installer_util::EXISTING_VERSION_LAUNCHED; + file_util::AppendToPath(&chrome_exe, installer_util::kChromeExe); + chrome_exe = L"\"" + chrome_exe + L"\" --" + + ASCIIToWide(switches::kFirstRun); + InstallUtil::WriteInstallerResult(system_install, status, + 0, &chrome_exe); + LOG(INFO) << "Launching existing system-level chrome instead."; + return false; + } + } + // This is an update, not an install. Omaha should know the difference + // and not show a dialog. status = system_install ? installer_util::USER_LEVEL_INSTALL_EXISTS : installer_util::SYSTEM_LEVEL_INSTALL_EXISTS; int str_id = system_install ? IDS_INSTALL_USER_LEVEL_EXISTS_BASE : @@ -164,11 +190,10 @@ bool CheckPreInstallConditions(const installer::Version* installed_version, InstallUtil::WriteInstallerResult(system_install, status, str_id, NULL); return false; } - // If no previous installation of Chrome, make sure installation directory // either does not exist or can be deleted (i.e. is not locked by some other // process). - if (!installed_version) { + if (is_first_install) { FilePath install_path = FilePath::FromWStringHack( installer::GetChromeInstallPath(system_install)); if (file_util::PathExists(install_path) && |