Index: chrome/installer/setup/setup_main.cc |
diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc |
index 4d0c8450342d72ead97cbf93d5d38750ac68f514..6466500e26598621e2e3576e5f8320304d4a7ec8 100644 |
--- a/chrome/installer/setup/setup_main.cc |
+++ b/chrome/installer/setup/setup_main.cc |
@@ -834,6 +834,36 @@ installer::InstallStatus UninstallProduct( |
cmd_line.GetProgram(), product, remove_all, force_uninstall, cmd_line); |
} |
+// Tell Google Update that an uninstall has taken place. This gives it a chance |
+// to uninstall itself straight away if no more products are installed on the |
+// system rather than waiting for the next time the scheduled task runs. |
+// Success or failure of Google Update has no bearing on the success or failure |
+// of Chrome's uninstallation. |
+void UninstallGoogleUpdate(bool system_install) { |
+ string16 uninstall_cmd( |
+ GoogleUpdateSettings::GetUninstallCommandLine(system_install)); |
+ if (!uninstall_cmd.empty()) { |
+ base::ProcessHandle process = base::kNullProcessHandle; |
+ base::LaunchOptions launch_options; |
+ launch_options.wait = true; |
+ LOG(INFO) << "Launching Google Update's uninstaller: " << uninstall_cmd; |
+ if (base::LaunchProcess(uninstall_cmd, launch_options, &process)) { |
erikwright (departed)
2012/03/13 20:55:20
Can you use ScopedHandle::Receive instead of an in
grt (UTC plus 2)
2012/03/14 13:47:02
Awesome, thanks for the pointer (Receive() didn't
|
+ base::win::ScopedHandle process_handle(process); |
+ int exit_code = 0; |
+ if (base::GetTerminationStatus(process, &exit_code) == |
+ base::TERMINATION_STATUS_NORMAL_TERMINATION) { |
+ LOG(INFO) << " normal exit."; |
+ } else { |
+ LOG(ERROR) << "Google Update uninstaller (" << uninstall_cmd |
+ << ") exited with code " << exit_code << "."; |
+ } |
+ } else { |
+ PLOG(ERROR) << "Failed to launch Google Update's uninstaller (" |
+ << uninstall_cmd << ")"; |
+ } |
+ } |
+} |
+ |
installer::InstallStatus UninstallProducts( |
const InstallationState& original_state, |
const InstallerState& installer_state, |
@@ -860,6 +890,8 @@ installer::InstallStatus UninstallProducts( |
install_status = prod_status; |
} |
+ UninstallGoogleUpdate(installer_state.system_install()); |
+ |
return install_status; |
} |