summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/app/chromium_strings.grd3
-rw-r--r--chrome/app/google_chrome_strings.grd3
-rw-r--r--chrome/installer/setup/main.cc58
-rwxr-xr-xchrome/installer/util/prebuild/create_string_rc.py1
-rw-r--r--chrome/installer/util/util_constants.h3
5 files changed, 51 insertions, 17 deletions
diff --git a/chrome/app/chromium_strings.grd b/chrome/app/chromium_strings.grd
index 07e4230..c175c97 100644
--- a/chrome/app/chromium_strings.grd
+++ b/chrome/app/chromium_strings.grd
@@ -257,6 +257,9 @@ be available for now. -->
<message name="IDS_UNINSTALL_FAILED" desc="Error during uninstall if we can not find the installation directory from registry.">
Chromium is not installed or it failed to find installation directory. Please download Chromium again.
</message>
+ <message name="IDS_INSTALL_DIR_IN_USE" desc="Error during install if Chromium version is missing from registry but the installation directory exists and can not be deleted.">
+ Chromium installation directory seems to be in use. Please reboot your computer and try again.
+ </message>
<!-- Options Dialog -->
<message name="IDS_OPTIONS_DISABLE_SERVICES" desc="The text in the options panel that describes how we use web services to improve browsing experience.">
Chromium may use web services to improve your browsing experience - you may optionally disable these services.
diff --git a/chrome/app/google_chrome_strings.grd b/chrome/app/google_chrome_strings.grd
index 747c303..ac0127b 100644
--- a/chrome/app/google_chrome_strings.grd
+++ b/chrome/app/google_chrome_strings.grd
@@ -305,6 +305,9 @@ Chrome supports. -->
<message name="IDS_UNINSTALL_FAILED" desc="Error during uninstall if we can not find the installation directory from registry.">
Google Chrome is not installed or it failed to find installation directory. Please download Google Chrome again.
</message>
+ <message name="IDS_INSTALL_DIR_IN_USE" desc="Error during install if Google Chrome version is missing from registry but the installation directory exists and can not be deleted.">
+ Google Chrome installation directory seems to be in use. Please reboot your computer and try again.
+ </message>
<!-- Options Dialog -->
<message name="IDS_OPTIONS_DISABLE_SERVICES" desc="The text in the options panel that describes how we use web services to improve browsing experience.">
Google Chrome may use web services to improve your browsing experience - you may optionally disable these services.
diff --git a/chrome/installer/setup/main.cc b/chrome/installer/setup/main.cc
index 0fe810e..672b1a1 100644
--- a/chrome/installer/setup/main.cc
+++ b/chrome/installer/setup/main.cc
@@ -304,8 +304,50 @@ void UpdateChromeOpenCmd(bool system_install) {
ReplaceRegistryValue(reg_key[i], old_open_cmd, new_open_cmd);
}
+bool CheckPreInstallConditions(const installer::Version* installed_version,
+ int options,
+ installer_util::InstallStatus& status) {
+ bool system_install = (options & installer_util::SYSTEM_LEVEL) != 0;
+
+ // 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.";
+ 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 :
+ IDS_INSTALL_SYSTEM_LEVEL_EXISTS_BASE;
+ 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) {
+ std::wstring install_path(installer::GetChromeInstallPath(system_install));
+ if (file_util::PathExists(install_path) &&
+ !file_util::Delete(install_path, true)) {
+ LOG(ERROR) << "Installation directory " << install_path
+ << " exists and can not be deleted.";
+ status = installer_util::INSTALL_DIR_IN_USE;
+ int str_id = IDS_INSTALL_DIR_IN_USE_BASE;
+ InstallUtil::WriteInstallerResult(system_install, status, str_id, NULL);
+ return false;
+ }
+ }
+
+ return true;
+}
+
installer_util::InstallStatus InstallChrome(const CommandLine& cmd_line,
const installer::Version* installed_version, int options) {
+ installer_util::InstallStatus install_status = installer_util::UNKNOWN_STATUS;
+ if (!CheckPreInstallConditions(installed_version, options, install_status))
+ return install_status;
+
bool system_install = (options & installer_util::SYSTEM_LEVEL) != 0;
// For install the default location for chrome.packed.7z is in current
// folder, so get that value first.
@@ -337,7 +379,6 @@ installer_util::InstallStatus InstallChrome(const CommandLine& cmd_line,
file_util::AppendToPath(&unpack_path,
std::wstring(installer::kInstallSourceDir));
bool incremental_install = false;
- installer_util::InstallStatus install_status = installer_util::UNKNOWN_STATUS;
if (UnPackArchive(archive, system_install, installed_version,
temp_path, unpack_path, incremental_install)) {
install_status = installer_util::UNCOMPRESSION_FAILED;
@@ -560,21 +601,6 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance,
system_install);
// If --uninstall option is not specified, we assume it is install case.
} else {
- // 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.";
- installer_util::InstallStatus 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 :
- IDS_INSTALL_SYSTEM_LEVEL_EXISTS_BASE;
- InstallUtil::WriteInstallerResult(system_install, status, str_id, NULL);
- return status;
- }
-
install_status = InstallChrome(parsed_command_line,
installed_version.get(),
options);
diff --git a/chrome/installer/util/prebuild/create_string_rc.py b/chrome/installer/util/prebuild/create_string_rc.py
index 59ef430..bb4e5a0 100755
--- a/chrome/installer/util/prebuild/create_string_rc.py
+++ b/chrome/installer/util/prebuild/create_string_rc.py
@@ -50,6 +50,7 @@ kStringIds = [
'IDS_INSTALL_INVALID_ARCHIVE',
'IDS_INSTALL_INSUFFICIENT_RIGHTS',
'IDS_UNINSTALL_FAILED',
+ 'IDS_INSTALL_DIR_IN_USE',
]
# The ID of the first resource string.
diff --git a/chrome/installer/util/util_constants.h b/chrome/installer/util/util_constants.h
index aa2b27f..049fdac 100644
--- a/chrome/installer/util/util_constants.h
+++ b/chrome/installer/util/util_constants.h
@@ -36,7 +36,8 @@ enum InstallStatus {
RENAME_FAILED, // Rename of new_chrome.exe failed
EULA_REJECTED, // EULA dialog was not accepted by user.
EULA_ACCEPTED, // EULA dialog was accepted by user.
- EULA_ACCEPTED_OPT_IN // EULA accepted wtih the crash optin selected.
+ EULA_ACCEPTED_OPT_IN, // EULA accepted wtih the crash optin selected.
+ INSTALL_DIR_IN_USE // Installation directory is in use by another process
};
// These are distibution related install options specified through command