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..c99d3e6d52a37619b208225c532ece21198ada0b 100644 |
--- a/chrome/installer/setup/setup_main.cc |
+++ b/chrome/installer/setup/setup_main.cc |
@@ -68,6 +68,7 @@ using installer::MasterPreferences; |
const wchar_t kChromePipeName[] = L"\\\\.\\pipe\\ChromeCrashServices"; |
const wchar_t kGoogleUpdatePipeName[] = L"\\\\.\\pipe\\GoogleCrashServices\\"; |
const wchar_t kSystemPrincipalSid[] = L"S-1-5-18"; |
+const int kGoogleUpdateTimeoutMs = 20 * 1000; |
const MINIDUMP_TYPE kLargerDumpType = static_cast<MINIDUMP_TYPE>( |
MiniDumpWithProcessThreadData | // Get PEB and TEB. |
@@ -834,6 +835,41 @@ 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::win::ScopedHandle process; |
+ LOG(INFO) << "Launching Google Update's uninstaller: " << uninstall_cmd; |
+ if (base::LaunchProcess(uninstall_cmd, base::LaunchOptions(), |
+ process.Receive())) { |
+ int exit_code = 0; |
+ if (base::WaitForExitCodeWithTimeout(process, &exit_code, |
+ kGoogleUpdateTimeoutMs)) { |
+ if (exit_code == 0) { |
+ LOG(INFO) << " normal exit."; |
+ } else { |
+ LOG(ERROR) << "Google Update uninstaller (" << uninstall_cmd |
+ << ") exited with code " << exit_code << "."; |
+ } |
+ } else { |
+ // The process didn't finish in time, or GetExitCodeProcess failed. |
+ LOG(ERROR) << "Google Update uninstaller (" << uninstall_cmd |
+ << ") is taking more than " << kGoogleUpdateTimeoutMs |
+ << " milliseconds to complete."; |
+ } |
+ } else { |
+ PLOG(ERROR) << "Failed to launch Google Update uninstaller (" |
+ << uninstall_cmd << ")"; |
+ } |
+ } |
+} |
+ |
installer::InstallStatus UninstallProducts( |
const InstallationState& original_state, |
const InstallerState& installer_state, |
@@ -860,6 +896,8 @@ installer::InstallStatus UninstallProducts( |
install_status = prod_status; |
} |
+ UninstallGoogleUpdate(installer_state.system_install()); |
+ |
return install_status; |
} |