Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5462)

Unified Diff: chrome/installer/setup/install.cc

Issue 1914213002: Support rollback with installerdata in mini_installer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cr Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/installer/setup/setup_main.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/setup/install.cc
diff --git a/chrome/installer/setup/install.cc b/chrome/installer/setup/install.cc
index fa288164c4e7f1f41909eda97527830f96ab2b52..af9662322892c2eaff4361005cd3f522f3cc7383 100644
--- a/chrome/installer/setup/install.cc
+++ b/chrome/installer/setup/install.cc
@@ -184,7 +184,8 @@ installer::InstallStatus InstallNewVersion(
const base::FilePath& src_path,
const base::FilePath& temp_path,
const Version& new_version,
- std::unique_ptr<Version>* current_version) {
+ std::unique_ptr<Version>* current_version,
+ bool is_downgrade_allowed) {
DCHECK(current_version);
installer_state.UpdateStage(installer::BUILDING);
@@ -236,8 +237,9 @@ installer::InstallStatus InstallNewVersion(
return installer::INSTALL_REPAIRED;
}
+ bool new_chrome_exe_exists = base::PathExists(new_chrome_exe);
if (new_version > **current_version) {
- if (base::PathExists(new_chrome_exe)) {
+ if (new_chrome_exe_exists) {
VLOG(1) << "Version updated to " << new_version
<< " while running " << **current_version;
return installer::IN_USE_UPDATED;
@@ -246,6 +248,16 @@ installer::InstallStatus InstallNewVersion(
return installer::NEW_VERSION_UPDATED;
}
+ if (is_downgrade_allowed) {
+ if (new_chrome_exe_exists) {
+ VLOG(1) << "Version downgrades to " << new_version << " while running "
+ << **current_version;
+ return installer::IN_USE_DOWNGRADE;
+ }
+ VLOG(1) << "Version downgrades to " << new_version;
+ return installer::OLD_VERSION_DOWNGRADE;
+ }
+
LOG(ERROR) << "Not sure how we got here while updating"
<< ", new version: " << new_version
<< ", old version: " << **current_version;
@@ -582,9 +594,10 @@ InstallStatus InstallOrUpdateProduct(
CreateVisualElementsManifest(src_path, new_version);
std::unique_ptr<Version> existing_version;
- InstallStatus result = InstallNewVersion(original_state, installer_state,
- setup_path, archive_path, src_path, install_temp_path, new_version,
- &existing_version);
+ InstallStatus result =
+ InstallNewVersion(original_state, installer_state, setup_path,
+ archive_path, src_path, install_temp_path, new_version,
+ &existing_version, IsDowngradeAllowed(prefs));
// TODO(robertshield): Everything below this line should instead be captured
// by WorkItems.
@@ -646,8 +659,8 @@ InstallStatus InstallOrUpdateProduct(
// force it here because the master_preferences file will not get copied
// into the build.
bool force_chrome_default_for_user = false;
- if (result == NEW_VERSION_UPDATED ||
- result == INSTALL_REPAIRED) {
+ if (result == NEW_VERSION_UPDATED || result == INSTALL_REPAIRED ||
+ result == OLD_VERSION_DOWNGRADE || result == IN_USE_DOWNGRADE) {
prefs.GetBool(master_preferences::kMakeChromeDefaultForUser,
&force_chrome_default_for_user);
}
« no previous file with comments | « no previous file | chrome/installer/setup/setup_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698