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 // Deletes shortcuts at |install_level| from Start menu, Desktop, | |
|
erikwright (departed)
2012/11/07 21:15:30
I guess this is to be removed?
huangs
2012/11/07 21:41:59
I was trying to see if there's anything that can b
gab
2012/11/07 21:44:40
I'd say the opposite, add "taskbar" to this list a
huangs
2012/11/07 22:14:46
Done, replaced old comment with 3-line comment.
| |
| 260 // Quick Launch, and secondary tiles on the Start Screen (Win8+). | |
| 261 // Only shortcuts pointing to |target| will be removed. | |
| 262 | |
| 263 | |
| 259 // This method deletes the product's shortcut folder from the | 264 // This method deletes the product's shortcut folder from the |
| 260 // Windows Start menu. It checks system_uninstall to see if the shortcut is | 265 // Windows Start menu. It checks system_uninstall to see if the shortcut is |
| 261 // in all users start menu or current user start menu. | 266 // in all users start menu or current user start menu. |
| 262 // We try to remove the standard desktop shortcut but if that fails we try | 267 // 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 | 268 // 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. | 269 // 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 | 270 // We remove all start screen secondary tiles by removing the folder Windows |
| 266 // uses to store this installation's tiles. | 271 // uses to store this installation's tiles. |
| 267 void DeleteShortcuts(const InstallerState& installer_state, | 272 void DeleteShortcuts(const InstallerState& installer_state, |
|
gab
2012/11/07 21:44:40
And see, that's why we asked you not to commit you
huangs
2012/11/07 22:14:46
!
| |
| 268 const Product& product, | 273 const Product& product, |
| 269 const string16& target_exe) { | 274 const string16& target_exe) { |
| 270 BrowserDistribution* dist = product.distribution(); | 275 BrowserDistribution* dist = product.distribution(); |
| 271 | 276 |
| 272 // The per-user shortcut for this user, if present on a system-level install, | 277 // 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(). | 278 // has already been deleted in chrome_browser_main_win.cc::DoUninstallTasks(). |
| 274 ShellUtil::ShellChange install_level = installer_state.system_install() ? | 279 ShellUtil::ShellChange install_level = installer_state.system_install() ? |
| 275 ShellUtil::SYSTEM_LEVEL : ShellUtil::CURRENT_USER; | 280 ShellUtil::SYSTEM_LEVEL : ShellUtil::CURRENT_USER; |
| 276 | 281 |
| 277 VLOG(1) << "Deleting Desktop shortcut."; | 282 VLOG(1) << "Deleting Desktop shortcut."; |
| (...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1046 new_cmd.AppendSwitch(installer::switches::kRemoveChromeRegistration); | 1051 new_cmd.AppendSwitch(installer::switches::kRemoveChromeRegistration); |
| 1047 if (!suffix.empty()) { | 1052 if (!suffix.empty()) { |
| 1048 new_cmd.AppendSwitchNative( | 1053 new_cmd.AppendSwitchNative( |
| 1049 installer::switches::kRegisterChromeBrowserSuffix, suffix); | 1054 installer::switches::kRegisterChromeBrowserSuffix, suffix); |
| 1050 } | 1055 } |
| 1051 DWORD exit_code = installer::UNKNOWN_STATUS; | 1056 DWORD exit_code = installer::UNKNOWN_STATUS; |
| 1052 InstallUtil::ExecuteExeAsAdmin(new_cmd, &exit_code); | 1057 InstallUtil::ExecuteExeAsAdmin(new_cmd, &exit_code); |
| 1053 } | 1058 } |
| 1054 } | 1059 } |
| 1055 | 1060 |
| 1061 if (product.is_chrome_app_host()) { | |
| 1062 // Remove this check once we have system-level App Host. | |
|
gab
2012/11/07 21:44:40
Add TODO in front of comment.
huangs
2012/11/07 22:14:46
Done.
| |
| 1063 DCHECK(!installer_state.system_install()); | |
| 1064 const string16 app_host_exe( | |
| 1065 installer_state.target_path().Append(installer::kChromeAppHostExe) | |
| 1066 .value()); | |
| 1067 // Delete shortcuts from Start menu, Desktop, and Quick Launch. | |
| 1068 DeleteShortcuts(installer_state, product, app_host_exe); | |
| 1069 } | |
| 1070 | |
| 1056 // Chrome is not in use so lets uninstall Chrome by deleting various files | 1071 // 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 | 1072 // and registry entries. Here we will just make best effort and keep going |
| 1058 // in case of errors. | 1073 // in case of errors. |
| 1059 if (is_chrome) { | 1074 if (is_chrome) { |
|
gab
2012/11/07 21:44:40
else if {} from block above, the product can't bot
huangs
2012/11/07 22:14:46
Done (using else if; handling is_chrome first).
| |
| 1060 ClearRlzProductState(); | 1075 ClearRlzProductState(); |
| 1061 // Delete the key that delegate_execute might make. | 1076 // Delete the key that delegate_execute might make. |
| 1062 if (base::win::GetVersion() >= base::win::VERSION_WIN8) { | 1077 if (base::win::GetVersion() >= base::win::VERSION_WIN8) { |
| 1063 InstallUtil::DeleteRegistryKey(HKEY_CURRENT_USER, | 1078 InstallUtil::DeleteRegistryKey(HKEY_CURRENT_USER, |
| 1064 chrome::kMetroRegistryPath); | 1079 chrome::kMetroRegistryPath); |
| 1065 } | 1080 } |
| 1066 | 1081 |
| 1067 auto_launch_util::DisableAllAutoStartFeatures( | 1082 auto_launch_util::DisableAllAutoStartFeatures( |
| 1068 ASCIIToUTF16(chrome::kInitialProfile)); | 1083 ASCIIToUTF16(chrome::kInitialProfile)); |
| 1069 | 1084 |
| 1070 // First delete shortcuts from Start->Programs, Desktop & Quick Launch. | 1085 // Delete shortcuts from Start menu, Desktop, and Quick Launch. |
|
gab
2012/11/07 21:44:40
This comment is now also missing taskbar and start
huangs
2012/11/07 22:14:46
Done (removed both comments from the 2 callers).
| |
| 1071 DeleteShortcuts(installer_state, product, chrome_exe); | 1086 DeleteShortcuts(installer_state, product, chrome_exe); |
| 1072 } | 1087 } |
| 1073 | 1088 |
| 1074 // Delete the registry keys (Uninstall key and Version key). | 1089 // Delete the registry keys (Uninstall key and Version key). |
| 1075 HKEY reg_root = installer_state.root_key(); | 1090 HKEY reg_root = installer_state.root_key(); |
| 1076 | 1091 |
| 1077 // Note that we must retrieve the distribution-specific data before deleting | 1092 // Note that we must retrieve the distribution-specific data before deleting |
| 1078 // product.GetVersionKey(). | 1093 // product.GetVersionKey(). |
| 1079 string16 distribution_data(browser_dist->GetDistributionData(reg_root)); | 1094 string16 distribution_data(browser_dist->GetDistributionData(reg_root)); |
| 1080 | 1095 |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1265 | 1280 |
| 1266 // Try and delete the preserved local state once the post-install | 1281 // Try and delete the preserved local state once the post-install |
| 1267 // operations are complete. | 1282 // operations are complete. |
| 1268 if (!backup_state_file.empty()) | 1283 if (!backup_state_file.empty()) |
| 1269 file_util::Delete(backup_state_file, false); | 1284 file_util::Delete(backup_state_file, false); |
| 1270 | 1285 |
| 1271 return ret; | 1286 return ret; |
| 1272 } | 1287 } |
| 1273 | 1288 |
| 1274 } // namespace installer | 1289 } // namespace installer |
| OLD | NEW |