summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorcpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-05 01:44:52 +0000
committercpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-05 01:44:52 +0000
commitbe974f0b77ba65b8b5cad47a7494ef141dcafbb1 (patch)
tree3417e6774fc374899974a3f2b552ecc525981185 /chrome
parent7c2a99cf6d513e227e53c6310522e6afee8966f2 (diff)
downloadchromium_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')
-rw-r--r--chrome/installer/setup/setup_main.cc29
-rw-r--r--chrome/installer/util/browser_distribution.cc1
-rw-r--r--chrome/installer/util/google_chrome_distribution.cc3
-rw-r--r--chrome/installer/util/util_constants.h1
4 files changed, 31 insertions, 3 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) &&
diff --git a/chrome/installer/util/browser_distribution.cc b/chrome/installer/util/browser_distribution.cc
index afce15f..7eed257 100644
--- a/chrome/installer/util/browser_distribution.cc
+++ b/chrome/installer/util/browser_distribution.cc
@@ -95,6 +95,7 @@ int BrowserDistribution::GetInstallReturnCode(
case installer_util::FIRST_INSTALL_SUCCESS:
case installer_util::INSTALL_REPAIRED:
case installer_util::NEW_VERSION_UPDATED:
+ case installer_util::EXISTING_VERSION_LAUNCHED:
case installer_util::IN_USE_UPDATED:
return 0;
default:
diff --git a/chrome/installer/util/google_chrome_distribution.cc b/chrome/installer/util/google_chrome_distribution.cc
index 0b9c604..c977f5b 100644
--- a/chrome/installer/util/google_chrome_distribution.cc
+++ b/chrome/installer/util/google_chrome_distribution.cc
@@ -513,7 +513,8 @@ void GoogleChromeDistribution::LaunchUserExperiment(
// Check browser usage inactivity by the age of the last-write time of the
// chrome user data directory.
std::wstring user_data_dir = installer::GetChromeUserDataPath();
- const int kThirtyDays = 30 * 24;
+ // TODO(cpu): re-enable experiment.
+ const int kThirtyDays = 3000 * 24;
int dir_age_hours = GetDirectoryWriteAgeInHours(user_data_dir.c_str());
if (dir_age_hours < 0) {
// This means that we failed to find the user data dir. The most likey
diff --git a/chrome/installer/util/util_constants.h b/chrome/installer/util/util_constants.h
index 9714e84..0b4eb34 100644
--- a/chrome/installer/util/util_constants.h
+++ b/chrome/installer/util/util_constants.h
@@ -15,6 +15,7 @@ enum InstallStatus {
FIRST_INSTALL_SUCCESS, // Successfully installed Chrome for the first time
INSTALL_REPAIRED, // Same version reinstalled for repair
NEW_VERSION_UPDATED, // Chrome successfully updated to new version
+ EXISTING_VERSION_LAUNCHED, // No work done, just launched existing chrome
HIGHER_VERSION_EXISTS, // Higher version of Chrome already exists
USER_LEVEL_INSTALL_EXISTS, // User level install already exists
SYSTEM_LEVEL_INSTALL_EXISTS, // Machine level install already exists