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

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

Issue 1666363002: Delete old files after an update. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: self-review Created 4 years, 10 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
Index: chrome/installer/setup/setup_main.cc
diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc
index 06f69cac43e49251ff5749625eeadf5e12b883f6..f043835401498663b05728a0072e8b9e7d87beb4 100644
--- a/chrome/installer/setup/setup_main.cc
+++ b/chrome/installer/setup/setup_main.cc
@@ -14,6 +14,7 @@
#include <string>
#include "base/at_exit.h"
+#include "base/bind.h"
#include "base/command_line.h"
#include "base/file_version_info.h"
#include "base/files/file_path.h"
@@ -51,6 +52,7 @@
#include "chrome/installer/setup/uninstall.h"
#include "chrome/installer/util/browser_distribution.h"
#include "chrome/installer/util/delete_after_reboot_helper.h"
+#include "chrome/installer/util/delete_old_versions.h"
#include "chrome/installer/util/delete_tree_work_item.h"
#include "chrome/installer/util/google_update_constants.h"
#include "chrome/installer/util/google_update_settings.h"
@@ -323,11 +325,11 @@ void AddExistingMultiInstalls(const InstallationState& original_state,
// This function is called when --rename-chrome-exe option is specified on
// setup.exe command line. This function assumes an in-use update has happened
-// for Chrome so there should be a file called new_chrome.exe on the file
-// system and a key called 'opv' in the registry. This function will move
+// for Chrome so there should be a file called new_chrome.exe on the file system
+// and a key called 'opv' in the registry. This function will move
// new_chrome.exe to chrome.exe and delete 'opv' key in one atomic operation.
-// This function also deletes elevation policies associated with the old version
-// if they exist.
+// This function also takes care of deleting files and elevation policies that
+// belong to old versions of Chrome.
installer::InstallStatus RenameChromeExecutables(
const InstallationState& original_state,
InstallerState* installer_state) {
@@ -387,6 +389,12 @@ installer::InstallStatus RenameChromeExecutables(
KEY_WOW64_32KEY,
google_update::kRegRenameCmdField);
}
+
+ // Delete old versions.
+ // TODO(fdoray): Launch a cleanup process when this fails. crbug.com/451546
+ AddDeleteOldVersionsWorkItem(*installer_state, install_list.get())
+ ->set_ignore_failure(true);
+
installer::InstallStatus ret = installer::RENAME_SUCCESSFUL;
if (!install_list->Do()) {
LOG(ERROR) << "Renaming of executables failed. Rolling back any changes.";

Powered by Google App Engine
This is Rietveld 408576698