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

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: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/installer/util/google_update_constants.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 using installer::InstallationState; 61 using installer::InstallationState;
62 using installer::InstallationValidator; 62 using installer::InstallationValidator;
63 using installer::Product; 63 using installer::Product;
64 using installer::ProductState; 64 using installer::ProductState;
65 using installer::Products; 65 using installer::Products;
66 using installer::MasterPreferences; 66 using installer::MasterPreferences;
67 67
68 const wchar_t kChromePipeName[] = L"\\\\.\\pipe\\ChromeCrashServices"; 68 const wchar_t kChromePipeName[] = L"\\\\.\\pipe\\ChromeCrashServices";
69 const wchar_t kGoogleUpdatePipeName[] = L"\\\\.\\pipe\\GoogleCrashServices\\"; 69 const wchar_t kGoogleUpdatePipeName[] = L"\\\\.\\pipe\\GoogleCrashServices\\";
70 const wchar_t kSystemPrincipalSid[] = L"S-1-5-18"; 70 const wchar_t kSystemPrincipalSid[] = L"S-1-5-18";
71 const int kGoogleUpdateTimeoutMs = 20 * 1000;
71 72
72 const MINIDUMP_TYPE kLargerDumpType = static_cast<MINIDUMP_TYPE>( 73 const MINIDUMP_TYPE kLargerDumpType = static_cast<MINIDUMP_TYPE>(
73 MiniDumpWithProcessThreadData | // Get PEB and TEB. 74 MiniDumpWithProcessThreadData | // Get PEB and TEB.
74 MiniDumpWithUnloadedModules | // Get unloaded modules when available. 75 MiniDumpWithUnloadedModules | // Get unloaded modules when available.
75 MiniDumpWithIndirectlyReferencedMemory); // Get memory referenced by stack. 76 MiniDumpWithIndirectlyReferencedMemory); // Get memory referenced by stack.
76 77
77 namespace { 78 namespace {
78 79
79 // This method unpacks and uncompresses the given archive file. For Chrome 80 // This method unpacks and uncompresses the given archive file. For Chrome
80 // install we are creating a uncompressed archive that contains all the files 81 // install we are creating a uncompressed archive that contains all the files
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 } else if (!force_uninstall) { 828 } else if (!force_uninstall) {
828 LOG(ERROR) << product.distribution()->GetAppShortCutName() 829 LOG(ERROR) << product.distribution()->GetAppShortCutName()
829 << " not found for uninstall."; 830 << " not found for uninstall.";
830 return installer::CHROME_NOT_INSTALLED; 831 return installer::CHROME_NOT_INSTALLED;
831 } 832 }
832 833
833 return installer::UninstallProduct(original_state, installer_state, 834 return installer::UninstallProduct(original_state, installer_state,
834 cmd_line.GetProgram(), product, remove_all, force_uninstall, cmd_line); 835 cmd_line.GetProgram(), product, remove_all, force_uninstall, cmd_line);
835 } 836 }
836 837
838 // Tell Google Update that an uninstall has taken place. This gives it a chance
839 // to uninstall itself straight away if no more products are installed on the
840 // system rather than waiting for the next time the scheduled task runs.
841 // Success or failure of Google Update has no bearing on the success or failure
842 // of Chrome's uninstallation.
843 void UninstallGoogleUpdate(bool system_install) {
844 string16 uninstall_cmd(
845 GoogleUpdateSettings::GetUninstallCommandLine(system_install));
846 if (!uninstall_cmd.empty()) {
847 base::win::ScopedHandle process;
848 LOG(INFO) << "Launching Google Update's uninstaller: " << uninstall_cmd;
849 if (base::LaunchProcess(uninstall_cmd, base::LaunchOptions(),
850 process.Receive())) {
851 int exit_code = 0;
852 if (base::WaitForExitCodeWithTimeout(process, &exit_code,
853 kGoogleUpdateTimeoutMs)) {
854 if (exit_code == 0) {
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 // The process didn't finish in time, or GetExitCodeProcess failed.
862 LOG(ERROR) << "Google Update uninstaller (" << uninstall_cmd
863 << ") is taking more than " << kGoogleUpdateTimeoutMs
864 << " milliseconds to complete.";
865 }
866 } else {
867 PLOG(ERROR) << "Failed to launch Google Update uninstaller ("
868 << uninstall_cmd << ")";
869 }
870 }
871 }
872
837 installer::InstallStatus UninstallProducts( 873 installer::InstallStatus UninstallProducts(
838 const InstallationState& original_state, 874 const InstallationState& original_state,
839 const InstallerState& installer_state, 875 const InstallerState& installer_state,
840 const CommandLine& cmd_line) { 876 const CommandLine& cmd_line) {
841 const Products& products = installer_state.products(); 877 const Products& products = installer_state.products();
842 // InstallerState::Initialize always puts Chrome first, and we rely on that 878 // 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 879 // 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 880 // confirm uninstallation. Upon cancel, we should not continue with the
845 // other products. 881 // other products.
846 DCHECK(products.size() < 2 || products[0]->is_chrome()); 882 DCHECK(products.size() < 2 || products[0]->is_chrome());
847 installer::InstallStatus install_status = installer::UNINSTALL_SUCCESSFUL; 883 installer::InstallStatus install_status = installer::UNINSTALL_SUCCESSFUL;
848 installer::InstallStatus prod_status = installer::UNKNOWN_STATUS; 884 installer::InstallStatus prod_status = installer::UNKNOWN_STATUS;
849 const bool force = cmd_line.HasSwitch(installer::switches::kForceUninstall); 885 const bool force = cmd_line.HasSwitch(installer::switches::kForceUninstall);
850 const bool remove_all = !cmd_line.HasSwitch( 886 const bool remove_all = !cmd_line.HasSwitch(
851 installer::switches::kDoNotRemoveSharedItems); 887 installer::switches::kDoNotRemoveSharedItems);
852 888
853 for (size_t i = 0; 889 for (size_t i = 0;
854 install_status != installer::UNINSTALL_CANCELLED && 890 install_status != installer::UNINSTALL_CANCELLED &&
855 i < products.size(); 891 i < products.size();
856 ++i) { 892 ++i) {
857 prod_status = UninstallProduct(original_state, installer_state, 893 prod_status = UninstallProduct(original_state, installer_state,
858 cmd_line, remove_all, force, *products[i]); 894 cmd_line, remove_all, force, *products[i]);
859 if (prod_status != installer::UNINSTALL_SUCCESSFUL) 895 if (prod_status != installer::UNINSTALL_SUCCESSFUL)
860 install_status = prod_status; 896 install_status = prod_status;
861 } 897 }
862 898
899 UninstallGoogleUpdate(installer_state.system_install());
900
863 return install_status; 901 return install_status;
864 } 902 }
865 903
866 installer::InstallStatus ShowEULADialog(const std::wstring& inner_frame) { 904 installer::InstallStatus ShowEULADialog(const std::wstring& inner_frame) {
867 VLOG(1) << "About to show EULA"; 905 VLOG(1) << "About to show EULA";
868 std::wstring eula_path = installer::GetLocalizedEulaResource(); 906 std::wstring eula_path = installer::GetLocalizedEulaResource();
869 if (eula_path.empty()) { 907 if (eula_path.empty()) {
870 LOG(ERROR) << "No EULA path available"; 908 LOG(ERROR) << "No EULA path available";
871 return installer::EULA_REJECTED; 909 return installer::EULA_REJECTED;
872 } 910 }
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
1346 if (!(installer_state.is_msi() && is_uninstall)) 1384 if (!(installer_state.is_msi() && is_uninstall))
1347 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT 1385 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT
1348 // to pass through, since this is only returned on uninstall which is 1386 // to pass through, since this is only returned on uninstall which is
1349 // never invoked directly by Google Update. 1387 // never invoked directly by Google Update.
1350 return_code = InstallUtil::GetInstallReturnCode(install_status); 1388 return_code = InstallUtil::GetInstallReturnCode(install_status);
1351 1389
1352 VLOG(1) << "Installation complete, returning: " << return_code; 1390 VLOG(1) << "Installation complete, returning: " << return_code;
1353 1391
1354 return return_code; 1392 return return_code;
1355 } 1393 }
OLDNEW
« 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