Chromium Code Reviews| Index: chrome/installer/setup/setup_main.cc |
| diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc |
| index 7860d34cf4ff0dd1a0685d5849c7ea50597d6114..c058a039c26f99a823cc679a3fe963e1e7dbb525 100644 |
| --- a/chrome/installer/setup/setup_main.cc |
| +++ b/chrome/installer/setup/setup_main.cc |
| @@ -51,6 +51,7 @@ |
| #include "chrome/installer/setup/installer_crash_reporting.h" |
| #include "chrome/installer/setup/installer_metrics.h" |
| #include "chrome/installer/setup/setup_constants.h" |
| +#include "chrome/installer/setup/setup_singleton.h" |
| #include "chrome/installer/setup/setup_util.h" |
| #include "chrome/installer/setup/uninstall.h" |
| #include "chrome/installer/util/browser_distribution.h" |
| @@ -1089,9 +1090,9 @@ installer::InstallStatus RegisterDevChrome( |
| // various tasks other than installation (renaming chrome.exe, showing eula |
| // among others). This function returns true if any such command line option |
| // has been found and processed (so setup.exe should exit at that point). |
| -bool HandleNonInstallCmdLineOptions(const InstallationState& original_state, |
| - const base::FilePath& setup_exe, |
| +bool HandleNonInstallCmdLineOptions(const base::FilePath& setup_exe, |
| const base::CommandLine& cmd_line, |
| + InstallationState* original_state, |
| InstallerState* installer_state, |
| int* exit_code) { |
| // This option is independent of all others so doesn't belong in the if/else |
| @@ -1158,7 +1159,7 @@ bool HandleNonInstallCmdLineOptions(const InstallationState& original_state, |
| if (installer::EULA_REJECTED != *exit_code) { |
| if (GoogleUpdateSettings::SetEULAConsent( |
| - original_state, BrowserDistribution::GetDistribution(), true)) { |
| + *original_state, BrowserDistribution::GetDistribution(), true)) { |
| CreateEULASentinel(BrowserDistribution::GetDistribution()); |
| } |
| // For a metro-originated launch, we now need to launch back into metro. |
| @@ -1185,7 +1186,7 @@ bool HandleNonInstallCmdLineOptions(const InstallationState& original_state, |
| *exit_code = InstallUtil::GetInstallReturnCode(status); |
| } else if (cmd_line.HasSwitch(installer::switches::kRegisterDevChrome)) { |
| installer::InstallStatus status = RegisterDevChrome( |
| - original_state, *installer_state, setup_exe, cmd_line); |
| + *original_state, *installer_state, setup_exe, cmd_line); |
| *exit_code = InstallUtil::GetInstallReturnCode(status); |
| } else if (cmd_line.HasSwitch(installer::switches::kRegisterChromeBrowser)) { |
| installer::InstallStatus status = installer::UNKNOWN_STATUS; |
| @@ -1238,7 +1239,14 @@ bool HandleNonInstallCmdLineOptions(const InstallationState& original_state, |
| } else if (cmd_line.HasSwitch(installer::switches::kRenameChromeExe)) { |
| // If --rename-chrome-exe is specified, we want to rename the executables |
| // and exit. |
| - *exit_code = RenameChromeExecutables(original_state, installer_state); |
| + std::unique_ptr<installer::SetupSingleton> setup_singleton( |
| + installer::SetupSingleton::Acquire( |
| + cmd_line, MasterPreferences::ForCurrentProcess(), installer_state, |
| + original_state)); |
| + if (setup_singleton) |
| + *exit_code = RenameChromeExecutables(*original_state, installer_state); |
| + else |
| + *exit_code = installer::SETUP_SINGLETON_ACQUISITION_FAILED; |
| } else if (cmd_line.HasSwitch( |
| installer::switches::kRemoveChromeRegistration)) { |
| // This is almost reverse of --register-chrome-browser option above. |
| @@ -1813,8 +1821,8 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance, |
| PathService::Get(base::FILE_EXE, &setup_exe); |
| int exit_code = 0; |
| - if (HandleNonInstallCmdLineOptions( |
| - original_state, setup_exe, cmd_line, &installer_state, &exit_code)) { |
| + if (HandleNonInstallCmdLineOptions(setup_exe, cmd_line, &original_state, |
| + &installer_state, &exit_code)) { |
| return exit_code; |
| } |
| @@ -1843,6 +1851,12 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance, |
| } |
| } |
| + std::unique_ptr<installer::SetupSingleton> setup_singleton( |
| + installer::SetupSingleton::Acquire(cmd_line, prefs, &installer_state, |
| + &original_state)); |
| + if (!setup_singleton) |
| + return installer::SETUP_SINGLETON_ACQUISITION_FAILED; |
|
grt (UTC plus 2)
2016/09/01 12:05:39
please use WriteInstallerResult as well so that th
fdoray
2016/09/01 15:45:22
Done.
When is the UI string shown? Users should s
grt (UTC plus 2)
2016/09/01 21:22:41
Google Update will show the string if the user is
fdoray
2016/09/06 17:29:39
Removed WriteInstallerResult for the --rename-chro
|
| + |
| UninstallMultiChromeFrameIfPresent(cmd_line, prefs, |
| &original_state, &installer_state); |