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 70832b641e8244870b3d7785a7b632ca9a23f607..5cfc45662638018bddd2108dc7c5aee431a38b05 100644 |
| --- a/chrome/installer/setup/setup_main.cc |
| +++ b/chrome/installer/setup/setup_main.cc |
| @@ -484,30 +484,19 @@ bool CheckMultiInstallConditions(const InstallationState& original_state, |
| } |
| // Checks app host pre-install conditions, specifically that this is a |
| -// user-level multi-install. When the pre-install conditions are not |
| -// satisfied, the result is written to the registry (via WriteInstallerResult), |
| -// |status| is set appropriately, and false is returned. |
| -bool CheckAppHostPreconditions(const InstallationState& original_state, |
| - InstallerState* installer_state, |
| - installer::InstallStatus* status) { |
| - if (installer_state->FindProduct(BrowserDistribution::CHROME_APP_HOST)) { |
| - |
| - if (!installer_state->is_multi_install()) { |
| - LOG(DFATAL) << "App Launcher requires multi install"; |
| - *status = installer::APP_HOST_REQUIRES_MULTI_INSTALL; |
| - // No message string since there is nothing a user can do. |
| - installer_state->WriteInstallerResult(*status, 0, NULL); |
| - return false; |
| - } |
| - |
| - if (installer_state->system_install()) { |
| - LOG(DFATAL) << "App Launcher may only be installed at user-level."; |
| - *status = installer::APP_HOST_REQUIRES_USER_LEVEL; |
| - // No message string since there is nothing a user can do. |
| - installer_state->WriteInstallerResult(*status, 0, NULL); |
| - return false; |
| - } |
| - |
| +// multi-install. When the pre-install conditions are not satisfied, the result |
| +// is written to the registry (via WriteInstallerResult), |status| is set |
| +// appropriately, and false is returned. |
| +bool CheckAppLauncherPreconditions(const InstallationState& original_state, |
| + InstallerState* installer_state, |
| + installer::InstallStatus* status) { |
| + if (installer_state->FindProduct(BrowserDistribution::CHROME_APP_HOST) && |
| + !installer_state->is_multi_install()) { |
| + LOG(DFATAL) << "App Launcher requires multi install"; |
| + *status = installer::APP_HOST_REQUIRES_MULTI_INSTALL; |
| + // No message string since there is nothing a user can do. |
| + installer_state->WriteInstallerResult(*status, 0, NULL); |
| + return false; |
| } |
| return true; |
| @@ -525,7 +514,7 @@ bool CheckAppHostPreconditions(const InstallationState& original_state, |
| bool CheckPreInstallConditions(const InstallationState& original_state, |
| InstallerState* installer_state, |
| installer::InstallStatus* status) { |
| - if (!CheckAppHostPreconditions(original_state, installer_state, status)) { |
| + if (!CheckAppLauncherPreconditions(original_state, installer_state, status)) { |
| DCHECK_NE(*status, installer::UNKNOWN_STATUS); |
| return false; |
| } |
| @@ -573,6 +562,26 @@ bool CheckPreInstallConditions(const InstallationState& original_state, |
| if (user_level_product_state) |
| continue; |
| + if (system_level_product_state && |
| + installer_state->need_to_migrate_legacy_app_launcher()) { |
| + // This is called if we we have (old) user app_host.exe coexisting with |
| + // (new) system-level Chrome, and then the app_host.exe is executed. |
| + // app_host.exe detects system-level Chrome, and calls new setup.exe |
| + // with --app-launcher (and arrive to this point). We now call the old |
| + // setup.exe to uninstall the old stuff. |
| + CommandLine uninstall_cmd(InstallUtil::GetChromeUninstallCmd( |
| + false, BrowserDistribution::CHROME_APP_HOST)); |
| + if (!uninstall_cmd.GetProgram().empty()) { |
| + uninstall_cmd.AppendSwitch(installer::switches::kSelfDestruct); |
| + uninstall_cmd.AppendSwitch(installer::switches::kForceUninstall); |
| + uninstall_cmd.AppendSwitch( |
| + installer::switches::kDoNotRemoveSharedItems); |
| + base::LaunchProcess(uninstall_cmd, base::LaunchOptions(), NULL); |
| + } |
| + *status = installer::APP_HOST_SELF_DESTRUCT; |
| + return false; |
| + } |
|
huangs
2013/06/04 13:50:31
TODO: Add comment to state that google_update::Uni
|
| + |
| // This is a new user-level install... |
| if (system_level_product_state) { |