Chromium Code Reviews| Index: chrome/installer/setup/install.cc |
| diff --git a/chrome/installer/setup/install.cc b/chrome/installer/setup/install.cc |
| index 588550c6a3e31f03b55764a8ba2db6a962ff5409..ce8ddcf519644e3c1d8552099ca392f58d922a8e 100644 |
| --- a/chrome/installer/setup/install.cc |
| +++ b/chrome/installer/setup/install.cc |
| @@ -11,11 +11,13 @@ |
| #include <memory> |
| #include <string> |
| +#include "base/command_line.h" |
| #include "base/files/file_enumerator.h" |
| #include "base/files/file_path.h" |
| #include "base/files/file_util.h" |
| #include "base/logging.h" |
| #include "base/numerics/safe_conversions.h" |
| +#include "base/process/launch.h" |
| #include "base/strings/string_util.h" |
| #include "base/strings/stringprintf.h" |
| #include "base/strings/utf_string_conversions.h" |
| @@ -680,15 +682,33 @@ InstallStatus InstallOrUpdateProduct( |
| } |
| } |
| + // Delete files that belong to old versions of Chrome. If that fails during |
| + // a not-in-use update, launch a --delete-old-version process. If this is an |
| + // in-use update, a --delete-old-versions process will be launched when |
| + // executables are renamed. |
| installer_state.SetStage(REMOVING_OLD_VERSIONS); |
| - // TODO(fdoray): Launch a cleanup process when this fails during a not-in- |
| - // use update. crbug.com/451546 |
| - DeleteOldVersions(installer_state.target_path()); |
| + if (!DeleteOldVersions(installer_state.target_path()) && |
| + !base::PathExists( |
|
grt (UTC plus 2)
2016/09/13 08:10:40
rather than checking for new_chrome.exe again, you
fdoray
2016/09/13 21:34:54
Done.
|
| + installer_state.target_path().Append(installer::kChromeNewExe))) { |
| + LaunchDeleteOldVersionsProcess(installer_state); |
| + } |
| } |
| return result; |
| } |
| +void LaunchDeleteOldVersionsProcess(const InstallerState& installer_state) { |
| + base::LaunchOptions launch_options; |
| + launch_options.start_hidden = true; |
|
grt (UTC plus 2)
2016/09/13 08:10:40
i think it's prudent to use:
launch_options.forc
fdoray
2016/09/13 21:34:54
Done.
|
| + // Make sure not to launch from a version directory. Otherwise, it won't be |
| + // possible to delete it. |
| + launch_options.current_directory = installer_state.target_path(); |
| + base::CommandLine command_line(base::MakeAbsoluteFilePath( |
| + base::CommandLine::ForCurrentProcess()->GetProgram())); |
|
grt (UTC plus 2)
2016/09/13 08:10:40
the currently running setup.exe during an update i
fdoray
2016/09/13 21:34:54
Done.
|
| + command_line.AppendSwitch(switches::kDeleteOldVersions); |
|
grt (UTC plus 2)
2016/09/13 08:10:40
we generally try to use the command-line args that
fdoray
2016/09/13 21:34:54
Done.
|
| + base::LaunchProcess(command_line, launch_options); |
|
grt (UTC plus 2)
2016/09/13 08:10:40
logging around this would be useful. maybe:
VLOG
fdoray
2016/09/13 21:34:54
Done.
|
| +} |
| + |
| void HandleOsUpgradeForBrowser(const installer::InstallerState& installer_state, |
| const installer::Product& chrome, |
| const base::Version& installed_version) { |