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

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

Issue 1666363002: Delete old files after an update. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/install_worker.cc
diff --git a/chrome/installer/setup/install_worker.cc b/chrome/installer/setup/install_worker.cc
index 5878c00439e338b422250972c0fa50ccb7bf8aa1..4a6b610596d04f63dd9e18cbe2dd44c1dbad9242 100644
--- a/chrome/installer/setup/install_worker.cc
+++ b/chrome/installer/setup/install_worker.cc
@@ -40,6 +40,7 @@
#include "chrome/installer/util/callback_work_item.h"
#include "chrome/installer/util/conditional_work_item_list.h"
#include "chrome/installer/util/create_reg_key_work_item.h"
+#include "chrome/installer/util/delete_old_versions.h"
#include "chrome/installer/util/firewall_manager_win.h"
#include "chrome/installer/util/google_update_constants.h"
#include "chrome/installer/util/helper.h"
@@ -399,6 +400,19 @@ void AddCleanupDelegateExecuteWorkItems(const InstallerState& installer_state,
}
}
+bool DeleteOldVersionsCallback(const base::FilePath& install_dir,
+ const CallbackWorkItem& work_item) {
+ // No rollback is possible for this action.
+ if (work_item.IsRollback())
+ return true;
+
+ DeleteOldVersions(install_dir);
+
+ // TODO(fdoray): Launch a cleanup process if old files remain.
+ // crbug.com/451546
+ return true;
+}
+
} // namespace
// This method adds work items to create (or update) Chrome uninstall entry in
@@ -1003,6 +1017,10 @@ bool AppendPostInstallTasks(const InstallerState& installer_state,
version_key,
KEY_WOW64_32KEY,
google_update::kRegRenameCmdField);
+
+ // Delete old files.
+ regular_update_work_items->AddCallbackWorkItem(base::Bind(
+ &DeleteOldVersionsCallback, installer_state.target_path()));
fdoray 2016/02/05 22:56:41 Note to myself: I've just seen that InstallerStat
}
post_install_task_list->AddWorkItem(regular_update_work_items.release());

Powered by Google App Engine
This is Rietveld 408576698