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

Side by Side 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: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <windows.h> 5 #include <windows.h>
6 #include <msi.h> 6 #include <msi.h>
7 #include <shellapi.h> 7 #include <shellapi.h>
8 #include <shlobj.h> 8 #include <shlobj.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 } else if (!force_uninstall) { 827 } else if (!force_uninstall) {
828 LOG(ERROR) << product.distribution()->GetAppShortCutName() 828 LOG(ERROR) << product.distribution()->GetAppShortCutName()
829 << " not found for uninstall."; 829 << " not found for uninstall.";
830 return installer::CHROME_NOT_INSTALLED; 830 return installer::CHROME_NOT_INSTALLED;
831 } 831 }
832 832
833 return installer::UninstallProduct(original_state, installer_state, 833 return installer::UninstallProduct(original_state, installer_state,
834 cmd_line.GetProgram(), product, remove_all, force_uninstall, cmd_line); 834 cmd_line.GetProgram(), product, remove_all, force_uninstall, cmd_line);
835 } 835 }
836 836
837 // Tell Google Update that an uninstall has taken place. This gives it a chance
838 // to uninstall itself straight away if no more products are installed on the
839 // system rather than waiting for the next time the scheduled task runs.
840 // Success or failure of Google Update has no bearing on the success or failure
841 // of Chrome's uninstallation.
842 void UninstallGoogleUpdate(bool system_install) {
843 string16 uninstall_cmd(
844 GoogleUpdateSettings::GetUninstallCommandLine(system_install));
845 if (!uninstall_cmd.empty()) {
846 base::ProcessHandle process = base::kNullProcessHandle;
847 base::LaunchOptions launch_options;
848 launch_options.wait = true;
849 LOG(INFO) << "Launching Google Update's uninstaller: " << uninstall_cmd;
850 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
851 base::win::ScopedHandle process_handle(process);
852 int exit_code = 0;
853 if (base::GetTerminationStatus(process, &exit_code) ==
854 base::TERMINATION_STATUS_NORMAL_TERMINATION) {
855 LOG(INFO) << " normal exit.";
856 } else {
857 LOG(ERROR) << "Google Update uninstaller (" << uninstall_cmd
858 << ") exited with code " << exit_code << ".";
859 }
860 } else {
861 PLOG(ERROR) << "Failed to launch Google Update's uninstaller ("
862 << uninstall_cmd << ")";
863 }
864 }
865 }
866
837 installer::InstallStatus UninstallProducts( 867 installer::InstallStatus UninstallProducts(
838 const InstallationState& original_state, 868 const InstallationState& original_state,
839 const InstallerState& installer_state, 869 const InstallerState& installer_state,
840 const CommandLine& cmd_line) { 870 const CommandLine& cmd_line) {
841 const Products& products = installer_state.products(); 871 const Products& products = installer_state.products();
842 // InstallerState::Initialize always puts Chrome first, and we rely on that 872 // InstallerState::Initialize always puts Chrome first, and we rely on that
843 // here for this reason: if Chrome is in-use, the user will be prompted to 873 // here for this reason: if Chrome is in-use, the user will be prompted to
844 // confirm uninstallation. Upon cancel, we should not continue with the 874 // confirm uninstallation. Upon cancel, we should not continue with the
845 // other products. 875 // other products.
846 DCHECK(products.size() < 2 || products[0]->is_chrome()); 876 DCHECK(products.size() < 2 || products[0]->is_chrome());
847 installer::InstallStatus install_status = installer::UNINSTALL_SUCCESSFUL; 877 installer::InstallStatus install_status = installer::UNINSTALL_SUCCESSFUL;
848 installer::InstallStatus prod_status = installer::UNKNOWN_STATUS; 878 installer::InstallStatus prod_status = installer::UNKNOWN_STATUS;
849 const bool force = cmd_line.HasSwitch(installer::switches::kForceUninstall); 879 const bool force = cmd_line.HasSwitch(installer::switches::kForceUninstall);
850 const bool remove_all = !cmd_line.HasSwitch( 880 const bool remove_all = !cmd_line.HasSwitch(
851 installer::switches::kDoNotRemoveSharedItems); 881 installer::switches::kDoNotRemoveSharedItems);
852 882
853 for (size_t i = 0; 883 for (size_t i = 0;
854 install_status != installer::UNINSTALL_CANCELLED && 884 install_status != installer::UNINSTALL_CANCELLED &&
855 i < products.size(); 885 i < products.size();
856 ++i) { 886 ++i) {
857 prod_status = UninstallProduct(original_state, installer_state, 887 prod_status = UninstallProduct(original_state, installer_state,
858 cmd_line, remove_all, force, *products[i]); 888 cmd_line, remove_all, force, *products[i]);
859 if (prod_status != installer::UNINSTALL_SUCCESSFUL) 889 if (prod_status != installer::UNINSTALL_SUCCESSFUL)
860 install_status = prod_status; 890 install_status = prod_status;
861 } 891 }
862 892
893 UninstallGoogleUpdate(installer_state.system_install());
894
863 return install_status; 895 return install_status;
864 } 896 }
865 897
866 installer::InstallStatus ShowEULADialog(const std::wstring& inner_frame) { 898 installer::InstallStatus ShowEULADialog(const std::wstring& inner_frame) {
867 VLOG(1) << "About to show EULA"; 899 VLOG(1) << "About to show EULA";
868 std::wstring eula_path = installer::GetLocalizedEulaResource(); 900 std::wstring eula_path = installer::GetLocalizedEulaResource();
869 if (eula_path.empty()) { 901 if (eula_path.empty()) {
870 LOG(ERROR) << "No EULA path available"; 902 LOG(ERROR) << "No EULA path available";
871 return installer::EULA_REJECTED; 903 return installer::EULA_REJECTED;
872 } 904 }
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
1346 if (!(installer_state.is_msi() && is_uninstall)) 1378 if (!(installer_state.is_msi() && is_uninstall))
1347 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT 1379 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT
1348 // to pass through, since this is only returned on uninstall which is 1380 // to pass through, since this is only returned on uninstall which is
1349 // never invoked directly by Google Update. 1381 // never invoked directly by Google Update.
1350 return_code = InstallUtil::GetInstallReturnCode(install_status); 1382 return_code = InstallUtil::GetInstallReturnCode(install_status);
1351 1383
1352 VLOG(1) << "Installation complete, returning: " << return_code; 1384 VLOG(1) << "Installation complete, returning: " << return_code;
1353 1385
1354 return return_code; 1386 return return_code;
1355 } 1387 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698