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

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 997b8342c8cf71e3ce0fd163d6ca3c9a1f5c2e01..cc66b7255671e3f4617e84154cf4e5bdcf4dc17b 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"
@@ -50,6 +51,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"
@@ -318,11 +320,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) {
@@ -382,6 +384,14 @@ installer::InstallStatus RenameChromeExecutables(
KEY_WOW64_32KEY,
google_update::kRegRenameCmdField);
}
+
+ // Delete old versions.
+ // TODO(fdoray): Launch a cleanup process when this fails. crbug.com/451546
+ install_list
+ ->AddCallbackWorkItem(base::Bind(&DeleteOldVersionsCallback,
+ installer_state->target_path()))
+ ->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