OLD | NEW |
---|---|
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 "base/at_exit.h" | 10 #include "base/at_exit.h" |
(...skipping 10 matching lines...) Expand all Loading... | |
21 #include "base/stringprintf.h" | 21 #include "base/stringprintf.h" |
22 #include "base/utf_string_conversions.h" | 22 #include "base/utf_string_conversions.h" |
23 #include "base/values.h" | 23 #include "base/values.h" |
24 #include "base/win/registry.h" | 24 #include "base/win/registry.h" |
25 #include "base/win/scoped_com_initializer.h" | 25 #include "base/win/scoped_com_initializer.h" |
26 #include "base/win/scoped_comptr.h" | 26 #include "base/win/scoped_comptr.h" |
27 #include "base/win/scoped_handle.h" | 27 #include "base/win/scoped_handle.h" |
28 #include "base/win/win_util.h" | 28 #include "base/win/win_util.h" |
29 #include "base/win/windows_version.h" | 29 #include "base/win/windows_version.h" |
30 #include "breakpad/src/client/windows/handler/exception_handler.h" | 30 #include "breakpad/src/client/windows/handler/exception_handler.h" |
31 #include "chrome/common/chrome_constants.h" | |
31 #include "chrome/common/chrome_switches.h" | 32 #include "chrome/common/chrome_switches.h" |
32 #include "chrome/installer/setup/chrome_frame_quick_enable.h" | 33 #include "chrome/installer/setup/chrome_frame_quick_enable.h" |
33 #include "chrome/installer/setup/chrome_frame_ready_mode.h" | 34 #include "chrome/installer/setup/chrome_frame_ready_mode.h" |
34 #include "chrome/installer/setup/install.h" | 35 #include "chrome/installer/setup/install.h" |
35 #include "chrome/installer/setup/install_worker.h" | 36 #include "chrome/installer/setup/install_worker.h" |
36 #include "chrome/installer/setup/setup_constants.h" | 37 #include "chrome/installer/setup/setup_constants.h" |
37 #include "chrome/installer/setup/setup_util.h" | 38 #include "chrome/installer/setup/setup_util.h" |
38 #include "chrome/installer/setup/uninstall.h" | 39 #include "chrome/installer/setup/uninstall.h" |
39 #include "chrome/installer/util/browser_distribution.h" | 40 #include "chrome/installer/util/browser_distribution.h" |
40 #include "chrome/installer/util/channel_info.h" | 41 #include "chrome/installer/util/channel_info.h" |
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
997 original_state, installer_state, cmd_line.GetProgram(), product, | 998 original_state, installer_state, cmd_line.GetProgram(), product, |
998 remove_all, force_uninstall, cmd_line); | 999 remove_all, force_uninstall, cmd_line); |
999 } | 1000 } |
1000 | 1001 |
1001 installer::InstallStatus UninstallProducts( | 1002 installer::InstallStatus UninstallProducts( |
1002 const InstallationState& original_state, | 1003 const InstallationState& original_state, |
1003 const InstallerState& installer_state, | 1004 const InstallerState& installer_state, |
1004 const CommandLine& cmd_line) { | 1005 const CommandLine& cmd_line) { |
1005 const Products& products = installer_state.products(); | 1006 const Products& products = installer_state.products(); |
1006 | 1007 |
1008 // Decide whether Active Setup should be triggered and/or system-level Chrome | |
1009 // should be launched post-uninstall. This needs to be done outside the | |
1010 // UninstallProduct calls as some of them might terminate the processes | |
1011 // launched by a previous one otherwise... | |
1012 bool trigger_active_setup = false; | |
1013 // System-level Chrome will be launched via this command if its program gets | |
1014 // set below. | |
1015 CommandLine system_level_cmd(CommandLine::NO_PROGRAM); | |
1016 | |
1007 if (installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER)) { | 1017 if (installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER)) { |
1008 // InstallerState::Initialize always puts Chrome first, and we rely on that | 1018 // InstallerState::Initialize always puts Chrome first, and we rely on that |
1009 // here for this reason: if Chrome is in-use, the user will be prompted to | 1019 // here for this reason: if Chrome is in-use, the user will be prompted to |
1010 // confirm uninstallation. Upon cancel, we should not continue with the | 1020 // confirm uninstallation. Upon cancel, we should not continue with the |
1011 // other products. | 1021 // other products. |
1012 DCHECK(products[0]->is_chrome()); | 1022 DCHECK(products[0]->is_chrome()); |
1023 | |
1024 if (cmd_line.HasSwitch(installer::switches::kSelfDestruct) && | |
1025 !installer_state.system_install()) { | |
1026 BrowserDistribution* dist = products[0]->distribution(); | |
grt (UTC plus 2)
2013/01/03 15:41:27
even though there's a DCHECK to enforce that produ
gab
2013/01/03 17:11:14
Done.
| |
1027 const FilePath system_exe_path( | |
1028 installer::GetChromeInstallPath(true, dist) | |
1029 .Append(installer::kChromeExe)); | |
1030 system_level_cmd.SetProgram(system_exe_path); | |
1031 | |
1032 FilePath first_run_sentinel; | |
1033 InstallUtil::GetSentinelFilePath( | |
1034 chrome::kFirstRunSentinel, dist, &first_run_sentinel); | |
1035 if (file_util::PathExists(first_run_sentinel)) { | |
1036 // If the Chrome being self-destructed has already undergone First Run, | |
1037 // trigger Active Setup and make sure the system-level Chrome doesn't go | |
1038 // through first run. | |
1039 trigger_active_setup = true; | |
1040 system_level_cmd.AppendSwitch(::switches::kNoFirstRun); | |
1041 } | |
1042 } | |
1013 } | 1043 } |
1014 if (installer_state.FindProduct(BrowserDistribution::CHROME_BINARIES)) { | 1044 if (installer_state.FindProduct(BrowserDistribution::CHROME_BINARIES)) { |
1015 // Chrome Binaries should be last; if something else is cancelled, they | 1045 // Chrome Binaries should be last; if something else is cancelled, they |
1016 // should stay. | 1046 // should stay. |
1017 DCHECK(products[products.size() - 1]->is_chrome_binaries()); | 1047 DCHECK(products[products.size() - 1]->is_chrome_binaries()); |
1018 } | 1048 } |
1019 | 1049 |
1020 installer::InstallStatus install_status = installer::UNINSTALL_SUCCESSFUL; | 1050 installer::InstallStatus install_status = installer::UNINSTALL_SUCCESSFUL; |
1021 installer::InstallStatus prod_status = installer::UNKNOWN_STATUS; | 1051 installer::InstallStatus prod_status = installer::UNKNOWN_STATUS; |
1022 const bool force = cmd_line.HasSwitch(installer::switches::kForceUninstall); | 1052 const bool force = cmd_line.HasSwitch(installer::switches::kForceUninstall); |
1023 const bool remove_all = !cmd_line.HasSwitch( | 1053 const bool remove_all = !cmd_line.HasSwitch( |
1024 installer::switches::kDoNotRemoveSharedItems); | 1054 installer::switches::kDoNotRemoveSharedItems); |
1025 | 1055 |
1026 for (Products::const_iterator it = products.begin(); | 1056 for (Products::const_iterator it = products.begin(); |
1027 install_status != installer::UNINSTALL_CANCELLED && it < products.end(); | 1057 install_status != installer::UNINSTALL_CANCELLED && it < products.end(); |
1028 ++it) { | 1058 ++it) { |
1029 prod_status = UninstallProduct(original_state, installer_state, | 1059 prod_status = UninstallProduct(original_state, installer_state, |
1030 cmd_line, remove_all, force, **it); | 1060 cmd_line, remove_all, force, **it); |
1031 if (prod_status != installer::UNINSTALL_SUCCESSFUL) | 1061 if (prod_status != installer::UNINSTALL_SUCCESSFUL) |
1032 install_status = prod_status; | 1062 install_status = prod_status; |
1033 } | 1063 } |
1034 | 1064 |
1035 installer::CleanUpInstallationDirectoryAfterUninstall( | 1065 installer::CleanUpInstallationDirectoryAfterUninstall( |
1036 original_state, installer_state, cmd_line, &install_status); | 1066 original_state, installer_state, cmd_line, &install_status); |
1037 | 1067 |
1068 if (trigger_active_setup) | |
1069 InstallUtil::TriggerActiveSetupCommand(); | |
1070 | |
1071 if (!system_level_cmd.GetProgram().empty()) | |
1072 base::LaunchProcess(system_level_cmd, base::LaunchOptions(), NULL); | |
1073 | |
1038 // Tell Google Update that an uninstall has taken place. | 1074 // Tell Google Update that an uninstall has taken place. |
1039 // Ignore the return value: success or failure of Google Update | 1075 // Ignore the return value: success or failure of Google Update |
1040 // has no bearing on the success or failure of Chrome's uninstallation. | 1076 // has no bearing on the success or failure of Chrome's uninstallation. |
1041 google_update::UninstallGoogleUpdate(installer_state.system_install()); | 1077 google_update::UninstallGoogleUpdate(installer_state.system_install()); |
1042 | 1078 |
1043 return install_status; | 1079 return install_status; |
1044 } | 1080 } |
1045 | 1081 |
1046 installer::InstallStatus ShowEULADialog(const string16& inner_frame) { | 1082 installer::InstallStatus ShowEULADialog(const string16& inner_frame) { |
1047 VLOG(1) << "About to show EULA"; | 1083 VLOG(1) << "About to show EULA"; |
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1667 if (!(installer_state.is_msi() && is_uninstall)) | 1703 if (!(installer_state.is_msi() && is_uninstall)) |
1668 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT | 1704 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT |
1669 // to pass through, since this is only returned on uninstall which is | 1705 // to pass through, since this is only returned on uninstall which is |
1670 // never invoked directly by Google Update. | 1706 // never invoked directly by Google Update. |
1671 return_code = InstallUtil::GetInstallReturnCode(install_status); | 1707 return_code = InstallUtil::GetInstallReturnCode(install_status); |
1672 | 1708 |
1673 VLOG(1) << "Installation complete, returning: " << return_code; | 1709 VLOG(1) << "Installation complete, returning: " << return_code; |
1674 | 1710 |
1675 return return_code; | 1711 return return_code; |
1676 } | 1712 } |
OLD | NEW |