Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2786)

Unified Diff: chrome/installer/setup/setup_main.cc

Issue 9693055: Launch Google Update on uninstall. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed comments Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/installer/util/google_update_constants.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « no previous file | chrome/installer/util/google_update_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698