Chromium Code Reviews| 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 // This file defines the methods useful for uninstalling Chrome. | 5 // This file defines the methods useful for uninstalling Chrome. |
| 6 | 6 |
| 7 #include "chrome/installer/setup/uninstall.h" | 7 #include "chrome/installer/setup/uninstall.h" |
| 8 | 8 |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 | 10 |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 249 } | 249 } |
| 250 } | 250 } |
| 251 | 251 |
| 252 if (kill) { | 252 if (kill) { |
| 253 VLOG(1) << installer::kChromeFrameHelperExe << " hung. Killing."; | 253 VLOG(1) << installer::kChromeFrameHelperExe << " hung. Killing."; |
| 254 base::CleanupProcesses(installer::kChromeFrameHelperExe, base::TimeDelta(), | 254 base::CleanupProcesses(installer::kChromeFrameHelperExe, base::TimeDelta(), |
| 255 content::RESULT_CODE_HUNG, NULL); | 255 content::RESULT_CODE_HUNG, NULL); |
| 256 } | 256 } |
| 257 } | 257 } |
| 258 | 258 |
| 259 // This method deletes the product's shortcut folder from the | 259 // Deletes shortcuts at |install_level| from Start menu, Desktop, |
| 260 // Windows Start menu. It checks system_uninstall to see if the shortcut is | 260 // Quick Launch, taskbar, and secondary tiles on the Start Screen (Win8+). |
| 261 // in all users start menu or current user start menu. | 261 // Only shortcuts pointing to |target| will be removed. |
| 262 // We try to remove the standard desktop shortcut but if that fails we try | |
| 263 // to remove the alternate desktop shortcut. Only one of them should be | |
| 264 // present in a given install but at this point we don't know which one. | |
| 265 // We remove all start screen secondary tiles by removing the folder Windows | |
| 266 // uses to store this installation's tiles. | |
| 267 void DeleteShortcuts(const InstallerState& installer_state, | 262 void DeleteShortcuts(const InstallerState& installer_state, |
| 268 const Product& product, | 263 const Product& product, |
| 269 const string16& target_exe) { | 264 const string16& target_exe) { |
| 270 BrowserDistribution* dist = product.distribution(); | 265 BrowserDistribution* dist = product.distribution(); |
| 271 | 266 |
| 272 // The per-user shortcut for this user, if present on a system-level install, | 267 // The per-user shortcut for this user, if present on a system-level install, |
| 273 // has already been deleted in chrome_browser_main_win.cc::DoUninstallTasks(). | 268 // has already been deleted in chrome_browser_main_win.cc::DoUninstallTasks(). |
| 274 ShellUtil::ShellChange install_level = installer_state.system_install() ? | 269 ShellUtil::ShellChange install_level = installer_state.system_install() ? |
| 275 ShellUtil::SYSTEM_LEVEL : ShellUtil::CURRENT_USER; | 270 ShellUtil::SYSTEM_LEVEL : ShellUtil::CURRENT_USER; |
| 276 | 271 |
| (...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1046 new_cmd.AppendSwitch(installer::switches::kRemoveChromeRegistration); | 1041 new_cmd.AppendSwitch(installer::switches::kRemoveChromeRegistration); |
| 1047 if (!suffix.empty()) { | 1042 if (!suffix.empty()) { |
| 1048 new_cmd.AppendSwitchNative( | 1043 new_cmd.AppendSwitchNative( |
| 1049 installer::switches::kRegisterChromeBrowserSuffix, suffix); | 1044 installer::switches::kRegisterChromeBrowserSuffix, suffix); |
| 1050 } | 1045 } |
| 1051 DWORD exit_code = installer::UNKNOWN_STATUS; | 1046 DWORD exit_code = installer::UNKNOWN_STATUS; |
| 1052 InstallUtil::ExecuteExeAsAdmin(new_cmd, &exit_code); | 1047 InstallUtil::ExecuteExeAsAdmin(new_cmd, &exit_code); |
| 1053 } | 1048 } |
| 1054 } | 1049 } |
| 1055 | 1050 |
| 1056 // Chrome is not in use so lets uninstall Chrome by deleting various files | |
| 1057 // and registry entries. Here we will just make best effort and keep going | |
| 1058 // in case of errors. | |
| 1059 if (is_chrome) { | 1051 if (is_chrome) { |
| 1052 // Chrome is not in use so lets uninstall Chrome by deleting various files | |
| 1053 // and registry entries. Here we will just make best effort and keep going | |
| 1054 // in case of errors. | |
| 1060 ClearRlzProductState(); | 1055 ClearRlzProductState(); |
| 1061 // Delete the key that delegate_execute might make. | 1056 // Delete the key that delegate_execute might make. |
| 1062 if (base::win::GetVersion() >= base::win::VERSION_WIN8) { | 1057 if (base::win::GetVersion() >= base::win::VERSION_WIN8) { |
| 1063 InstallUtil::DeleteRegistryKey(HKEY_CURRENT_USER, | 1058 InstallUtil::DeleteRegistryKey(HKEY_CURRENT_USER, |
| 1064 chrome::kMetroRegistryPath); | 1059 chrome::kMetroRegistryPath); |
| 1065 } | 1060 } |
| 1066 | 1061 |
| 1067 auto_launch_util::DisableAllAutoStartFeatures( | 1062 auto_launch_util::DisableAllAutoStartFeatures( |
| 1068 ASCIIToUTF16(chrome::kInitialProfile)); | 1063 ASCIIToUTF16(chrome::kInitialProfile)); |
| 1069 | 1064 |
| 1070 // First delete shortcuts from Start->Programs, Desktop & Quick Launch. | |
| 1071 DeleteShortcuts(installer_state, product, chrome_exe); | 1065 DeleteShortcuts(installer_state, product, chrome_exe); |
| 1066 | |
| 1067 } else if (product.is_chrome_app_host()) { | |
| 1068 // TODO(huangs): Remove this check once we have system-level App Host. | |
| 1069 DCHECK(!installer_state.system_install()); | |
| 1070 const string16 app_host_exe( | |
| 1071 installer_state.target_path().Append(installer::kChromeAppHostExe) | |
| 1072 .value()); | |
| 1073 DeleteShortcuts(installer_state, product, app_host_exe); | |
| 1072 } | 1074 } |
| 1073 | 1075 |
|
gab
2012/11/08 00:10:58
nit: Should be only one empty line between the end
huangs
2012/11/08 00:26:02
Done.
| |
| 1076 | |
| 1074 // Delete the registry keys (Uninstall key and Version key). | 1077 // Delete the registry keys (Uninstall key and Version key). |
| 1075 HKEY reg_root = installer_state.root_key(); | 1078 HKEY reg_root = installer_state.root_key(); |
| 1076 | 1079 |
| 1077 // Note that we must retrieve the distribution-specific data before deleting | 1080 // Note that we must retrieve the distribution-specific data before deleting |
| 1078 // product.GetVersionKey(). | 1081 // product.GetVersionKey(). |
| 1079 string16 distribution_data(browser_dist->GetDistributionData(reg_root)); | 1082 string16 distribution_data(browser_dist->GetDistributionData(reg_root)); |
| 1080 | 1083 |
| 1081 // Remove Control Panel uninstall link. | 1084 // Remove Control Panel uninstall link. |
| 1082 if (product.ShouldCreateUninstallEntry()) { | 1085 if (product.ShouldCreateUninstallEntry()) { |
| 1083 InstallUtil::DeleteRegistryKey(reg_root, | 1086 InstallUtil::DeleteRegistryKey(reg_root, |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1265 | 1268 |
| 1266 // Try and delete the preserved local state once the post-install | 1269 // Try and delete the preserved local state once the post-install |
| 1267 // operations are complete. | 1270 // operations are complete. |
| 1268 if (!backup_state_file.empty()) | 1271 if (!backup_state_file.empty()) |
| 1269 file_util::Delete(backup_state_file, false); | 1272 file_util::Delete(backup_state_file, false); |
| 1270 | 1273 |
| 1271 return ret; | 1274 return ret; |
| 1272 } | 1275 } |
| 1273 | 1276 |
| 1274 } // namespace installer | 1277 } // namespace installer |
| OLD | NEW |